@ FFDCIgnore ( PrivilegedActionException . class ) private String getConfigNameForRef ( final String ref ) { String name = null ; if ( ref != null ) { final ConfigurationAdmin configAdmin = configAdminRef . getService ( ) ; Configuration config ; try { config = AccessController . doPrivileged ( new PrivilegedExceptionAction < Configuration > ( ) { @ Override public Configuration run ( ) throws IOException { return configAdmin . getConfiguration ( ref , configAdminRef . getReference ( ) . getBundle ( ) . getLocation ( ) ) ; } } ) ; } catch ( PrivilegedActionException paex ) { return null ; } Dictionary < String , Object > props = config . getProperties ( ) ; name = ( String ) props . get ( KEY_NAME ) ; } return name ; }
Use the config admin service to get the name for a given service reference