@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; }
InvCatalogImpl main = makeCatalogTop(catURI, localState); main.addService(virtualService); main.getDataset().getLocalMetadataInheritable().setServiceName(virtualService.getName()); main.finish(); return main;
@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; }
/** * Look for InvMetadata elements in the parent that need to be added to the public metadata of this dataset. * Recurse up through all ancestors. * * @param parent transfer from here */ private void transferInheritable2PublicMetadata(InvDatasetImpl parent) { if (parent == null) return; if (debugInherit) System.out.println(" inheritFromParent= " + parent.getID()); transfer2PublicMetadata(parent.getLocalMetadataInheritable(), true); //transfer2PublicMetadata(parent.getCat6Metadata(), true); /* look through local metadata, find inherited InvMetadata elements ThreddsMetadata tmd = parent.getLocalMetadata(); Iterator iter = tmd.getMetadata().iterator(); while (iter.hasNext()) { InvMetadata meta = (InvMetadata) iter.next(); if (meta.isInherited()) { if (!meta.isThreddsMetadata()) { metadata.add(meta); } else { if (debugInherit) System.out.println(" inheritMetadata Element " + tmd.isInherited() + " " + meta.isInherited()); meta.finish(); // make sure XLink is read in. transfer2PublicMetadata(meta.getThreddsMetadata(), false); } } } */ // recurse transferInheritable2PublicMetadata((InvDatasetImpl) parent.getParent()); }
/** * copy constructor * * @param from copy from here */ public InvDatasetImpl(InvDatasetImpl from) { super(from.getParent(), from.getName()); // steal everything this.tm = new ThreddsMetadata(from.getLocalMetadata()); this.tmi = new ThreddsMetadata(from.getLocalMetadataInheritable()); this.accessLocal = new ArrayList<>(from.getAccessLocal()); this.servicesLocal = new ArrayList<>(from.getServicesLocal()); this.harvest = from.harvest; this.collectionType = from.collectionType; }
/** * transfer inherited metadata, consolidating it into target * * @param fromDs transfer from here, plus its parents * @param target transfer to here */ private void transferInheritableMetadata(InvDatasetImpl fromDs, ThreddsMetadata target, boolean copyInheritedMetadataFromParents) { if (fromDs == null) return; if (debugInherit2) System.out.println(" transferInheritedMetadata= " + fromDs.getName()); target.add(fromDs.getLocalMetadataInheritable(), true); /* look through local metadata, find inherited InvMetadata elements ThreddsMetadata tmd = fromDs.getLocalMetadata(); Iterator iter = tmd.getMetadata().iterator(); while (iter.hasNext()) { InvMetadata meta = (InvMetadata) iter.next(); if (meta.isInherited()) { if (!meta.isThreddsMetadata()) { tmc.addMetadata( meta); } else { if (debugInherit2) System.out.println(" transferInheritedMetadata "+meta.hashCode()+" = "+meta); meta.finish(); // LOOK ?? make sure XLink is read in. tmc.add( meta.getThreddsMetadata(), true); } } } */ // now do the same for the parents if (copyInheritedMetadataFromParents) transferInheritableMetadata((InvDatasetImpl) fromDs.getParent(), target, true); }
@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; }
/** * copy constructor * * @param from copy from here */ public InvDatasetImpl(InvDatasetImpl from) { super(from.getParent(), from.getName()); // steal everything this.tm = new ThreddsMetadata(from.getLocalMetadata()); this.tmi = new ThreddsMetadata(from.getLocalMetadataInheritable()); this.accessLocal = new ArrayList<InvAccess>(from.getAccessLocal()); this.servicesLocal = new ArrayList<InvService>(from.getServicesLocal()); this.harvest = from.harvest; this.collectionType = from.collectionType; }
/** * copy constructor * * @param from copy from here */ public InvDatasetImpl(InvDatasetImpl from) { super(from.getParent(), from.getName()); // steal everything this.tm = new ThreddsMetadata(from.getLocalMetadata()); this.tmi = new ThreddsMetadata(from.getLocalMetadataInheritable()); this.accessLocal = new ArrayList<>(from.getAccessLocal()); this.servicesLocal = new ArrayList<>(from.getServicesLocal()); this.harvest = from.harvest; this.collectionType = from.collectionType; }
/** * Look for InvMetadata elements in the parent that need to be added to the public metadata of this dataset. * Recurse up through all ancestors. * * @param parent transfer from here */ private void transferInheritable2PublicMetadata(InvDatasetImpl parent) { if (parent == null) return; if (debugInherit) System.out.println(" inheritFromParent= " + parent.getID()); transfer2PublicMetadata(parent.getLocalMetadataInheritable(), true); //transfer2PublicMetadata(parent.getCat6Metadata(), true); /* look through local metadata, find inherited InvMetadata elements ThreddsMetadata tmd = parent.getLocalMetadata(); Iterator iter = tmd.getMetadata().iterator(); while (iter.hasNext()) { InvMetadata meta = (InvMetadata) iter.next(); if (meta.isInherited()) { if (!meta.isThreddsMetadata()) { metadata.add(meta); } else { if (debugInherit) System.out.println(" inheritMetadata Element " + tmd.isInherited() + " " + meta.isInherited()); meta.finish(); // make sure XLink is read in. transfer2PublicMetadata(meta.getThreddsMetadata(), false); } } } */ // recurse transferInheritable2PublicMetadata((InvDatasetImpl) parent.getParent()); }
/** * transfer inherited metadata, consolidating it into target * * @param fromDs transfer from here, plus its parents * @param target transfer to here */ private void transferInheritableMetadata(InvDatasetImpl fromDs, ThreddsMetadata target, boolean copyInheritedMetadataFromParents) { if (fromDs == null) return; if (debugInherit2) System.out.println(" transferInheritedMetadata= " + fromDs.getName()); target.add(fromDs.getLocalMetadataInheritable(), true); /* look through local metadata, find inherited InvMetadata elements ThreddsMetadata tmd = fromDs.getLocalMetadata(); Iterator iter = tmd.getMetadata().iterator(); while (iter.hasNext()) { InvMetadata meta = (InvMetadata) iter.next(); if (meta.isInherited()) { if (!meta.isThreddsMetadata()) { tmc.addMetadata( meta); } else { if (debugInherit2) System.out.println(" transferInheritedMetadata "+meta.hashCode()+" = "+meta); meta.finish(); // LOOK ?? make sure XLink is read in. tmc.add( meta.getThreddsMetadata(), true); } } } */ // now do the same for the parents if (copyInheritedMetadataFromParents) transferInheritableMetadata((InvDatasetImpl) fromDs.getParent(), target, true); }
/** * Transfer all inheritable metadata from fromDs to the local metadata of this dataset. * Called by InvDatasetScan to transfer inheritable metaddata to the nested catalogRef * * @param fromDs transfer from here */ public void transferMetadata(InvDatasetImpl fromDs, boolean copyInheritedMetadataFromParents) { if (fromDs == null) return; logger.debug(" transferMetadata= " + fromDs.getName()); if (this != fromDs) getLocalMetadata().add(fromDs.getLocalMetadata(), false); transferInheritableMetadata(fromDs, getLocalMetadataInheritable(), copyInheritedMetadataFromParents); setResourceControl(fromDs.getRestrictAccess()); }
/** * Transfer all inheritable metadata from fromDs to the local metadata of this dataset. * Called by InvDatasetScan to transfer inheritable metaddata to the nested catalogRef * * @param fromDs transfer from here */ public void transferMetadata(InvDatasetImpl fromDs, boolean copyInheritedMetadataFromParents) { if (fromDs == null) return; if (debugInherit2) System.out.println(" transferMetadata= " + fromDs.getName()); if (this != fromDs) getLocalMetadata().add(fromDs.getLocalMetadata(), false); transferInheritableMetadata(fromDs, getLocalMetadataInheritable(), copyInheritedMetadataFromParents); setResourceControl(fromDs.getRestrictAccess()); }
/** * Transfer all inheritable metadata from fromDs to the local metadata of this dataset. * Called by InvDatasetScan to transfer inheritable metaddata to the nested catalogRef * * @param fromDs transfer from here */ public void transferMetadata(InvDatasetImpl fromDs, boolean copyInheritedMetadataFromParents) { if (fromDs == null) return; if (debugInherit2) System.out.println(" transferMetadata= " + fromDs.getName()); if (this != fromDs) getLocalMetadata().add(fromDs.getLocalMetadata(), false); transferInheritableMetadata(fromDs, getLocalMetadataInheritable(), copyInheritedMetadataFromParents); setResourceControl(fromDs.getRestrictAccess()); }
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; }
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; }