private void addGlobalServices ( CatalogBuilder cat ) { // look for datasets that want to use global services Set < String > allServiceNames = new HashSet <> ( ) ; findServices ( cat . getDatasets ( ) , allServiceNames ) ; // all services used if ( ! allServiceNames . isEmpty ( ) ) { List < Service > servicesMissing = new ArrayList <> ( ) ; // all services missing for ( String name : allServiceNames ) { if ( cat . hasServiceInDataset ( name ) ) continue ; Service s = globalServices . findGlobalService ( name ) ; if ( s != null ) servicesMissing . add ( s ) ; } servicesMissing . forEach ( cat :: addService ) ; } // look for datasets that want to use standard services for ( DatasetBuilder node : cat . getDatasets ( ) ) { String sname = ( String ) node . getFldOrInherited ( Dataset . ServiceName ) ; String urlPath = ( String ) node . get ( Dataset . UrlPath ) ; String ftypeS = ( String ) node . getFldOrInherited ( Dataset . FeatureType ) ; if ( sname == null && urlPath != null && ftypeS != null ) { Service s = globalServices . getStandardServices ( ftypeS ) ; if ( s != null ) { node . put ( Dataset . ServiceName , s . getName ( ) ) ; cat . addService ( s ) ; } } } }
rigamorole to modify invariant catalogs ; we may need to add global services