private AppMessageHelper getAppMessageHelper ( String type , String fileName ) { if ( type == null && fileName != null ) { String [ ] parts = fileName . split ( "[\\\\/]" ) ; if ( parts . length > 0 ) { String last = parts [ parts . length - 1 ] ; int dot = last . indexOf ( ' ' ) ; type = dot >= 0 ? last . substring ( dot + 1 ) : parts . length > 1 ? parts [ parts . length - 2 ] : null ; } } if ( type != null ) try { String filter = FilterUtils . createPropertyFilter ( AppManagerConstants . TYPE , type . toLowerCase ( ) ) ; @ SuppressWarnings ( "rawtypes" ) Collection < ServiceReference < ApplicationHandler > > refs = _ctx . getServiceReferences ( ApplicationHandler . class , filter ) ; if ( refs . size ( ) > 0 ) { @ SuppressWarnings ( "rawtypes" ) ServiceReference < ApplicationHandler > ref = refs . iterator ( ) . next ( ) ; ApplicationHandler < ? > appHandler = _ctx . getService ( ref ) ; try { return AppMessageHelper . get ( appHandler ) ; } finally { _ctx . ungetService ( ref ) ; } } } catch ( InvalidSyntaxException x ) { } return AppMessageHelper . get ( null ) ; }
Returns the message helper for the specified application handler type .