public static InvAccess copyAccess( InvAccess access, InvDataset parentDataset, List<InvService> availableServices ) { if ( parentDataset == null ) throw new IllegalArgumentException( "Parent dataset may not be null."); String serviceName = access.getService().getName(); InvService service = findServiceByName( serviceName, availableServices); if ( service == null ) { logger.warn( "Access service [" + serviceName + "] not in available service list."); return null; // ToDo Support copying service. //service = copyService( access.getService() ); } DataFormatType dataFormatType = access.getDataFormatType(); InvAccessImpl resultAccess; if ( dataFormatType == null ) { resultAccess = new InvAccessImpl( parentDataset, access.getUrlPath(), service ); resultAccess.setSize( access.getDataSize() ); } else resultAccess = new InvAccessImpl( parentDataset, access.getUrlPath(), service.getName(), null, dataFormatType.toString(), access.getDataSize() ); return resultAccess; }
/** * Get access element that matches the given access standard URL. * Match on a.getStandardUrlName(). * * @param accessURL find theis access URL string * @return InvAccess or null if no match. */ public InvAccess findAccess(String accessURL) { for (InvAccess a : getAccess()) { if (accessURL.equals(a.getStandardUrlName())) return a; } return null; }
@Override public String getName() { return access.getDataset().getName(); }
public String getWrappedUrlName() { URI uri = getStandardUri(); if (uri == null) return null; return wrap(uri.toString()); }
String datasetLocation = access.getStandardUrlName(); ServiceType serviceType = access.getService().getServiceType(); if (debugOpen) System.out.println("ThreddsDataset.openDataset try " + datasetLocation + " " + serviceType);
private NetcdfDataset openDataset(InvAccess access, boolean acquire, ucar.nc2.util.CancelTask task, Result result) throws IOException { InvDataset invDataset = access.getDataset(); String datasetId = invDataset.getID(); String title = invDataset.getName(); String datasetLocation = access.getStandardUrlName(); ServiceType serviceType = access.getService().getServiceType(); if (debugOpen) System.out.println("ThreddsDataset.openDataset= " + datasetLocation);
buff.append("<h3>Access:</h3>\n<ol>\n"); for (InvAccess a : access) { InvService s = a.getService(); String urlString = resolveRelativeUrls || datasetEvents ? a.getStandardUrlName() : a.getUnresolvedUrlName(); String fullUrlString = urlString; if (datasetEvents) fullUrlString = "dataset:" + fullUrlString;
public int accept( InvDataset d) { // check all access for any that has this servicee for (InvAccess a : d.getAccess()) { if (a.getService().getServiceType() == type) return 1; } // cant tell about DQC and resolvers !! for (InvAccess a : d.getAccess()) { if (a.getService().getServiceType() == ServiceType.QC) return 0; if (a.getService().getServiceType() == ServiceType.RESOLVER) return 0; } return -1; } }
void findServices(List<InvService> result, InvDataset ds) { if (ds instanceof InvCatalogRef) return; // look for access elements with unresolved services for (InvAccess a : ds.getAccess()) { InvService s = a.getService(); InvDataset d = a.getDataset(); if (null == d.findService(s.getName()) && !(result.contains(s))) result.add(s); } // recurse into nested datasets for (InvDataset nested : ds.getDatasets()) { findServices(result, nested); } }
private InvAccess findAccessByDataFormatType(List<InvAccess> accessList, DataFormatType type) { for (InvAccess a : accessList) { if (type.toString().equalsIgnoreCase(a.getDataFormatType().toString())) return a; } return null; }
/** * Construct "unresolved" URL: service.getBase() + getUrlPath() + service.getSuffix(). * It is not resolved, so it may be a reletive URL. * @return Unresolved Url as a String */ public String getUnresolvedUrlName() { return service.getBase() + getUrlPath() + service.getSuffix(); }
/** * Get the standard URL, with resolution if the URL is reletive. * catalog.resolveURI( getUnresolvedUrlName()) * * @return URL string, or null if error. */ public String getStandardUrlName() { URI uri = getStandardUri(); if (uri == null) return null; return uri.toString(); }
/** * Construct the standard THREDDS access URI for this dataset access method, * resolve if the URI is relative. * * @return the standard fully resolved THREDDS access URI for this dataset access method, or null if error. */ public URI getStandardUri() { try { InvCatalog cat = dataset.getParentCatalog(); if (cat == null) return new URI(getUnresolvedUrlName()); return cat.resolveUri(getUnresolvedUrlName()); } catch (java.net.URISyntaxException e) { logger.warn("Error parsing URL= " + getUnresolvedUrlName()); return null; } }
@Override public long getLength() { return (long) access.getDataSize(); }
@Override public String getPath() { return access.getWrappedUrlName(); }
String datasetLocation = access.getStandardUrlName(); ServiceType serviceType = access.getService().getServiceType(); if (debugOpen) System.out.println("ThreddsDataset.openDataset try " + datasetLocation + " " + serviceType);
private NetcdfDataset openDataset(InvAccess access, boolean acquire, ucar.nc2.util.CancelTask task, Result result) throws IOException { InvDataset invDataset = access.getDataset(); String datasetId = invDataset.getID(); String title = invDataset.getName(); String datasetLocation = access.getStandardUrlName(); ServiceType serviceType = access.getService().getServiceType(); if (debugOpen) System.out.println("ThreddsDataset.openDataset= " + datasetLocation);
buff.append("<h3>Access:</h3>\n<ol>\n"); for (InvAccess a : access) { InvService s = a.getService(); String urlString = resolveRelativeUrls || datasetEvents ? a.getStandardUrlName() : a.getUnresolvedUrlName(); String fullUrlString = urlString; if (datasetEvents) fullUrlString = "dataset:" + fullUrlString;
public int accept( InvDataset d) { // check all access for any that has this servicee for (InvAccess a : d.getAccess()) { if (a.getService().getServiceType() == type) return 1; } // cant tell about DQC and resolvers !! for (InvAccess a : d.getAccess()) { if (a.getService().getServiceType() == ServiceType.QC) return 0; if (a.getService().getServiceType() == ServiceType.RESOLVER) return 0; } return -1; } }
void findServices(List<InvService> result, InvDataset ds) { if (ds instanceof InvCatalogRef) return; // look for access elements with unresolved services for (InvAccess a : ds.getAccess()) { InvService s = a.getService(); InvDataset d = a.getDataset(); if (null == d.findService(s.getName()) && !(result.contains(s))) result.add(s); } // recurse into nested datasets for (InvDataset nested : ds.getDatasets()) { findServices(result, nested); } }