protected String notifyLayerListeners ( ILayerListener . EventType type , HttpServletRequest request , IModule module ) throws IOException { StringBuffer sb = new StringBuffer ( ) ; // notify any listeners that the config has been updated List < IServiceReference > refs = null ; if ( aggr . getPlatformServices ( ) != null ) { try { IServiceReference [ ] ary = aggr . getPlatformServices ( ) . getServiceReferences ( ILayerListener . class . getName ( ) , "(name=" + aggr . getName ( ) + ")" ) ; //$NON-NLS-1$ //$NON-NLS-2$ if ( ary != null ) refs = Arrays . asList ( ary ) ; } catch ( PlatformServicesException e ) { if ( log . isLoggable ( Level . SEVERE ) ) { log . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } if ( refs != null ) { if ( type == EventType . END_LAYER ) { // for END_LAYER, invoke the listeners in reverse order refs = new ArrayList < IServiceReference > ( refs ) ; Collections . reverse ( refs ) ; } for ( IServiceReference ref : refs ) { ILayerListener listener = ( ILayerListener ) aggr . getPlatformServices ( ) . getService ( ref ) ; try { Set < String > depFeatures = new HashSet < String > ( ) ; String str = listener . layerBeginEndNotifier ( type , request , type == ILayerListener . EventType . BEGIN_MODULE ? Arrays . asList ( new IModule [ ] { module } ) : umLayerListenerModuleList , depFeatures ) ; dependentFeatures . addAll ( depFeatures ) ; if ( str != null ) { sb . append ( str ) ; } } finally { aggr . getPlatformServices ( ) . ungetService ( ref ) ; } } } } return sb . toString ( ) ; }
Calls the registered layer listeners .