use of org.apache.aries.blueprint.mutable.MutableRefMetadata in project camel by apache.
the class CamelNamespaceHandler method createRef.
private RefMetadata createRef(ParserContext context, String value) {
MutableRefMetadata r = context.createMetadata(MutableRefMetadata.class);
r.setComponentId(value);
return r;
}
use of org.apache.aries.blueprint.mutable.MutableRefMetadata in project aries by apache.
the class ExtNamespaceHandler method createRef.
private static RefMetadata createRef(ParserContext context, String value) {
MutableRefMetadata m = context.createMetadata(MutableRefMetadata.class);
m.setComponentId(value);
return m;
}
use of org.apache.aries.blueprint.mutable.MutableRefMetadata in project aries by apache.
the class SpringOsgiNamespaceHandler method parseReference.
private Metadata parseReference(Element element, ParserContext context) {
MutableReferenceMetadata metadata = context.createMetadata(MutableReferenceMetadata.class);
// Parse attributes
if (element.hasAttribute(ID_ATTRIBUTE)) {
metadata.setId(element.getAttribute(ID_ATTRIBUTE));
} else {
metadata.setId(generateId(context));
}
metadata.setAvailability(CARDINALITY_0_1.equals(element.getAttribute(CARDINALITY_ATTRIBUTE)) ? ReferenceMetadata.AVAILABILITY_OPTIONAL : ReferenceMetadata.AVAILABILITY_MANDATORY);
metadata.setTimeout(getLong(element.getAttribute(TIMEOUT_ATTRIBUTE), DEFAULT_TIMEOUT));
metadata.setInterface(element.getAttribute(INTERFACE_ATTRIBUTE));
metadata.setFilter(element.getAttribute(FILTER_ATTRIBUTE));
String[] dependsOn = StringUtils.tokenizeToStringArray(element.getAttribute(DEPENDS_ON_ATTRIBUTE), ",; ");
metadata.setDependsOn(dependsOn != null ? Arrays.asList(dependsOn) : null);
metadata.setComponentName(element.getAttribute(BEAN_NAME_ELEMENT));
// Parse child elements
for (Element child : getChildren(element)) {
if (element.getNamespaceURI().equals(child.getNamespaceURI())) {
if (INTERFACES_ELEMENT.equals(child.getLocalName())) {
List<String> itfs = parseInterfaces(child);
metadata.setExtraInterfaces(itfs);
} else if (LISTENER_ELEMENT.equals(child.getLocalName())) {
String bindMethod = nonEmpty(child.getAttribute(BIND_METHOD_ATTRIBUTE));
String unbindMethod = nonEmpty(child.getAttribute(UNBIND_METHOD_ATTRIBUTE));
String refStr = nonEmpty(child.getAttribute(REF_ATTRIBUTE));
Target listenerComponent = null;
if (refStr != null) {
MutableRefMetadata ref = context.createMetadata(MutableRefMetadata.class);
ref.setComponentId(refStr);
listenerComponent = ref;
}
for (Element cchild : getChildren(child)) {
if (listenerComponent != null) {
throw new IllegalArgumentException("Only one of @ref attribute or inlined bean definition element is allowed");
}
listenerComponent = parseInlinedTarget(context, metadata, cchild);
}
if (listenerComponent == null) {
throw new IllegalArgumentException("Missing @ref attribute or inlined bean definition element");
}
metadata.addServiceListener(listenerComponent, bindMethod, unbindMethod);
}
} else {
throw new UnsupportedOperationException("Custom namespaces not supported");
}
}
return metadata;
}
use of org.apache.aries.blueprint.mutable.MutableRefMetadata in project aries by apache.
the class CmNamespaceHandler method createRef.
private static RefMetadata createRef(ParserContext context, String value) {
MutableRefMetadata m = context.createMetadata(MutableRefMetadata.class);
m.setComponentId(value);
return m;
}
use of org.apache.aries.blueprint.mutable.MutableRefMetadata in project aries by apache.
the class BlueprintNamespaceHandler method createRef.
private Metadata createRef(ParserContext parserContext, String id) {
MutableRefMetadata ref = parserContext.createMetadata(MutableRefMetadata.class);
ref.setComponentId(id);
return ref;
}
Aggregations