Package thredds.client.catalog.tools
Class DataFactory
- java.lang.Object
-
- thredds.client.catalog.tools.DataFactory
-
public class DataFactory extends Object
DataFactory for THREDDS client catalogs
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDataFactory.ResultThe result of trying to open a THREDDS dataset.
-
Constructor Summary
Constructors Constructor Description DataFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidannotate(Dataset ds, NetcdfDataset ncDataset)Add information from the Dataset to the NetcdfDataset.AccesschooseDatasetAccess(List<Access> accessList)Find the "best" access in case theres more than one, based on what the CDM knows how to open and use.NetcdfDatasetopenDataset(String location, boolean acquire, CancelTask task, Formatter log)Open a NetcdfDataset from a URL location string.NetcdfDatasetopenDataset(Access access, boolean acquire, CancelTask task, Formatter log)Try to open Access as a NetcdfDataset.NetcdfDatasetopenDataset(Dataset Dataset, boolean acquire, CancelTask task, Formatter log)Try to open as a NetcdfDataset.DataFactory.ResultopenFeatureDataset(String urlString, CancelTask task)Open a FeatureDataset from a URL location string.DataFactory.ResultopenFeatureDataset(Access access, CancelTask task)Open a FeatureDataset from an Access object.DataFactory.ResultopenFeatureDataset(Dataset Dataset, CancelTask task)Open a FeatureDataset from an Dataset object, deciding on which Access to use.DataFactory.ResultopenFeatureDataset(FeatureType wantFeatureType, String urlString, CancelTask task)Open a FeatureDataset from a URL location string, and a desired type (may by NONE or null).DataFactory.ResultopenFeatureDataset(FeatureType wantFeatureType, Dataset ds, CancelTask task, DataFactory.Result result)static voidsetDebugFlags(DebugFlags debugFlag)static voidsetPreferAccess(ServiceType... prefer)static voidsetPreferCdm(boolean prefer)
-
-
-
Field Detail
-
PROTOCOL
public static final String PROTOCOL
- See Also:
- Constant Field Values
-
SCHEME
public static final String SCHEME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setPreferCdm
public static void setPreferCdm(boolean prefer)
-
setPreferAccess
public static void setPreferAccess(ServiceType... prefer)
-
setDebugFlags
public static void setDebugFlags(DebugFlags debugFlag)
-
openFeatureDataset
public DataFactory.Result openFeatureDataset(String urlString, CancelTask task) throws IOException
Open a FeatureDataset from a URL location string. Example URLS:- http://localhost:8080/test/addeStationDataset.xml#surfaceHourly
- thredds:http://localhost:8080/test/addeStationDataset.xml#surfaceHourly
- thredds://localhost:8080/test/addeStationDataset.xml#surfaceHourly
- thredds:file:c:/test/data/catalog/addeStationDataset.xml#AddeSurfaceData (absolute file)
- thredds:resolve:resolveURL
- Parameters:
urlString- [thredds:]catalog.xml#datasetIdtask- may be null- Returns:
- ThreddsDataFactory.Result check fatalError for validity
- Throws:
IOException- on read error
-
openFeatureDataset
public DataFactory.Result openFeatureDataset(FeatureType wantFeatureType, String urlString, CancelTask task) throws IOException
Open a FeatureDataset from a URL location string, and a desired type (may by NONE or null).- Parameters:
wantFeatureType- desired feature type, may be NONE or nullurlString- [thredds:]catalog.xml#datasetIdtask- may be null- Returns:
- ThreddsDataFactory.Result check fatalError for validity
- Throws:
IOException- on read error
-
openFeatureDataset
@Nonnull public DataFactory.Result openFeatureDataset(Dataset Dataset, CancelTask task) throws IOException
Open a FeatureDataset from an Dataset object, deciding on which Access to use.- Parameters:
Dataset- use this to figure out what type, how to open, etctask- allow user to cancel; may be null- Returns:
- ThreddsDataFactory.Result check fatalError for validity
- Throws:
IOException- on read error
-
openFeatureDataset
@Nonnull public DataFactory.Result openFeatureDataset(FeatureType wantFeatureType, Dataset ds, CancelTask task, DataFactory.Result result) throws IOException
- Throws:
IOException
-
openFeatureDataset
public DataFactory.Result openFeatureDataset(Access access, CancelTask task) throws IOException
Open a FeatureDataset from an Access object.- Parameters:
access- use this Access.task- may be null- Returns:
- ThreddsDataFactory.Result check fatalError for validity
- Throws:
IOException- on read error
-
openDataset
public NetcdfDataset openDataset(String location, boolean acquire, CancelTask task, Formatter log) throws IOException
Open a NetcdfDataset from a URL location string. Example URLS:- http://localhost:8080/test/addeStationDataset.xml#surfaceHourly
- thredds:http://localhost:8080/test/addeStationDataset.xml#surfaceHourly
- thredds://localhost:8080/test/addeStationDataset.xml#surfaceHourly
- thredds:file:c:/dev/netcdf-java-2.2/test/data/catalog/addeStationDataset.xml#AddeSurfaceData (absolute file)
- thredds:resolve:resolveURL
- Parameters:
location- catalog.xml#datasetId, may optionally start with "thredds:"task- may be nulllog- error messages gp here, may be nullacquire- if true, aquire the dataset, else open it- Returns:
- NetcdfDataset
- Throws:
IOException- on read error
-
openDataset
public NetcdfDataset openDataset(Dataset Dataset, boolean acquire, CancelTask task, Formatter log) throws IOException
Try to open as a NetcdfDataset.- Parameters:
Dataset- open thisacquire- if true, aquire the dataset, else open ittask- may be nulllog- error message, may be null- Returns:
- NetcdfDataset or null if failure
- Throws:
IOException- on read error
-
openDataset
public NetcdfDataset openDataset(Access access, boolean acquire, CancelTask task, Formatter log) throws IOException
Try to open Access as a NetcdfDataset.- Parameters:
access- open this Accessacquire- if true, aquire the dataset, else open ittask- may be nulllog- error message, may be null- Returns:
- NetcdfDataset or null if failure
- Throws:
IOException- on read error
-
chooseDatasetAccess
public Access chooseDatasetAccess(List<Access> accessList)
Find the "best" access in case theres more than one, based on what the CDM knows how to open and use.- Parameters:
accessList- choose from this list.- Returns:
- best access method.
-
annotate
public static void annotate(Dataset ds, NetcdfDataset ncDataset)
Add information from the Dataset to the NetcdfDataset.- Parameters:
ds- get info from herencDataset- add to here
-
-