/** * test */ public static void main(String[] args) { InvDatasetImpl topDs = new InvDatasetImpl(null, "topDs", FeatureType.valueOf("GRID"), "myService", "myUrlPath/"); InvService myS = new InvService("myService", ServiceType.DODS.toString(), "http://thredds.ucar.edu/cgi-bin/dods/nph-dods", "", null); topDs.addService(myS); topDs.getLocalMetadata().setServiceName("myService"); InvDatasetImpl childDs = new InvDatasetImpl(null, "childDs", null, null, "myUrlPath/"); topDs.addDataset(childDs); InvService ts = childDs.findService("myService"); System.out.println("InvDatasetImpl.main(): " + childDs.getAccess(ServiceType.DODS).toString()); }
protected InvDatasetImpl readDataset(InvCatalogImpl catalog, InvDatasetImpl parent, Element dsElem, URI base) { // deal with aliases String name = dsElem.getAttributeValue("name"); String alias = dsElem.getAttributeValue("alias"); if (alias != null) { InvDatasetImpl ds = (InvDatasetImpl) catalog.findDatasetByID(alias); if (ds == null) { factory.appendErr(" ** Parse error: dataset named " + name + " has illegal alias = " + alias + "\n"); return null; } return new InvDatasetImplProxy(name, ds); } InvDatasetImpl dataset = new InvDatasetImpl(parent, name); readDatasetInfo(catalog, dataset, dsElem, base); if (InvCatalogFactory.debugXML) System.out.println(" Dataset added: " + dataset.dump()); return dataset; }
protected InvDatasetImpl readDataset( InvCatalogImpl catalog, InvDatasetImpl parent, Element dsElem, URI base) { // deal with aliases String name = dsElem.getAttributeValue("name"); String alias = dsElem.getAttributeValue("alias"); if (alias != null) { InvDatasetImpl ds = (InvDatasetImpl) catalog.findDatasetByID( alias); if (ds == null) factory.appendErr(" ** Parse error: dataset named "+name+" has illegal alias = "+alias+"\n"); return new InvDatasetImplProxy(name, ds); } InvDatasetImpl dataset = new InvDatasetImpl( parent, name); readDatasetInfo( catalog, dataset, dsElem, base); if (InvCatalogFactory.debugXML) System.out.println (" Dataset added: "+ dataset.dump()); return dataset; }
protected InvDatasetImpl readDataset(InvCatalogImpl catalog, InvDatasetImpl parent, Element dsElem, URI base) { // deal with aliases String name = dsElem.getAttributeValue("name"); String alias = dsElem.getAttributeValue("alias"); if (alias != null) { InvDatasetImpl ds = (InvDatasetImpl) catalog.findDatasetByID(alias); if (ds == null) { factory.appendErr(" ** Parse error: dataset named " + name + " has illegal alias = " + alias + "\n"); return null; } return new InvDatasetImplProxy(name, ds); } InvDatasetImpl dataset = new InvDatasetImpl(parent, name); readDatasetInfo(catalog, dataset, dsElem, base); if (InvCatalogFactory.debugXML) System.out.println(" Dataset added: " + dataset.dump()); return dataset; }
private List<InvDatasetImpl> makeRunDatasets() throws IOException { List<InvDatasetImpl> datasets = new ArrayList<InvDatasetImpl>(); String id = getID(); if (id == null) id = getPath(); for (CalendarDate runDate : fmrc.getRunDates()) { String name = getName() + "_" + RUN_NAME + runDate; name = StringUtil2.replace(name, ' ', "_"); InvDatasetImpl nested = new InvDatasetImpl(this, name); nested.setUrlPath(path + "/" + RUNS + "/" + name); nested.setID(id + "/" + RUNS + "/" + name); ThreddsMetadata tm = nested.getLocalMetadata(); tm.addDocumentation("summary", "Data from Run " + name); CalendarDateRange dr = fmrc.getDateRangeForRun(runDate); if (dr != null) tm.setTimeCoverage(dr); datasets.add(nested); } Collections.reverse(datasets); return datasets; }
private List<InvDatasetImpl> makeRunDatasets() throws IOException { List<InvDatasetImpl> datasets = new ArrayList<InvDatasetImpl>(); String id = getID(); if (id == null) id = getPath(); for (CalendarDate runDate : fmrc.getRunDates()) { String name = getName() + "_" + RUN_NAME + runDate; name = StringUtil2.replace(name, ' ', "_"); InvDatasetImpl nested = new InvDatasetImpl(this, name); nested.setUrlPath(path + "/" + RUNS + "/" + name); nested.setID(id + "/" + RUNS + "/" + name); ThreddsMetadata tm = nested.getLocalMetadata(); tm.addDocumentation("summary", "Data from Run " + name); CalendarDateRange dr = fmrc.getDateRangeForRun(runDate); if (dr != null) tm.setTimeCoverage(dr); datasets.add(nested); } Collections.reverse(datasets); return datasets; }
private List<InvDatasetImpl> makeRunDatasets() throws IOException { makeFmrc(); List<InvDatasetImpl> datasets = new ArrayList<InvDatasetImpl>(); DateFormatter formatter = new DateFormatter(); String id = getID(); if (id == null) id = getPath(); for (Date runDate : fmrc.getRunDates()) { //String name = StringUtil.escape(formatter.toDateTimeStringISO( runDate), ""); String name = getName()+"_"+RUN_NAME+formatter.toDateTimeStringISO( runDate); name = StringUtil2.replace(name, ' ', "_"); InvDatasetImpl nested = new InvDatasetImpl(this, name); nested.setUrlPath(path+"/"+RUNS+"/"+name); nested.setID(id+"/"+RUNS+"/"+name); ThreddsMetadata tm = nested.getLocalMetadata(); tm.addDocumentation("summary", "Data from Run "+name); datasets.add( nested); } Collections.reverse( datasets); return datasets; }
private List<InvDatasetImpl> makeOffsetDatasets() throws IOException { makeFmrc(); List<InvDatasetImpl> datasets = new ArrayList<InvDatasetImpl>(); String id = getID(); if (id == null) id = getPath(); for (Double offset : fmrc.getForecastOffsets()) { String name = getName()+"_"+OFFSET_NAME+offset+"hr"; name = StringUtil2.replace(name, ' ', "_"); InvDatasetImpl nested = new InvDatasetImpl(this, name); nested.setUrlPath(path+"/"+OFFSET+"/"+name); nested.setID(id+"/"+OFFSET+"/"+name); ThreddsMetadata tm = nested.getLocalMetadata(); tm.addDocumentation("summary", "Data from the "+offset+" hour forecasts, across different model runs."); datasets.add( nested); } return datasets; }
private List<InvDatasetImpl> makeForecastDatasets() throws IOException { List<InvDatasetImpl> datasets = new ArrayList<InvDatasetImpl>(); String id = getID(); if (id == null) id = getPath(); for (CalendarDate forecastDate : fmrc.getForecastDates()) { String name = getName() + "_" + FORECAST_NAME + forecastDate; name = StringUtil2.replace(name, ' ', "_"); InvDatasetImpl nested = new InvDatasetImpl(this, name); nested.setUrlPath(path + "/" + FORECAST + "/" + name); nested.setID(id + "/" + FORECAST + "/" + name); ThreddsMetadata tm = nested.getLocalMetadata(); tm.addDocumentation("summary", "Data with the same forecast date, " + name + ", across different model runs."); tm.setTimeCoverage(CalendarDateRange.of(forecastDate, forecastDate)); datasets.add(nested); } return datasets; }
private List<InvDatasetImpl> makeForecastDatasets() throws IOException { List<InvDatasetImpl> datasets = new ArrayList<InvDatasetImpl>(); String id = getID(); if (id == null) id = getPath(); for (CalendarDate forecastDate : fmrc.getForecastDates()) { String name = getName() + "_" + FORECAST_NAME + forecastDate; name = StringUtil2.replace(name, ' ', "_"); InvDatasetImpl nested = new InvDatasetImpl(this, name); nested.setUrlPath(path + "/" + FORECAST + "/" + name); nested.setID(id + "/" + FORECAST + "/" + name); ThreddsMetadata tm = nested.getLocalMetadata(); tm.addDocumentation("summary", "Data with the same forecast date, " + name + ", across different model runs."); tm.setTimeCoverage(CalendarDateRange.of(forecastDate, forecastDate)); datasets.add(nested); } return datasets; }
private List<InvDatasetImpl> makeOffsetDatasets() throws IOException { List<InvDatasetImpl> datasets = new ArrayList<InvDatasetImpl>(); String id = getID(); if (id == null) id = getPath(); for (double offset : fmrc.getForecastOffsets()) { String name = getName() + "_" + OFFSET_NAME + offset + "hr"; name = StringUtil2.replace(name, ' ', "_"); InvDatasetImpl nested = new InvDatasetImpl(this, name); nested.setUrlPath(path + "/" + OFFSET + "/" + name); nested.setID(id + "/" + OFFSET + "/" + name); ThreddsMetadata tm = nested.getLocalMetadata(); tm.addDocumentation("summary", "Data from the " + offset + " hour forecasts, across different model runs."); CalendarDateRange dr = fmrc.getDateRangeForOffset(offset); if (dr != null) tm.setTimeCoverage(dr); datasets.add(nested); } return datasets; }
private List<InvDatasetImpl> makeForecastDatasets() throws IOException { makeFmrc(); List<InvDatasetImpl> datasets = new ArrayList<InvDatasetImpl>(); DateFormatter formatter = new DateFormatter(); String id = getID(); if (id == null) id = getPath(); for (Date forecastDate : fmrc.getForecastDates()) { String name = getName()+"_"+FORECAST_NAME+formatter.toDateTimeStringISO( forecastDate); name = StringUtil2.replace(name, ' ', "_"); InvDatasetImpl nested = new InvDatasetImpl(this, name); nested.setUrlPath(path+"/"+FORECAST+"/"+name); nested.setID(id+"/"+FORECAST+"/"+name); ThreddsMetadata tm = nested.getLocalMetadata(); tm.addDocumentation("summary", "Data with the same forecast date, "+name+", across different model runs."); datasets.add( nested); } return datasets; }
private InvDatasetImpl createDataset(String[] serviceTypeNames) throws URISyntaxException { final InvDatasetImpl dapDataset = new InvDatasetImpl(null, "datasetName", FeatureType.NONE, serviceTypeNames[0], "http://wherever.you.want.bc"); final InvCatalogImpl catalog = new InvCatalogImpl("catalogName", "1.0", new URI("http://x.y")); dapDataset.setCatalog(catalog); for (String serviceName : serviceTypeNames) { final InvService dapService = new InvService(serviceName, serviceName, "irrelevant", "irrelevant", "irrelevant"); final InvAccessImpl invAccess = new InvAccessImpl(dapDataset, "http://y.z", dapService); dapDataset.addAccess(invAccess); } dapDataset.finish(); return dapDataset; }
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 InvDataset createDataset(InvCatalog catalog, String datasetName, final String serviceName) { final InvDatasetImpl dapDataset = new InvDatasetImpl(null, datasetName, FeatureType.NONE, serviceName, "http://wherever.you.want.bc"); dapDataset.setCatalog(catalog); final InvService dapService = new InvService(serviceName, serviceName, "irrelevant", "irrelevant", "irrelevant"); dapDataset.addAccess(new InvAccessImpl(dapDataset, "http://y.z", dapService)); dapDataset.finish(); return dapDataset; }
private InvDatasetImpl createDataset(InvCatalogImpl catalog, String datasetName, final String serviceName) { final InvDatasetImpl dapDataset = new InvDatasetImpl(null, datasetName, FeatureType.NONE, serviceName, "http://wherever.you.want.bc"); dapDataset.setCatalog(catalog); final InvService dapService = new InvService(serviceName, serviceName, "irrelevant", "irrelevant", "irrelevant"); dapDataset.addAccess(new InvAccessImpl(dapDataset, "http://y.z", dapService)); dapDataset.finish(); return dapDataset; }
private InvDatasetImpl createDataset(InvCatalogImpl catalog, String datasetName, final String serviceName) { final InvDatasetImpl dapDataset = new InvDatasetImpl(null, datasetName, FeatureType.NONE, serviceName, "http://wherever.you.want.bc"); dapDataset.setCatalog(catalog); final InvService dapService = new InvService(serviceName, serviceName, "irrelevant", "irrelevant", "irrelevant"); dapDataset.addAccess(new InvAccessImpl(dapDataset, "http://y.z", dapService)); dapDataset.finish(); return dapDataset; }
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; }