Class DefaultCoverageAccess
- Object
-
- DefaultCoverageAccess
-
- All Implemented Interfaces:
CoverageAccess
- Direct Known Subclasses:
DefaultFileCoverageAccess
public class DefaultCoverageAccess extends Object implements CoverageAccess
Default implementation ofCoverageAccess.- Author:
- Simone Giannecchini, GeoSolutions SAS
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface CoverageAccess
CoverageAccess.AccessType
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Parameter<?>>accessParametersprotected EnumSet<CoverageAccess.AccessType>allowedAccessTypesprotected Map<String,Serializable>connectionParametersprotected DriverdriverDriver used to create this CoverageAccess.protected List<Name>names
-
Constructor Summary
Constructors Constructor Description DefaultCoverageAccess(Driver driver, EnumSet<CoverageAccess.AccessType> allowedAccessTypes, Map<String,Parameter<?>> accessParams, Map<String,Serializable> connectionParameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoverageSourceaccess(Name name, Map<String,Serializable> params, CoverageAccess.AccessType accessType, Hints hints, ProgressListener listener)Retrieve aCoverageSourceto access a Named Coverage.booleancanCreate(Name name, Map<String,Serializable> params, Hints hints, ProgressListener listener)Test to see if this coverage access is suitable for creating aCoverageStorereferred by Name, with the specified set of parameters.booleancanDelete(Name name, Map<String,Serializable> params, Hints hints)Test to see if this coverage access is suitable for deleting aCoverageSourcereferred by Name, with the specified set of parameters.CoverageStorecreate(Name name, Map<String,Serializable> params, Hints hints, ProgressListener listener)Create aCoverageStorewith the specified name.booleandelete(Name name, Map<String,Serializable> params, Hints hints)Asks thisCoverageAccessto entirely remove a certain Coverage from the availableCoverageSources.voiddispose()This will free any cached info object or header information.Map<String,Parameter<?>>getAccessParameterInfo(CoverageAccess.AccessType accessType)Describes the required (and optional) parameters that can be used to open aCoverageSource.Map<String,Serializable>getConnectParameters()Retrieves the parameters used to connect to this live instance ofCoverageAccess.intgetCoveragesNumber(ProgressListener listener)The number of Coverages made available.DrivergetDriver()Returns theDriverwhich has been used to connect to this CoverageAccess.ServiceInfogetInfo(ProgressListener listener)Description of the CoverageAccess we are connected to here.List<Name>getNames(ProgressListener listener)Names of the available Coverages.MetadataNodegetStorageMetadata(String metadataDomain)Set<String>getStorageMetadataDomains()Set<CoverageAccess.AccessType>getSupportedAccessTypes()booleanisCreateSupported()Tells me whether or not thisCoverageAccesssupports creation of a new coverage storage.booleanisDeleteSupported()Tells me whether or not thisCoverageAccesssupports removal of an existing coverage storage.
-
-
-
Field Detail
-
driver
protected final Driver driver
Driver used to create this CoverageAccess.
-
allowedAccessTypes
protected final EnumSet<CoverageAccess.AccessType> allowedAccessTypes
-
connectionParameters
protected final Map<String,Serializable> connectionParameters
-
-
Constructor Detail
-
DefaultCoverageAccess
public DefaultCoverageAccess(Driver driver, EnumSet<CoverageAccess.AccessType> allowedAccessTypes, Map<String,Parameter<?>> accessParams, Map<String,Serializable> connectionParameters)
-
-
Method Detail
-
access
public CoverageSource access(Name name, Map<String,Serializable> params, CoverageAccess.AccessType accessType, Hints hints, ProgressListener listener) throws IOException
Description copied from interface:CoverageAccessRetrieve aCoverageSourceto access a Named Coverage.- Specified by:
accessin interfaceCoverageAccess- Parameters:
name- Indicate the coverage to accessparams- Additional parameters as needed to indicate what part of the data set to accessaccessType- Requested level of accesshints- Implementation specific hints; please review the javadocs for your Driver for detailslistener- used to report progress while obtianing access- Throws:
IOException
-
canCreate
public boolean canCreate(Name name, Map<String,Serializable> params, Hints hints, ProgressListener listener) throws IOException
Description copied from interface:CoverageAccessTest to see if this coverage access is suitable for creating aCoverageStorereferred by Name, with the specified set of parameters.This method will only return true if getSupportedAccessTypes() == READ_WRITE.
- Specified by:
canCreatein interfaceCoverageAccess- Parameters:
name- The name of the data set to createparams- Indicate the content to be createdhints- Implementations specific Hints, please check the javadocs for your driver for details- Returns:
- true if a coverage can be created
- Throws:
IOException
-
canDelete
public boolean canDelete(Name name, Map<String,Serializable> params, Hints hints) throws IOException
Description copied from interface:CoverageAccessTest to see if this coverage access is suitable for deleting aCoverageSourcereferred by Name, with the specified set of parameters.- Specified by:
canDeletein interfaceCoverageAccess- Parameters:
name- Name of data set to remove fromparams- Used to indicate what what of the data set to remove; ifnullindicate the entire data set should be removedhints- Implementation specific Hints; please consult the javadocs for the Driver you are working with.- Throws:
IOException
-
create
public CoverageStore create(Name name, Map<String,Serializable> params, Hints hints, ProgressListener listener) throws IOException
Description copied from interface:CoverageAccessCreate aCoverageStorewith the specified name.You can check isCreateSupported() prior to calling this method. Implementing subclasses may throw an
UnsupportedOperationExceptionin case the related Driver won't allowCoverageStorecreation.- Specified by:
createin interfaceCoverageAccess- Parameters:
name- The name of the data set to createparams- Indicate the content to be createdhints- Implementations specific Hints, please check the javadocs for your driver for details- Throws:
IOException
-
delete
public boolean delete(Name name, Map<String,Serializable> params, Hints hints) throws IOException
Description copied from interface:CoverageAccessAsks thisCoverageAccessto entirely remove a certain Coverage from the availableCoverageSources.Many file based formats won't allow to perform such operation, but db based source should be quite happy with it.
- Specified by:
deletein interfaceCoverageAccess- Returns:
truein case of success.- Throws:
IOException
-
getAccessParameterInfo
public Map<String,Parameter<?>> getAccessParameterInfo(CoverageAccess.AccessType accessType)
Description copied from interface:CoverageAccessDescribes the required (and optional) parameters that can be used to open aCoverageSource.- Specified by:
getAccessParameterInfoin interfaceCoverageAccess- Returns:
- Param a
Mapdescribing theMapfor#connect(Map).
-
getConnectParameters
public Map<String,Serializable> getConnectParameters()
Description copied from interface:CoverageAccessRetrieves the parameters used to connect to this live instance ofCoverageAccess.- Specified by:
getConnectParametersin interfaceCoverageAccess- Returns:
- the parameters used to connect to this live instance of
CoverageAccess.
-
getCoveragesNumber
public int getCoveragesNumber(ProgressListener listener)
Description copied from interface:CoverageAccessThe number of Coverages made available.- Specified by:
getCoveragesNumberin interfaceCoverageAccess- Returns:
- getNames( listener ).size()
-
getInfo
public ServiceInfo getInfo(ProgressListener listener)
Description copied from interface:CoverageAccessDescription of the CoverageAccess we are connected to here.- Specified by:
getInfoin interfaceCoverageAccess- Returns:
- Description of the CoverageAccess we are connected to here.
-
getNames
public List<Name> getNames(ProgressListener listener)
Description copied from interface:CoverageAccessNames of the available Coverages.Each Coverage named here represents a unique data product that may be accessed via the CoverageSource
- Specified by:
getNamesin interfaceCoverageAccess- Returns:
- Names of the available contents.
-
getStorageMetadata
public MetadataNode getStorageMetadata(String metadataDomain)
- Specified by:
getStorageMetadatain interfaceCoverageAccess
-
getStorageMetadataDomains
public Set<String> getStorageMetadataDomains()
- Specified by:
getStorageMetadataDomainsin interfaceCoverageAccess
-
getSupportedAccessTypes
public Set<CoverageAccess.AccessType> getSupportedAccessTypes()
Description copied from interface:CoverageAccess- Specified by:
getSupportedAccessTypesin interfaceCoverageAccess- Returns:
- the
Setof supportedCoverageAccess.AccessTypes for thisCoverageAccessinstance.
-
isCreateSupported
public boolean isCreateSupported()
Description copied from interface:CoverageAccessTells me whether or not thisCoverageAccesssupports creation of a new coverage storage.This method will only return true if getSupportedAccessTypes() == READ_WRITE.
- Specified by:
isCreateSupportedin interfaceCoverageAccess- Returns:
truewhen removal of of a new coverage storage is supported,falseotherwise.
-
isDeleteSupported
public boolean isDeleteSupported()
Description copied from interface:CoverageAccessTells me whether or not thisCoverageAccesssupports removal of an existing coverage storage.- Specified by:
isDeleteSupportedin interfaceCoverageAccess- Returns:
truewhen removal of an existing coverage storage is supported,falseotherwise.
-
getDriver
public Driver getDriver()
Description copied from interface:CoverageAccessReturns theDriverwhich has been used to connect to this CoverageAccess.- Specified by:
getDriverin interfaceCoverageAccess- Returns:
Driverused to connect
-
dispose
public void dispose()
Description copied from interface:CoverageAccessThis will free any cached info object or header information.Often a
CoverageAccesswill keep a file channel open, this will clean that sort of thing up.Once a
CoverageAccesshas been disposed it can be seen as being in unspecified state, hence calling a method on it may have unpredictable results.- Specified by:
disposein interfaceCoverageAccess
-
-