private final Dictionary < String , Object > getConfigForEmbeddedResourceAdapter ( ) throws UnableToAdaptException { BundleContext bundleContext = Utils . priv . getBundleContext ( FrameworkUtil . getBundle ( getClass ( ) ) ) ; ServiceReference < ConfigurationAdmin > configAdminRef = Utils . priv . getServiceReference ( bundleContext , ConfigurationAdmin . class ) ; ConfigurationAdmin configAdmin = Utils . priv . getService ( bundleContext , configAdminRef ) ; try { // go through all child resourceAdapter configurations until we find the right one, if any String parentPid = ( String ) config . get ( SOURCE_PID ) ; // TODO remove once the supertype of application is gone if ( parentPid == null ) parentPid = ( String ) config . get ( Constants . SERVICE_PID ) ; String filter = "(&(" + ConfigurationAdmin . SERVICE_FACTORYPID + "=com.ibm.ws.jca.embeddedResourceAdapter)(config.parentPID=" + parentPid + "))" ; Configuration [ ] configurations = configAdmin . listConfigurations ( filter ) ; if ( configurations != null ) for ( Configuration config : configAdmin . listConfigurations ( filter ) ) { Dictionary < String , Object > props = config . getProperties ( ) ; String id = ( String ) props . get ( "id" ) ; if ( moduleName . equals ( id ) ) return props ; } return null ; } catch ( Exception x ) { throw new UnableToAdaptException ( x ) ; } finally { bundleContext . ungetService ( configAdminRef ) ; } }
Returns configured properties for an embedded resource adapter if any by matching the id .