public static ServiceReference < Application > getApplicationServiceRef ( BundleContext bundleContext , String applicationName ) { ServiceReference < Application > appRef = null ; if ( FrameworkState . isValid ( ) ) { Collection < ServiceReference < Application >> appRefs ; try { appRefs = bundleContext . getServiceReferences ( Application . class , FilterUtils . createPropertyFilter ( "name" , applicationName ) ) ; } catch ( InvalidSyntaxException e ) { throw new ConfigException ( e ) ; } if ( appRefs != null && appRefs . size ( ) > 0 ) { if ( appRefs . size ( ) > 1 ) { throw new ConfigException ( Tr . formatMessage ( tc , "duplicate.application.name.CWMCG0202E" , applicationName ) ) ; } appRef = appRefs . iterator ( ) . next ( ) ; } } return appRef ; }
Get the Application ServiceReferences which has the given name or null if not found