use of org.apache.cxf.jaxrs.model.UserResource in project camel by apache.
the class RsClientDefinitionParser method parse.
public Metadata parse(Element element, ParserContext context) {
MutableBeanMetadata beanMetadata = createBeanMetadata(element, context, RsClientBlueprintBean.class);
NamedNodeMap atts = element.getAttributes();
String bus = null;
for (int i = 0; i < atts.getLength(); i++) {
Attr node = (Attr) atts.item(i);
String val = node.getValue();
String pre = node.getPrefix();
String name = node.getLocalName();
if ("bus".equals(name)) {
bus = val;
} else if (isAttribute(pre, name)) {
if ("depends-on".equals(name)) {
beanMetadata.addDependsOn(val);
} else if (!"name".equals(name)) {
beanMetadata.addProperty(name, AbstractBPBeanDefinitionParser.createValue(context, val));
}
}
}
for (Element elem = DOMUtils.getFirstElement(element); elem != null; elem = DOMUtils.getNextElement(elem)) {
String name = elem.getLocalName();
if ("properties".equals(name) || "headers".equals(name)) {
Metadata map = parseMapData(context, beanMetadata, elem);
beanMetadata.addProperty(name, map);
} else if ("binding".equals(name)) {
setFirstChildAsProperty(elem, context, beanMetadata, "bindingConfig");
} else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name) || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name) || "features".equals(name) || "schemaLocations".equals(name) || "handlers".equals(name)) {
Metadata list = parseListData(context, beanMetadata, elem);
beanMetadata.addProperty(name, list);
} else if ("features".equals(name) || "providers".equals(name) || "schemaLocations".equals(name) || "modelBeans".equals(name)) {
Metadata list = parseListData(context, beanMetadata, elem);
beanMetadata.addProperty(name, list);
} else if ("model".equals(name)) {
List<UserResource> resources = ResourceUtils.getResourcesFromElement(elem);
MutablePassThroughMetadata value = context.createMetadata(MutablePassThroughMetadata.class);
value.setObject(resources);
beanMetadata.addProperty(name, value);
} else {
setFirstChildAsProperty(elem, context, beanMetadata, name);
}
}
if (StringUtils.isEmpty(bus)) {
bus = "cxf";
}
//Will create a bus if needed...
beanMetadata.addProperty("bus", getBusRef(context, bus));
return beanMetadata;
}
use of org.apache.cxf.jaxrs.model.UserResource in project camel by apache.
the class RsServerDefinitionParser method parse.
public Metadata parse(Element element, ParserContext context) {
MutableBeanMetadata beanMetadata = createBeanMetadata(element, context, RsServerBlueprintBean.class);
NamedNodeMap atts = element.getAttributes();
String bus = null;
for (int i = 0; i < atts.getLength(); i++) {
Attr node = (Attr) atts.item(i);
String val = node.getValue();
String pre = node.getPrefix();
String name = node.getLocalName();
if ("bus".equals(name)) {
bus = val;
} else if (isAttribute(pre, name)) {
if ("depends-on".equals(name)) {
beanMetadata.addDependsOn(val);
} else if (!"name".equals(name)) {
beanMetadata.addProperty(name, AbstractBPBeanDefinitionParser.createValue(context, val));
}
}
}
for (Element elem = DOMUtils.getFirstElement(element); elem != null; elem = DOMUtils.getNextElement(elem)) {
String name = elem.getLocalName();
if ("properties".equals(name) || "extensionMappings".equals(name) || "languageMappings".equals(name)) {
Metadata map = parseMapData(context, beanMetadata, elem);
beanMetadata.addProperty(name, map);
} else if ("binding".equals(name)) {
setFirstChildAsProperty(elem, context, beanMetadata, "bindingConfig");
} else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name) || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name) || "features".equals(name) || "schemaLocations".equals(name) || "handlers".equals(name)) {
Metadata list = parseListData(context, beanMetadata, elem);
beanMetadata.addProperty(name, list);
} else if ("features".equals(name) || "providers".equals(name) || "schemaLocations".equals(name) || "modelBeans".equals(name) || "serviceBeans".equals(name)) {
Metadata list = parseListData(context, beanMetadata, elem);
beanMetadata.addProperty(name, list);
} else if ("model".equals(name)) {
List<UserResource> resources = ResourceUtils.getResourcesFromElement(elem);
MutablePassThroughMetadata value = context.createMetadata(MutablePassThroughMetadata.class);
value.setObject(resources);
beanMetadata.addProperty(name, value);
} else {
setFirstChildAsProperty(elem, context, beanMetadata, name);
}
}
if (StringUtils.isEmpty(bus)) {
bus = "cxf";
}
//Will create a bus if needed...
beanMetadata.addProperty("bus", getBusRef(context, bus));
return beanMetadata;
}
Aggregations