private void processApplicationReferences ( EARApplicationInfo appInfo , Application app ) throws StateChangeException { Map < JNDIEnvironmentRefType , List < ? extends JNDIEnvironmentRef > > allRefs = new EnumMap < JNDIEnvironmentRefType , List < ? extends JNDIEnvironmentRef > > ( JNDIEnvironmentRefType . class ) ; boolean anyRefs = false ; for ( JNDIEnvironmentRefType refType : JNDIEnvironmentRefType . VALUES ) { List < ? extends JNDIEnvironmentRef > refs = refType . getRefs ( app ) ; allRefs . put ( refType , refs ) ; anyRefs |= ! refs . isEmpty ( ) ; } if ( anyRefs ) { ApplicationBnd appBnd ; try { appBnd = appInfo . getContainer ( ) . adapt ( ApplicationBnd . class ) ; } catch ( UnableToAdaptException e ) { throw new StateChangeException ( e ) ; } String compNSConfigName = appInfo . getName ( ) + " META-INF/application.xml" ; ComponentNameSpaceConfiguration compNSConfig = new ComponentNameSpaceConfiguration ( compNSConfigName , ( ( ExtendedApplicationInfo ) appInfo ) . getMetaData ( ) . getJ2EEName ( ) ) ; compNSConfig . setClassLoader ( appInfo . getApplicationClassLoader ( ) ) ; compNSConfig . setApplicationMetaData ( ( ( ExtendedApplicationInfo ) appInfo ) . getMetaData ( ) ) ; JNDIEnvironmentRefType . setAllRefs ( compNSConfig , allRefs ) ; if ( appBnd != null ) { Map < JNDIEnvironmentRefType , Map < String , String > > allBindings = JNDIEnvironmentRefBindingHelper . createAllBindingsMap ( ) ; Map < String , String > envEntryValues = new HashMap < String , String > ( ) ; ResourceRefConfigList resourceRefConfigList = resourceRefConfigFactory . createResourceRefConfigList ( ) ; OSGiJNDIEnvironmentRefBindingHelper . processBndAndExt ( allBindings , envEntryValues , resourceRefConfigList , appBnd , null ) ; JNDIEnvironmentRefBindingHelper . setAllBndAndExt ( compNSConfig , allBindings , envEntryValues , resourceRefConfigList ) ; } try { processInjectionMetaData ( null , compNSConfig ) ; } catch ( InjectionException e ) { throw new StateChangeException ( e ) ; } } }
Process references declared in application . xml .