org.osgi.service.blueprint.reflect.BeanMetadata Java Examples
The following examples show how to use
org.osgi.service.blueprint.reflect.BeanMetadata.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlueprintResourceFactory.java From cxf with Apache License 2.0 | 6 votes |
private void init() { Class<?> type = ClassHelper.getRealClassFromClass(blueprintContainer.getComponentInstance(beanId) .getClass()); if (Proxy.isProxyClass(type)) { type = ClassHelper.getRealClass(blueprintContainer.getComponentInstance(beanId)); } c = ResourceUtils.findResourceConstructor(type, !isSingleton()); if (c == null) { throw new RuntimeException("Resource class " + type + " has no valid constructor"); } postConstructMethod = ResourceUtils.findPostConstructMethod(type); preDestroyMethod = ResourceUtils.findPreDestroyMethod(type); Object component = blueprintContainer.getComponentMetadata(beanId); if (component instanceof BeanMetadata) { BeanMetadata local = (BeanMetadata) component; isSingleton = BeanMetadata.SCOPE_SINGLETON.equals(local.getScope()) || (local.getScope() == null && local.getId() != null); } }
Example #2
Source File: HttpDestinationBPBeanDefinitionParser.java From cxf with Apache License 2.0 | 6 votes |
public Metadata parse(Element element, ParserContext context) { MutableBeanMetadata bean = context.createMetadata(MutableBeanMetadata.class); bean.setRuntimeClass(AbstractHTTPDestination.class); mapElementToJaxbProperty(context, bean, element, new QName(HTTP_NS, "server"), "server", HTTPServerPolicy.class); mapElementToJaxbProperty(context, bean, element, new QName(HTTP_NS, "fixedParameterOrder"), "fixedParameterOrder", Boolean.class); mapElementToJaxbProperty(context, bean, element, new QName(HTTP_NS, "contextMatchStrategy"), "contextMatchStrategy", String.class); parseAttributes(element, context, bean); parseChildElements(element, context, bean); bean.setScope(BeanMetadata.SCOPE_PROTOTYPE); return bean; }
Example #3
Source File: BlueprintBeanLocator.java From cxf with Apache License 2.0 | 6 votes |
static Class<?> getClassForMetaData(BlueprintContainer container, ComponentMetadata cmd) { Class<?> cls = null; if (cmd instanceof BeanMetadata) { BeanMetadata bm = (BeanMetadata)cmd; if (bm instanceof ExtendedBeanMetadata) { cls = ((ExtendedBeanMetadata)bm).getRuntimeClass(); } if (cls == null && container instanceof ExtendedBlueprintContainer && bm.getClassName() != null) { try { cls = ((ExtendedBlueprintContainer)container).loadClass(bm.getClassName()); } catch (ClassNotFoundException cnfe) { //ignore } } } return cls; }
Example #4
Source File: ConfigurerImpl.java From cxf with Apache License 2.0 | 6 votes |
public synchronized void configureBean(String bn, Object beanInstance, boolean checkWildcards) { if (null == bn) { bn = getBeanName(beanInstance); } if (null == bn) { return; } if (checkWildcards) { configureWithWildCard(bn, beanInstance); } if (container instanceof ExtendedBlueprintContainer) { ComponentMetadata cm = null; try { cm = container.getComponentMetadata(bn); } catch (NoSuchComponentException nsce) { cm = null; } if (cm instanceof BeanMetadata) { ((ExtendedBlueprintContainer)container).injectBeanInstance((BeanMetadata)cm, beanInstance); } } }
Example #5
Source File: AuthorizationBeanProcessor.java From peer-os with Apache License 2.0 | 5 votes |
@Override public Object beforeInit( Object bean, String beanName, BeanCreator beanCreator, BeanMetadata beanData ) { Class<?> c = bean.getClass(); if ( new SecurityAnnotationParser().isSecured( c ) ) { LOGGER.debug( "Adding annotation based authorization interceptor for bean {} with class {}", beanName, c ); cdr.registerInterceptorWithComponent( beanData, new AuthorizationInterceptor( bean ) ); } return bean; }
Example #6
Source File: AbstractBPBeanDefinitionParser.java From cxf with Apache License 2.0 | 5 votes |
protected boolean parseAttributes(Element element, ParserContext ctx, MutableBeanMetadata bean) { NamedNodeMap atts = element.getAttributes(); boolean setBus = false; 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(); String prefix = node.getPrefix(); // Don't process namespaces if (isNamespace(name, prefix)) { continue; } if ("createdFromAPI".equals(name) || "abstract".equals(name)) { bean.setScope(BeanMetadata.SCOPE_PROTOTYPE); } else { if ("depends-on".equals(name)) { bean.addDependsOn(val); } else if ("name".equals(name)) { processNameAttribute(element, ctx, bean, val); } else if ("bus".equals(name)) { processBusAttribute(element, ctx, bean, val); } else if (!"id".equals(name) && isAttribute(pre, name)) { mapAttribute(bean, element, name, val, ctx); } } } return setBus; // 'setBus' is always false }
Example #7
Source File: BlueprintBeanLocator.java From cxf with Apache License 2.0 | 5 votes |
public boolean hasConfiguredPropertyValue(String beanName, String propertyName, String value) { ComponentMetadata cmd = getComponentMetadata(beanName); if (cmd instanceof BeanMetadata) { BeanMetadata br = (BeanMetadata)cmd; for (BeanProperty s : br.getProperties()) { if (propertyName.equals(s.getName())) { return true; } } return false; } return orig.hasConfiguredPropertyValue(beanName, propertyName, value); }
Example #8
Source File: BlueprintBeanLocator.java From cxf with Apache License 2.0 | 5 votes |
public boolean hasBeanOfName(String name) { ComponentMetadata cmd = getComponentMetadata(name); if (cmd instanceof BeanMetadata) { return true; } return orig.hasBeanOfName(name); }
Example #9
Source File: AuthorizationBeanProcessor.java From peer-os with Apache License 2.0 | 4 votes |
@Override public Object afterInit( Object bean, String beanName, BeanCreator beanCreator, BeanMetadata beanData ) { return bean; }
Example #10
Source File: HttpConduitBPBeanDefinitionParser.java From cxf with Apache License 2.0 | 3 votes |
public Metadata parse(Element element, ParserContext context) { MutableBeanMetadata bean = context.createMetadata(MutableBeanMetadata.class); bean.setRuntimeClass(HTTPConduit.class); parseAttributes(element, context, bean); parseChildElements(element, context, bean); bean.setScope(BeanMetadata.SCOPE_PROTOTYPE); return bean; }