private Object getBeanClass(BeanMetadata beanMetadata) { if (beanMetadata instanceof ExtendedBeanMetadata) { ExtendedBeanMetadata extBeanMetadata = (ExtendedBeanMetadata) beanMetadata; if (extBeanMetadata.getRuntimeClass() != null) { return extBeanMetadata.getRuntimeClass(); } } return beanMetadata.getClassName(); }
private boolean allowFieldInjection(BeanMetadata beanMetadata) { if (beanMetadata instanceof ExtendedBeanMetadata) { return ((ExtendedBeanMetadata) beanMetadata).getFieldInjection(); } return false; }
private boolean allowNonStandardSetters(BeanMetadata beanMetadata) { if (beanMetadata instanceof ExtendedBeanMetadata) { return ((ExtendedBeanMetadata) beanMetadata).getNonStandardSetters(); } return false; }
public BeanMetadataImpl(BeanMetadata source) { super(source); this.className = source.getClassName(); this.initMethod = source.getInitMethod(); this.destroyMethod = source.getDestroyMethod(); for (BeanArgument argument : source.getArguments()) { addArgument(new BeanArgumentImpl(argument)); } for (BeanProperty property : source.getProperties()) { addProperty(new BeanPropertyImpl(property)); } this.initialization = source.getActivation(); this.factoryMethod = source.getFactoryMethod(); this.factoryComponent = MetadataUtil.cloneTarget(source.getFactoryComponent()); this.scope = source.getScope() != null ? QName.valueOf(source.getScope()) : null; this.dependsOn = new ArrayList<String>(source.getDependsOn()); if (source instanceof ExtendedBeanMetadata) { this.runtimeClass = ((ExtendedBeanMetadata) source).getRuntimeClass(); this.fieldInjection = ((ExtendedBeanMetadata) source).getFieldInjection(); this.rawConversion = ((ExtendedBeanMetadata) source).getRawConversion(); this.nonStandardSetters = ((ExtendedBeanMetadata) source).getNonStandardSetters(); } else { this.fieldInjection = false; this.rawConversion = false; this.nonStandardSetters = false; } }
protected void processProcessors() throws Exception { if (bean instanceof ExtendedBeanMetadata && !((ExtendedBeanMetadata) bean).isProcessor()) { continue; clazz = ((ExtendedBeanMetadata) bean).getRuntimeClass();
private boolean allowRawConversion(BeanMetadata beanMetadata) { if (beanMetadata instanceof ExtendedBeanMetadata) { return ((ExtendedBeanMetadata) beanMetadata).getRawConversion(); } return false; }
public BeanMetadataImpl(BeanMetadata source) { super(source); this.className = source.getClassName(); this.initMethod = source.getInitMethod(); this.destroyMethod = source.getDestroyMethod(); for (BeanArgument argument : source.getArguments()) { addArgument(new BeanArgumentImpl(argument)); } for (BeanProperty property : source.getProperties()) { addProperty(new BeanPropertyImpl(property)); } this.initialization = source.getActivation(); this.factoryMethod = source.getFactoryMethod(); this.factoryComponent = MetadataUtil.cloneTarget(source.getFactoryComponent()); this.scope = source.getScope() != null ? QName.valueOf(source.getScope()) : null; this.dependsOn = new ArrayList<String>(source.getDependsOn()); if (source instanceof ExtendedBeanMetadata) { this.runtimeClass = ((ExtendedBeanMetadata) source).getRuntimeClass(); this.fieldInjection = ((ExtendedBeanMetadata) source).getFieldInjection(); this.rawConversion = ((ExtendedBeanMetadata) source).getRawConversion(); this.nonStandardSetters = ((ExtendedBeanMetadata) source).getNonStandardSetters(); } else { this.fieldInjection = false; this.rawConversion = false; this.nonStandardSetters = false; } }
protected void processProcessors() throws Exception { if (bean instanceof ExtendedBeanMetadata && !((ExtendedBeanMetadata) bean).isProcessor()) { continue; clazz = ((ExtendedBeanMetadata) bean).getRuntimeClass();
private boolean allowRawConversion(BeanMetadata beanMetadata) { if (beanMetadata instanceof ExtendedBeanMetadata) { return ((ExtendedBeanMetadata) beanMetadata).getRawConversion(); } return false; }
private Object getBeanClass(BeanMetadata beanMetadata) { if (beanMetadata instanceof ExtendedBeanMetadata) { ExtendedBeanMetadata extBeanMetadata = (ExtendedBeanMetadata) beanMetadata; if (extBeanMetadata.getRuntimeClass() != null) { return extBeanMetadata.getRuntimeClass(); } } return beanMetadata.getClassName(); }
private boolean allowFieldInjection(BeanMetadata beanMetadata) { if (beanMetadata instanceof ExtendedBeanMetadata) { return ((ExtendedBeanMetadata) beanMetadata).getFieldInjection(); } return false; }
private boolean allowNonStandardSetters(BeanMetadata beanMetadata) { if (beanMetadata instanceof ExtendedBeanMetadata) { return ((ExtendedBeanMetadata) beanMetadata).getNonStandardSetters(); } return false; }
/** * Lookup the ids of the Blueprint property placeholder services in the * Blueprint container. * * @return the ids, will be an empty array if none found. */ public String[] lookupPropertyPlaceholderIds() { List<String> ids = new ArrayList<>(); for (Object componentId : container.getComponentIds()) { String id = (String) componentId; ComponentMetadata meta = container.getComponentMetadata(id); if (meta instanceof ExtendedBeanMetadata) { Class<?> clazz = ((ExtendedBeanMetadata) meta).getRuntimeClass(); if (clazz != null && (AbstractPropertyPlaceholder.class.isAssignableFrom(clazz) || newPlaceholderClass(clazz) != null)) { ids.add(id); } } } return ids.toArray(new String[ids.size()]); }
/** * Lookup all the {@link BlueprintCamelContext} in the {@link BlueprintContainer}. * * @param container the blueprint container, must be provided * @return a set with the ids of the {@link BlueprintCamelContext}, never <tt>null</tt>, but can be empty set. */ public static Set<String> lookupBlueprintCamelContext(BlueprintContainer container) { Set<String> ids = new LinkedHashSet<>(); for (Object id : container.getComponentIds()) { ComponentMetadata meta = container.getComponentMetadata(id.toString()); // must be extended meta, to see if its the blueprint camel context if (meta instanceof ExtendedBeanMetadata) { Class<?> clazz = ((ExtendedBeanMetadata) meta).getRuntimeClass(); if (clazz != null && BlueprintCamelContext.class.isAssignableFrom(clazz)) { // okay we found a BlueprintCamelContext ids.add(meta.getId()); } } } return ids; } }
public static void validatePlaceholder(MutableBeanMetadata metadata, ComponentDefinitionRegistry registry) { String prefix = getPlaceholderProperty(metadata, "placeholderPrefix"); String suffix = getPlaceholderProperty(metadata, "placeholderSuffix"); for (String id : registry.getComponentDefinitionNames()) { ComponentMetadata component = registry.getComponentDefinition(id); if (component instanceof ExtendedBeanMetadata) { ExtendedBeanMetadata bean = (ExtendedBeanMetadata) component; if (bean.getRuntimeClass() != null && AbstractPropertyPlaceholderExt.class.isAssignableFrom(bean.getRuntimeClass())) { String otherPrefix = getPlaceholderProperty(bean, "placeholderPrefix"); String otherSuffix = getPlaceholderProperty(bean, "placeholderSuffix"); if (prefix.equals(otherPrefix) && suffix.equals(otherSuffix)) { throw new ComponentDefinitionException("Multiple placeholders with the same prefix and suffix are not allowed"); } } } } }
public static void validatePlaceholder(MutableBeanMetadata metadata, ComponentDefinitionRegistry registry) { String prefix = getPlaceholderProperty(metadata, "placeholderPrefix"); String suffix = getPlaceholderProperty(metadata, "placeholderSuffix"); for (String id : registry.getComponentDefinitionNames()) { ComponentMetadata component = registry.getComponentDefinition(id); if (component instanceof ExtendedBeanMetadata) { ExtendedBeanMetadata bean = (ExtendedBeanMetadata) component; if (bean.getRuntimeClass() != null && AbstractPropertyPlaceholderExt.class.isAssignableFrom(bean.getRuntimeClass())) { String otherPrefix = getPlaceholderProperty(bean, "placeholderPrefix"); String otherSuffix = getPlaceholderProperty(bean, "placeholderSuffix"); if (prefix.equals(otherPrefix) && suffix.equals(otherSuffix)) { throw new ComponentDefinitionException("Multiple placeholders with the same prefix and suffix are not allowed"); } } } } }
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 && bm.getClassName() != null) { try { Method m = ReflectionUtil.findMethod(container.getClass(), "loadClass", String.class); cls = (Class<?>)ReflectionUtil.setAccessible(m).invoke(container, bm.getClassName()); } catch (Exception e) { //ignore } } } return cls; } private Class<?> getClassForMetaData(ComponentMetadata cmd) {
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 && bm.getClassName() != null) { try { Method m = ReflectionUtil.findMethod(container.getClass(), "loadClass", String.class); cls = (Class<?>)ReflectionUtil.setAccessible(m).invoke(container, bm.getClassName()); } catch (Exception e) { //ignore } } } return cls; } private Class<?> getClassForMetaData(ComponentMetadata cmd) {
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; } private Class<?> getClassForMetaData(ComponentMetadata cmd) {
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; } private Class<?> getClassForMetaData(ComponentMetadata cmd) {