private String evaluateConfigElement ( ConfigElement childElement , final ExtendedAttributeDefinition parentAttribute , EvaluationContext context , int index ) throws ConfigEvaluatorException { RegistryEntry childRegistryEntry = null ; if ( parentAttribute != null && parentAttribute . getType ( ) == MetaTypeFactory . PID_TYPE ) { final String elementName = childElement . getNodeName ( ) ; RegistryEntry specifiedChildRegistryEntry = metatypeRegistry . getRegistryEntry ( parentAttribute . getReferencePid ( ) ) ; if ( specifiedChildRegistryEntry == null ) { //if the pid shows up an another update, we will reprocess it then return null ; } childRegistryEntry = specifiedChildRegistryEntry . traverseHierarchy ( new EntryAction < RegistryEntry > ( ) { private RegistryEntry result ; @ Override public boolean entry ( RegistryEntry registryEntry ) { //TODO pid? really? //TODO the flat case does not assume that the attribute id is the actual prefix, due to possible renaming. if ( elementName . equals ( registryEntry . getPid ( ) ) || elementName . equals ( registryEntry . getEffectiveAD ( parentAttribute . getID ( ) ) ) ) { result = registryEntry ; return false ; } return true ; } @ Override public RegistryEntry getResult ( ) { return result ; } } ) ; if ( childRegistryEntry == null ) { childRegistryEntry = specifiedChildRegistryEntry ; } } else { childRegistryEntry = getRegistryEntryForChildFirstConfig ( context . getEvaluationResult ( ) . getRegistryEntry ( ) , childElement . getNodeName ( ) ) ; } String factoryPid = childElement . getNodeName ( ) ; if ( childRegistryEntry != null ) { factoryPid = childRegistryEntry . getPid ( ) ; } ConfigElement nestedElement = childElement ; if ( childElement instanceof SimpleElement ) { SimpleElement original = ( SimpleElement ) childElement ; if ( childRegistryEntry != null ) { if ( childRegistryEntry . isSingleton ( ) ) { nestedElement = new SingletonElement ( original , factoryPid ) ; } else { nestedElement = new FactoryElement ( original , index , childRegistryEntry ) ; } nestedElement . setIdAttribute ( ) ; } else { original . setDefaultId ( index ) ; nestedElement = original ; } nestedElement . setParent ( context . getConfigElement ( ) ) ; } ConfigID configId = nestedElement . getConfigID ( ) ; String pid = null ; try { pid = getPid ( configId ) ; } catch ( ConfigNotFoundException ex ) { throw new ConfigEvaluatorException ( "Could not obtain configuration for nested info" , ex ) ; } NestedInfo nestedInfo = new NestedInfo ( ) ; nestedInfo . configElement = nestedElement ; nestedInfo . pid = pid ; nestedInfo . registryEntry = childRegistryEntry ; if ( ! context . addNestedInfo ( nestedInfo ) || isHiddenExtension ( parentAttribute , context ) ) { // context already knows about this element or current (parent) metatype excludes unknown elements return null ; } context . getEvaluationResult ( ) . addReference ( configId ) ; return pid ; }
Creates a NestedInfo object containing the service pid config element and registry entry for a nested config element . If this service pid has not been seen yet in this context the pid value will be returned . Otherwise the method returns null .