use of org.osgi.service.blueprint.reflect.ComponentMetadata in project cxf by apache.
the class ConfigurerImpl method initializeWildcardMap.
private void initializeWildcardMap() {
for (String s : container.getComponentIds()) {
if (isWildcardBeanName(s)) {
ComponentMetadata cmd = container.getComponentMetadata(s);
Class<?> cls = BlueprintBeanLocator.getClassForMetaData(container, cmd);
if (cls != null) {
String orig = s;
if (s.charAt(0) == '*') {
// old wildcard
s = "." + s.replaceAll("\\.", "\\.");
}
Matcher matcher = Pattern.compile(s).matcher("");
List<MatcherHolder> m = wildCardBeanDefinitions.get(cls.getName());
if (m == null) {
m = new ArrayList<>();
wildCardBeanDefinitions.put(cls.getName(), m);
}
MatcherHolder holder = new MatcherHolder(orig, matcher);
m.add(holder);
}
}
}
}
use of org.osgi.service.blueprint.reflect.ComponentMetadata in project cxf by apache.
the class JettyServerEngineFactoryParser method parseEngineConnector.
protected Metadata parseEngineConnector(List<Element> engines, ComponentMetadata enclosingComponent, ParserContext context) {
MutableMapMetadata map = context.createMetadata(MutableMapMetadata.class);
map.setKeyType("java.lang.String");
map.setValueType("org.eclipse.jetty.server.Connector");
for (Element engine : engines) {
String port = engine.getAttribute("port");
ValueMetadata keyValue = createValue(context, port);
Element connector = DOMUtils.getFirstChildWithName(engine, HTTPJettyTransportNamespaceHandler.JETTY_TRANSPORT, "connector");
if (connector != null) {
Element first = DOMUtils.getFirstElement(connector);
Metadata valValue = context.parseElement(Metadata.class, enclosingComponent, first);
map.addEntry(keyValue, valValue);
}
}
return map;
}
use of org.osgi.service.blueprint.reflect.ComponentMetadata in project cxf by apache.
the class JettyServerEngineFactoryParser method parseEngineHandlers.
protected Metadata parseEngineHandlers(List<Element> engines, ComponentMetadata enclosingComponent, ParserContext context) {
MutableMapMetadata map = context.createMetadata(MutableMapMetadata.class);
map.setKeyType("java.lang.String");
map.setValueType("java.util.List");
for (Element engine : engines) {
String port = engine.getAttribute("port");
ValueMetadata keyValue = createValue(context, port);
Element handlers = DOMUtils.getFirstChildWithName(engine, HTTPJettyTransportNamespaceHandler.JETTY_TRANSPORT, "handlers");
if (handlers != null) {
Metadata valValue = parseListData(context, enclosingComponent, handlers);
map.addEntry(keyValue, valValue);
}
}
return map;
}
use of org.osgi.service.blueprint.reflect.ComponentMetadata in project cxf by apache.
the class UndertowServerEngineFactoryParser method parseEngineHandlers.
protected Metadata parseEngineHandlers(List<Element> engines, ComponentMetadata enclosingComponent, ParserContext context) {
MutableMapMetadata map = context.createMetadata(MutableMapMetadata.class);
map.setKeyType("java.lang.String");
map.setValueType("java.util.List");
for (Element engine : engines) {
String port = engine.getAttribute("port");
ValueMetadata keyValue = createValue(context, port);
Element handlers = DOMUtils.getFirstChildWithName(engine, HTTPUndertowTransportNamespaceHandler.UNDERTOW_TRANSPORT, "handlers");
if (handlers != null) {
Metadata valValue = parseListData(context, enclosingComponent, handlers);
map.addEntry(keyValue, valValue);
}
}
return map;
}
use of org.osgi.service.blueprint.reflect.ComponentMetadata in project opennms by OpenNMS.
the class OnmsVaadinUIFactory method validate.
/**
* Verify that the current UIFactory is set up correctly.
*/
private void validate() {
// Verify that the uiBean is a subclass of UI
final Object instance = m_blueprintContainer.getComponentInstance(m_uiBeanId);
if (!(instance instanceof UI)) {
throw new IllegalStateException("The bean with id " + m_uiBeanId + " must be of type " + com.vaadin.ui.UI.class);
}
// Verify that the scope is prototype and NOT singleton
final ComponentMetadata componentMetadata = Objects.requireNonNull(m_blueprintContainer.getComponentMetadata(m_uiBeanId));
if (!(componentMetadata instanceof BeanMetadata)) {
throw new IllegalStateException("The referenced id is not a bean");
}
if (!BeanMetadata.SCOPE_PROTOTYPE.equals(((BeanMetadata) componentMetadata).getScope())) {
throw new IllegalStateException("The scope of the defined bean with id " + m_uiBeanId + " must be " + BeanMetadata.SCOPE_PROTOTYPE + " but is " + BeanMetadata.SCOPE_SINGLETON);
}
}
Aggregations