use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project aries by apache.
the class Aries1503aNamespaceHandler method parse.
@Override
public Metadata parse(Element element, ParserContext context) {
MutableBeanMetadata metadata = context.createMetadata(MutableBeanMetadata.class);
metadata.setProcessor(true);
metadata.setId("aries-1503");
metadata.setScope(BeanMetadata.SCOPE_SINGLETON);
metadata.addArgument(new PassThroughMetadata() {
@Override
public Object getObject() {
return "ARIES-1503";
}
@Override
public String getId() {
return "aries-1503-arg";
}
@Override
public int getActivation() {
return 0;
}
@Override
public List<String> getDependsOn() {
return null;
}
}, null, 0);
metadata.setRuntimeClass(String.class);
return metadata;
}
use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project aries by apache.
the class NSHandlerSeven method parse.
// process elements
public Metadata parse(Element element, ParserContext context) {
Metadata retval = null;
if (element.getLocalName().equals(ELT_NAME)) {
final String id = element.getAttributeNS(NSURI, ATTRIB_ID);
MutableBeanMetadata bm = context.createMetadata(MutableBeanMetadata.class);
bm.setId(id);
bm.setScope("PROTOTYPE");
bm.setClassName(TestBean.class.getName());
retval = bm;
}
return retval;
}
use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project tomee by apache.
the class CXFAPINamespaceHandler method parse.
@SuppressWarnings("deprecation")
public Metadata parse(Element element, ParserContext context) {
String s = element.getLocalName();
if ("bus".equals(s)) {
// parse bus
return new BusDefinitionParser().parse(element, context);
} else if ("logging".equals(s)) {
// logging feature
return new SimpleBPBeanDefinitionParser(org.apache.cxf.feature.LoggingFeature.class).parse(element, context);
} else if ("fastinfoset".equals(s)) {
// fastinfosetfeature
return new SimpleBPBeanDefinitionParser(FastInfosetFeature.class).parse(element, context);
} else if ("workqueue".equals(s)) {
return new SimpleBPBeanDefinitionParser(AutomaticWorkQueueImpl.class) {
@Override
public String getId(Element element, ParserContext context) {
String id = element.hasAttribute("id") ? element.getAttribute("id") : null;
if (id == null) {
id = "cxf.workqueue.";
id += element.hasAttribute("name") ? element.getAttribute("name") : "def";
}
return id;
}
@Override
protected void processNameAttribute(Element element, ParserContext ctx, MutableBeanMetadata bean, String val) {
bean.addProperty("name", createValue(ctx, val));
}
}.parse(element, context);
}
return null;
}
use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project tomee by apache.
the class BusDefinitionParser method parse.
public Metadata parse(Element element, ParserContext context) {
String bname = element.hasAttribute("bus") ? element.getAttribute("bus") : "cxf";
String id = element.hasAttribute("id") ? element.getAttribute("id") : null;
MutableBeanMetadata cxfBean = getBus(context, bname);
parseAttributes(element, context, cxfBean);
parseChildElements(element, context, cxfBean);
context.getComponentDefinitionRegistry().removeComponentDefinition(bname);
if (!StringUtils.isEmpty(id)) {
cxfBean.addProperty("id", createValue(context, id));
}
return cxfBean;
}
use of org.apache.aries.blueprint.mutable.MutableBeanMetadata in project cxf by apache.
the class JettyServerEngineFactoryParser method parse.
public Metadata parse(Element element, ParserContext context) {
// Endpoint definition
MutableBeanMetadata ef = context.createMetadata(MutableBeanMetadata.class);
if (!StringUtils.isEmpty(getIdOrName(element))) {
ef.setId(getIdOrName(element));
} else {
ef.setId("jetty.engine.factory-holder-" + UUID.randomUUID().toString());
}
ef.setRuntimeClass(JettyHTTPServerEngineFactoryHolder.class);
try {
// Print the DOM node
String xmlString = StaxUtils.toString(element);
ef.addProperty("parsedElement", createValue(context, xmlString));
ef.setInitMethod("init");
ef.setActivation(ComponentMetadata.ACTIVATION_EAGER);
ef.setDestroyMethod("destroy");
// setup the EngineConnector
List<Element> engines = DOMUtils.getChildrenWithName(element, HTTPJettyTransportNamespaceHandler.JETTY_TRANSPORT, "engine");
ef.addProperty("connectorMap", parseEngineConnector(engines, ef, context));
ef.addProperty("handlersMap", parseEngineHandlers(engines, ef, context));
return ef;
} catch (Exception e) {
throw new RuntimeException("Could not process configuration.", e);
}
}
Aggregations