private static void defineHandler(API api, OMElement handlerElt) { String handlerClass = handlerElt.getAttributeValue(new QName("class")); if (handlerClass == null || "".equals(handlerClass)) { handleException("A handler element must have a class attribute"); } try { Class clazz = APIFactory.class.getClassLoader().loadClass(handlerClass); Handler handler = (Handler) clazz.newInstance(); api.addHandler(handler); } catch (Exception e) { handleException("Error initializing API handler: " + handlerClass, e); } }
private static void defineHandler(API api, OMElement handlerElt) { String handlerClass = handlerElt.getAttributeValue(new QName("class")); if (handlerClass == null || "".equals(handlerClass)) { handleException("A handler element must have a class attribute"); handleException( "A Class mediator property must specify the name attribute"); } else { PropertyHelper.setInstanceProperty(propName, omElt, handler); } else { handleException("A Class mediator property must specify " + "name and value attributes, or a name and a child XML fragment"); handleException("Error initializing API handler: " + handlerClass, e);
public static API createAPI(OMElement apiElt) { OMAttribute nameAtt = apiElt.getAttribute(new QName("name")); if (nameAtt == null || "".equals(nameAtt.getAttributeValue())) { handleException("Attribute 'name' is required for an API definition"); return null; handleException("Attribute 'context' is required for an API definition"); return null; handleException("An API must contain at least one resource definition"); api.setProtocol(RESTConstants.PROTOCOL_HTTPS_ONLY); } else { handleException("Invalid protocol name: " + transports);
public static API createAPI(OMElement apiElt, Properties properties) { OMAttribute nameAtt = apiElt.getAttribute(new QName("name")); if (nameAtt == null || "".equals(nameAtt.getAttributeValue())) { handleException("Attribute 'name' is required for an API definition"); handleException("Attribute 'context' is required for an API definition"); handleException("An API must contain at least one resource definition"); api.setProtocol(RESTConstants.PROTOCOL_HTTPS_ONLY); } else { handleException("Invalid protocol name: " + transports);