private static List<InvService> copyServicesIntoCopiedCatalog( InvCatalog catalog, InvCatalogImpl resultCatalog ) { List<InvService> services = catalog.getServices(); for ( InvService service : services ) { resultCatalog.addService( DeepCopyUtils.copyService( service ) ); } List<InvService> copiedServices = resultCatalog.getServices(); return copiedServices; }
private static List<InvService> copyServicesIntoCopiedCatalog( InvCatalog catalog, InvCatalogImpl resultCatalog ) { List<InvService> services = catalog.getServices(); for ( InvService service : services ) { resultCatalog.addService( DeepCopyUtils.copyService( service ) ); } return resultCatalog.getServices(); }
private static List<InvService> copyServicesIntoCopiedCatalog( InvCatalog catalog, InvCatalogImpl resultCatalog ) { List<InvService> services = catalog.getServices(); for ( InvService service : services ) { resultCatalog.addService( DeepCopyUtils.copyService( service ) ); } return resultCatalog.getServices(); }
/** * Make the containing catalog of this feature collection * "http://server:port/thredds/catalog/path/catalog.xml" * * @param catURI base URI of the request * @param localState current state to use * @return the top FMRC catalog * @throws java.io.IOException on I/O error * @throws java.net.URISyntaxException if path is misformed */ protected InvCatalogImpl makeCatalogTop(URI catURI, State localState) throws IOException, URISyntaxException { InvCatalogImpl parentCatalog = (InvCatalogImpl) getParentCatalog(); InvCatalogImpl mainCatalog = new InvCatalogImpl(getName(), parentCatalog.getVersion(), catURI); mainCatalog.addDataset(localState.top); mainCatalog.addService(InvService.latest); // in case its needed mainCatalog.addService(virtualService); // top.getLocalMetadataInheritable().setServiceName(virtualService.getName()); //?? mainCatalog.finish(); return mainCatalog; }
if ((match == null) || (match.length() == 0)) { InvCatalogImpl main = makeCatalogTop(catURI, localState); main.addService(virtualService); main.getDataset().getLocalMetadataInheritable().setServiceName(virtualService.getName()); main.finish();
@Override public InvCatalogImpl makeCatalog(String match, String orgPath, URI catURI) { logger.debug("FMRC make catalog for " + match + " " + catURI); State localState = checkState(); try { if ((match == null) || (match.length() == 0)) { InvCatalogImpl main = makeCatalogTop(catURI, localState); main.addService(virtualService); main.getDataset().getLocalMetadataInheritable().setServiceName(virtualService.getName()); main.finish(); return main; } else if (match.equals(RUNS) && wantDatasets.contains(FeatureCollectionConfig.FmrcDatasetType.Runs)) return makeCatalogRuns(catURI, localState); else if (match.equals(OFFSET) && wantDatasets.contains(FeatureCollectionConfig.FmrcDatasetType.ConstantOffsets)) return makeCatalogOffsets(catURI, localState); else if (match.equals(FORECAST) && wantDatasets.contains(FeatureCollectionConfig.FmrcDatasetType.ConstantForecasts)) return makeCatalogForecasts(catURI, localState); else if (match.startsWith(FILES) && wantDatasets.contains(FeatureCollectionConfig.FmrcDatasetType.Files)) { return makeCatalogFiles(catURI, localState, datasetCollection.getFilenames(), true); } } catch (Exception e) { logger.error("Error making catalog for " + path, e); } return null; }
@Override public InvCatalogImpl makeCatalog(String match, String orgPath, URI catURI) { logger.debug("FcPoint make catalog for " + match + " " + catURI); State localState = null; try { localState = checkState(); } catch (IOException e) { logger.error("Error in checkState", e); return null; } try { if ((match == null) || (match.length() == 0)) { InvCatalogImpl main = makeCatalogTop(catURI, localState); main.addService(collectionService); main.getDataset().getLocalMetadataInheritable().setServiceName(collectionService.getName()); main.finish(); return main; } else if (match.startsWith(FILES) && wantDatasets.contains(FeatureCollectionConfig.PointDatasetType.Files)) { return makeCatalogFiles(catURI, localState, dcm.getFilenames(), true); } } catch (Exception e) { logger.error("Error making catalog for " + path, e); } return null; }
@Override public InvCatalogImpl makeCatalog(String match, String orgPath, URI catURI) { logger.debug("FcPoint make catalog for " + match + " " + catURI); State localState = checkState(); try { if ((match == null) || (match.length() == 0)) { InvCatalogImpl main = makeCatalogTop(catURI, localState); main.addService(collectionService); main.getDataset().getLocalMetadataInheritable().setServiceName(collectionService.getName()); main.finish(); return main; } else if (match.startsWith(FILES) && wantDatasets.contains(FeatureCollectionConfig.PointDatasetType.Files)) { return makeCatalogFiles(catURI, localState, datasetCollection.getFilenames(), true); } } catch (Exception e) { logger.error("Error making catalog for " + path, e); } return null; }
private void addTopLevelMetadata( InvCatalog catalog, boolean isRegularCatalog ) { if ( this.topLevelMetadataContainer == null ) return; if ( ! catalogLevel.getPath().equals( currentLevel.getPath() ) ) return; // Transfer all metadata from given metadata container to the top // InvDataset. This propagates any public metadata from the given // metadata container to all generated catalogs. InvDatasetImpl topInvDs = (InvDatasetImpl) catalog.getDataset(); topInvDs.transferMetadata( this.topLevelMetadataContainer, true ); // LOOK experimental datasetScan may have its own access elements for ( Iterator it = this.topLevelMetadataContainer.getAccess().iterator(); it.hasNext(); ) { InvAccess invAccess = (InvAccess) it.next(); topInvDs.addAccess( invAccess ); InvService s = invAccess.getService(); ( (InvCatalogImpl) catalog ).addService( s ); } // If this is a collection level scan, set some special attributes // that transferMetadata() doesn't transfer. boolean isCollectionLevel = catalogLevel.getPath().equals( collectionLevel.getPath() ); if ( isCollectionLevel && isRegularCatalog ) { topInvDs.setHarvest( this.topLevelMetadataContainer.isHarvest() ); topInvDs.setCollectionType( this.topLevelMetadataContainer.getCollectionType() ); } // Finish catalog. ( (InvCatalogImpl) catalog ).finish(); }
private void addTopLevelMetadata( InvCatalog catalog, boolean isRegularCatalog ) { if ( this.topLevelMetadataContainer == null ) return; if ( ! catalogLevel.getPath().equals( currentLevel.getPath() ) ) return; // Transfer all metadata from given metadata container to the top // InvDataset. This propagates any public metadata from the given // metadata container to all generated catalogs. InvDatasetImpl topInvDs = (InvDatasetImpl) catalog.getDataset(); topInvDs.transferMetadata( this.topLevelMetadataContainer, true ); // LOOK experimental datasetScan may have its own access elements for ( Iterator it = this.topLevelMetadataContainer.getAccess().iterator(); it.hasNext(); ) { InvAccess invAccess = (InvAccess) it.next(); topInvDs.addAccess( invAccess ); InvService s = invAccess.getService(); ( (InvCatalogImpl) catalog ).addService( s ); } // If this is a collection level scan, set some special attributes // that transferMetadata() doesn't transfer. boolean isCollectionLevel = catalogLevel.getPath().equals( collectionLevel.getPath() ); if ( isCollectionLevel && isRegularCatalog ) { topInvDs.setHarvest( this.topLevelMetadataContainer.isHarvest() ); topInvDs.setCollectionType( this.topLevelMetadataContainer.getCollectionType() ); } // Finish catalog. ( (InvCatalogImpl) catalog ).finish(); }
private void addTopLevelMetadata( InvCatalog catalog, boolean isRegularCatalog ) { if ( this.topLevelMetadataContainer == null ) return; if ( ! catalogLevel.getPath().equals( currentLevel.getPath() ) ) return; // Transfer all metadata from given metadata container to the top // InvDataset. This propagates any public metadata from the given // metadata container to all generated catalogs. InvDatasetImpl topInvDs = (InvDatasetImpl) catalog.getDataset(); topInvDs.transferMetadata( this.topLevelMetadataContainer, true ); // LOOK experimental datasetScan may have its own access elements for ( Iterator it = this.topLevelMetadataContainer.getAccess().iterator(); it.hasNext(); ) { InvAccess invAccess = (InvAccess) it.next(); topInvDs.addAccess( invAccess ); InvService s = invAccess.getService(); ( (InvCatalogImpl) catalog ).addService( s ); } // If this is a collection level scan, set some special attributes // that transferMetadata() doesn't transfer. boolean isCollectionLevel = catalogLevel.getPath().equals( collectionLevel.getPath() ); if ( isCollectionLevel && isRegularCatalog ) { topInvDs.setHarvest( this.topLevelMetadataContainer.isHarvest() ); topInvDs.setCollectionType( this.topLevelMetadataContainer.getCollectionType() ); } // Finish catalog. ( (InvCatalogImpl) catalog ).finish(); }
private InvCatalogImpl makeCatalogRuns(URI baseURI) throws IOException { if ((catalogRuns == null) || checkIfChanged()) { InvCatalogImpl parent = (InvCatalogImpl) getParentCatalog(); URI myURI = baseURI.resolve( getCatalogHref(RUNS)); InvCatalogImpl runCatalog = new InvCatalogImpl( getFullName(), parent.getVersion(), myURI); InvDatasetImpl top = new InvDatasetImpl(this); top.setParent(null); top.transferMetadata( (InvDatasetImpl) this.getParent(), true ); // make all inherited metadata local top.setName(TITLE_RUNS); runCatalog.addDataset(top); // any referenced services need to be local List<InvService> services = new ArrayList<InvService>( getServicesLocal()); InvService service = getServiceDefault(); if ((service != null) && !services.contains(service)) runCatalog.addService(service); for (InvDatasetImpl ds : makeRunDatasets()) { top.addDataset(ds); } runCatalog.finish(); this.catalogRuns = runCatalog; } return catalogRuns; }
private InvCatalogImpl makeCatalogForecasts(URI baseURI) throws IOException { if ((catalogForecasts == null) || checkIfChanged()){ InvCatalogImpl parent = (InvCatalogImpl) getParentCatalog(); URI myURI = baseURI.resolve( getCatalogHref(FORECAST)); InvCatalogImpl foreCatalog = new InvCatalogImpl( getFullName(), parent.getVersion(), myURI); InvDatasetImpl top = new InvDatasetImpl(this); top.setParent(null); top.transferMetadata( (InvDatasetImpl) this.getParent(), true ); // make all inherited metadata local top.setName(TITLE_FORECAST); foreCatalog.addDataset(top); // any referenced services need to be local List<InvService> services = getServicesLocal(); InvService service = getServiceDefault(); if ((service != null) && !services.contains(service)) foreCatalog.addService(service); for (InvDatasetImpl ds : makeForecastDatasets()) { top.addDataset(ds); } foreCatalog.finish(); this.catalogForecasts = foreCatalog; } return catalogForecasts; }
private InvCatalogImpl makeCatalogOffsets(URI baseURI) throws IOException { if ((catalogOffsets == null) || checkIfChanged()) { InvCatalogImpl parent = (InvCatalogImpl) getParentCatalog(); URI myURI = baseURI.resolve( getCatalogHref(OFFSET)); InvCatalogImpl offCatalog = new InvCatalogImpl( getFullName(), parent.getVersion(), myURI); InvDatasetImpl top = new InvDatasetImpl(this); top.setParent(null); top.transferMetadata( (InvDatasetImpl) this.getParent(), true ); // make all inherited metadata local top.setName(TITLE_OFFSET); offCatalog.addDataset(top); // any referenced services need to be local List<InvService> services = getServicesLocal(); InvService service = getServiceDefault(); if ((service != null) && !services.contains(service)) offCatalog.addService(service); for (InvDatasetImpl ds : makeOffsetDatasets()) { top.addDataset(ds); } offCatalog.finish(); this.catalogOffsets = offCatalog; } return catalogOffsets; }
private InvCatalogImpl makeCatalogForecasts(URI catURI, State localState) throws IOException { InvCatalogImpl parent = (InvCatalogImpl) getParentCatalog(); //URI myURI = baseURI.resolve(getCatalogHref(FORECAST)); InvCatalogImpl foreCatalog = new InvCatalogImpl(getFullName(), parent.getVersion(), catURI); InvDatasetImpl top = new InvDatasetImpl(this); top.setParent(null); top.transferMetadata((InvDatasetImpl) this.getParent(), true); // make all inherited metadata local top.setName(FORECAST_TITLE); // add Variables, GeospatialCoverage, TimeCoverage ThreddsMetadata tmi = top.getLocalMetadataInheritable(); if (localState.vars != null) tmi.addVariables(localState.vars); if (localState.coverage != null) tmi.setGeospatialCoverage(localState.coverage); if (localState.dateRange != null) tmi.setTimeCoverage(localState.dateRange); foreCatalog.addDataset(top); // services need to be local foreCatalog.addService(virtualService); foreCatalog.addService(cdmrService); top.getLocalMetadataInheritable().setServiceName(virtualService.getName()); for (InvDatasetImpl ds : makeForecastDatasets()) top.addDataset(ds); foreCatalog.finish(); return foreCatalog; }
private InvCatalogImpl makeCatalogForecasts(URI catURI, State localState) throws IOException { InvCatalogImpl parent = (InvCatalogImpl) getParentCatalog(); //URI myURI = baseURI.resolve(getCatalogHref(FORECAST)); InvCatalogImpl foreCatalog = new InvCatalogImpl(getFullName(), parent.getVersion(), catURI); InvDatasetImpl top = new InvDatasetImpl(this); top.setParent(null); top.transferMetadata((InvDatasetImpl) this.getParent(), true); // make all inherited metadata local top.setName(FORECAST_TITLE); // add Variables, GeospatialCoverage, TimeCoverage ThreddsMetadata tmi = top.getLocalMetadataInheritable(); if (localState.vars != null) tmi.addVariables(localState.vars); if (localState.coverage != null) tmi.setGeospatialCoverage(localState.coverage); if (localState.dateRange != null) tmi.setTimeCoverage(localState.dateRange); foreCatalog.addDataset(top); // services need to be local foreCatalog.addService(virtualService); foreCatalog.addService(cdmrService); top.getLocalMetadataInheritable().setServiceName(virtualService.getName()); for (InvDatasetImpl ds : makeForecastDatasets()) top.addDataset(ds); foreCatalog.finish(); return foreCatalog; }
private InvCatalogImpl makeCatalogRuns(URI catURI, State localState) throws IOException { InvCatalogImpl parent = (InvCatalogImpl) getParentCatalog(); //URI myURI = baseURI.resolve(getCatalogHref(RUNS)); InvCatalogImpl runCatalog = new InvCatalogImpl(getFullName(), parent.getVersion(), catURI); InvDatasetImpl top = new InvDatasetImpl(this); top.setParent(null); top.transferMetadata((InvDatasetImpl) this.getParent(), true); // make all inherited metadata local top.setName(RUN_TITLE); // add Variables, GeospatialCoverage, TimeCoverage ThreddsMetadata tmi = top.getLocalMetadataInheritable(); if (localState.vars != null) tmi.addVariables(localState.vars); if (localState.coverage != null) tmi.setGeospatialCoverage(localState.coverage); //if (localState.dateRange != null) tmi.setTimeCoverage(localState.dateRange); runCatalog.addDataset(top); // services need to be local runCatalog.addService(virtualService); top.getLocalMetadataInheritable().setServiceName(virtualService.getName()); for (InvDatasetImpl ds : makeRunDatasets()) top.addDataset(ds); runCatalog.finish(); return runCatalog; }
private InvCatalogImpl makeCatalogRuns(URI catURI, State localState) throws IOException { InvCatalogImpl parent = (InvCatalogImpl) getParentCatalog(); //URI myURI = baseURI.resolve(getCatalogHref(RUNS)); InvCatalogImpl runCatalog = new InvCatalogImpl(getFullName(), parent.getVersion(), catURI); InvDatasetImpl top = new InvDatasetImpl(this); top.setParent(null); top.transferMetadata((InvDatasetImpl) this.getParent(), true); // make all inherited metadata local top.setName(RUN_TITLE); // add Variables, GeospatialCoverage, TimeCoverage ThreddsMetadata tmi = top.getLocalMetadataInheritable(); if (localState.vars != null) tmi.addVariables(localState.vars); if (localState.coverage != null) tmi.setGeospatialCoverage(localState.coverage); //if (localState.dateRange != null) tmi.setTimeCoverage(localState.dateRange); runCatalog.addDataset(top); // services need to be local runCatalog.addService(virtualService); top.getLocalMetadataInheritable().setServiceName(virtualService.getName()); for (InvDatasetImpl ds : makeRunDatasets()) top.addDataset(ds); runCatalog.finish(); return runCatalog; }
private InvCatalogImpl makeCatalogOffsets(URI catURI, State localState) throws IOException { InvCatalogImpl parent = (InvCatalogImpl) getParentCatalog(); //URI myURI = baseURI.resolve(getCatalogHref(OFFSET)); InvCatalogImpl offCatalog; offCatalog = new InvCatalogImpl(getFullName(), parent.getVersion(), catURI); InvDatasetImpl top = new InvDatasetImpl(this); top.setParent(null); top.transferMetadata((InvDatasetImpl) this.getParent(), true); // make all inherited metadata local // add Variables, GeospatialCoverage, TimeCoverage ThreddsMetadata tmi = top.getLocalMetadataInheritable(); if (localState.vars != null) tmi.addVariables(localState.vars); if (localState.coverage != null) tmi.setGeospatialCoverage(localState.coverage); if (localState.dateRange != null) tmi.setTimeCoverage(localState.dateRange); top.setName(OFFSET_TITLE); offCatalog.addDataset(top); // services need to be local offCatalog.addService(virtualService); top.getLocalMetadataInheritable().setServiceName(virtualService.getName()); for (InvDatasetImpl ds : makeOffsetDatasets()) top.addDataset(ds); offCatalog.finish(); return offCatalog; }
private InvCatalogImpl makeCatalogOffsets(URI catURI, State localState) throws IOException { InvCatalogImpl parent = (InvCatalogImpl) getParentCatalog(); //URI myURI = baseURI.resolve(getCatalogHref(OFFSET)); InvCatalogImpl offCatalog; offCatalog = new InvCatalogImpl(getFullName(), parent.getVersion(), catURI); InvDatasetImpl top = new InvDatasetImpl(this); top.setParent(null); top.transferMetadata((InvDatasetImpl) this.getParent(), true); // make all inherited metadata local // add Variables, GeospatialCoverage, TimeCoverage ThreddsMetadata tmi = top.getLocalMetadataInheritable(); if (localState.vars != null) tmi.addVariables(localState.vars); if (localState.coverage != null) tmi.setGeospatialCoverage(localState.coverage); if (localState.dateRange != null) tmi.setTimeCoverage(localState.dateRange); top.setName(OFFSET_TITLE); offCatalog.addDataset(top); // services need to be local offCatalog.addService(virtualService); top.getLocalMetadataInheritable().setServiceName(virtualService.getName()); for (InvDatasetImpl ds : makeOffsetDatasets()) top.addDataset(ds); offCatalog.finish(); return offCatalog; }