public interface FeatureStore extends DataStore, UndoRedoStack, Cloneable
A FeatureStore is a type of store whose data consists on sets of
Feature
(s). Feature
(s) from the same FeatureStore can be of
different FeatureType
(s) (as in GML format for instance).
FeatureStore allows:
FeatureType
. A FeatureStore always has one
and only one default FeatureType.
FeatureType
(s) defined in the FeatureStore.
FeatureSet
)
through FeatureQuery
, as well as background loading.
Envelope
(AKA bounding box or extent) of the
store.
FeatureType
(s).
Geometry
types.
Modifier and Type | Field and Description |
---|---|
static String |
METADATA_DEFINITION_NAME |
static int |
MODE_APPEND
Indicates that this store is in append mode
|
static int |
MODE_FULLEDIT
Indicates that this store is in full edit mode
|
static int |
MODE_QUERY
Indicates that this store is in query mode
|
FEATURE_METADATA_DEFINITION_NAME, METADATA_CONTAINERNAME, METADATA_CRS, METADATA_ENVELOPE, METADATA_FEATURETYPE, METADATA_PROVIDER, SPATIAL_METADATA_DEFINITION_NAME
Modifier and Type | Method and Description |
---|---|
boolean |
allowWrite()
Indicates whether this store allows writing.
|
void |
beginEditingGroup(String description)
Initiates an editing group.
|
void |
cancelEditing()
Cancels all editing since the last edit().
|
boolean |
canCommitChanges()
Returns true if you can call CommitChanges method.
|
boolean |
canWriteGeometry(int gvSIGgeometryType)
Deprecated.
Mirar de cambiarlo a metadatos
|
void |
commitChanges()
Save changes in the provider without leaving the edit mode.
|
void |
createCache(String name,
DynObject parameters) |
ExpressionBuilder |
createExpression()
Deprecated.
use createExpressionBuilder
|
ExpressionBuilder |
createExpressionBuilder() |
FeatureQuery |
createFeatureQuery()
Returns a new
FeatureQuery associated to this store. |
FeatureSelection |
createFeatureSelection()
Creates a
FeatureSelection |
FeatureIndex |
createIndex(FeatureType featureType,
String attributeName,
String indexName)
Creates an index which will be applied to the features of the given type,
by using the data of the given attribute.
|
FeatureIndex |
createIndex(FeatureType featureType,
String attributeName,
String indexName,
Observer observer)
Creates an index which will be applied to the features of the given type,
by using the data of the given attribute.
|
FeatureIndex |
createIndex(String indexTypeName,
FeatureType featureType,
String attributeName,
String indexName)
Creates an index which will be applied to the features of the given type,
by using the data of the given attribute.
|
FeatureIndex |
createIndex(String indexTypeName,
FeatureType featureType,
String attributeName,
String indexName,
Observer observer)
Creates an index which will be applied to the features of the given type,
by using the data of the given attribute.
|
EditableFeature |
createNewFeature()
Creates a new feature using the default feature type and returns it as an
EditableFeature |
EditableFeature |
createNewFeature(boolean defaultValues)
Creates a new feature of default
FeatureType . |
EditableFeature |
createNewFeature(Feature defaultValues)
Creates a new feature of default
FeatureType . |
EditableFeature |
createNewFeature(FeatureType type,
boolean defaultValues)
Creates a new feature of the given
FeatureType . |
EditableFeature |
createNewFeature(FeatureType type,
Feature defaultValues)
Creates a new feature of the given
FeatureType and uses the given
Feature as default values to initialize it. |
void |
delete(Feature feature)
Deletes a
Feature from the store. |
void |
edit()
Enters editing state.
|
void |
edit(int mode)
Enters editing state specifying the editing mode.
|
void |
endEditingGroup()
Finishes an editing group.
|
void |
export(DataServerExplorer explorer,
String provider,
NewFeatureStoreParameters params)
Exports this store to another store.
|
void |
finishEditing()
Exits editing state.
|
Throwable |
getBreakingsCause() |
FeatureCache |
getCache() |
FeatureType |
getDefaultFeatureType()
Returns this store's default
FeatureType . |
Envelope |
getEnvelope()
Returns this store's total envelope (extent).
|
Feature |
getFeature(DynObject dynobject)
Return the associated feature to the dynobject.
|
Feature |
getFeatureByReference(FeatureReference reference)
Returns the feature given its reference.
|
Feature |
getFeatureByReference(FeatureReference reference,
FeatureType featureType)
Returns the feature given its reference and feature type.
|
long |
getFeatureCount()
Returns featue count of this store.
|
List<Feature> |
getFeatures() |
List<Feature> |
getFeatures(FeatureQuery query) |
List<Feature> |
getFeatures(FeatureQuery query,
int pageSize)
Return a paginated list of Features filtered by the query.
|
FeatureSelection |
getFeatureSelection()
Returns the current
FeatureSelection . |
FeatureSet |
getFeatureSet()
Returns all available features in the store.
|
FeatureSet |
getFeatureSet(FeatureQuery featureQuery)
Returns a subset of features taking into account the properties and
restrictions of the FeatureQuery.
|
void |
getFeatureSet(FeatureQuery featureQuery,
Observer observer)
Loads a subset of features taking into account the properties and
restrictions of the FeatureQuery.
|
void |
getFeatureSet(Observer observer)
Loads all available feature in the store.
|
FeatureSet |
getFeatureSet(String filter) |
FeatureSet |
getFeatureSet(String filter,
String sortBy) |
FeatureSet |
getFeatureSet(String filter,
String sortBy,
boolean asc) |
FeatureType |
getFeatureType(String featureTypeId)
Returns this store's featureType
FeatureType matches with
featureTypeId. |
List |
getFeatureTypes()
Returns this store's
FeatureType (s). |
FeatureIndexes |
getIndexes()
Returns a FeatureIndexes structure containing all available indexes in
the store.
|
FeatureLocks |
getLocks()
Returns the set of locked features
|
DataStoreParameters |
getParameters()
Returns this store's parameters.
|
int |
getRetrievedFeaturesLimit()
If the
FeatureStoreProvider#hasRetrievedFeaturesLimit() returns
true,
it returns the limit of features retrieved from the provider. |
IProjection |
getSRSDefaultGeometry()
Deprecated.
use getDefaultFeatureType().getDefaultSRS()
|
FeatureStoreTransforms |
getTransforms()
Returns this store transforms
|
boolean |
hasRetrievedFeaturesLimit()
Return if the maximum number of features provided by the
provider are limited.
|
void |
insert(EditableFeature feature)
Inserts a
Feature in the store. |
boolean |
isAppending()
Indicates whether this store is in appending state.
|
boolean |
isAppendModeSupported()
Indicates whether this store supports append mode.
|
boolean |
isBroken() |
boolean |
isEditing()
Indicates whether this store is in editing state.
|
boolean |
isKnownEnvelope()
Return if the provider knows the real envelope of a layer.
|
boolean |
isLocksSupported()
Indicates whether this store supports locks.
|
Iterator |
iterator() |
void |
setSelection(FeatureSet selection)
Sets the selection to the passed
FeatureSet |
void |
update(EditableFeature feature)
Updates a
Feature in the store with the changes in the
EditableFeature . |
void |
update(EditableFeatureType featureType)
Updates a
FeatureType in the store with the changes in the
EditableFeatureType . |
void |
validateFeatures(int mode)
Applies the validation rules associated to the given mode to the active
FeatureSet . |
SpatialIndex |
wrapSpatialIndex(SpatialIndex index) |
accept, accept, createQuery, createSelection, getChildren, getDataSet, getDataSet, getDataSet, getDataSet, getExplorer, getFullName, getInterval, getName, getProviderFactory, getProviderName, getSelection, getTimes, getTimes, refresh, setSelection, useCache
beginComplexNotification, disableNotifications, enableNotifications, endComplexNotification
addObserver, deleteObserver, deleteObservers
loadFromState, saveToState
getMetadataChildren, getMetadataID, getMetadataName
dispose
hasDynMethod
clear, delegate, getDynClass, getDynValue, hasDynValue, implement, invokeDynMethod, invokeDynMethod, setDynValue
canRedo, canUndo, getRedoInfos, getUndoInfos, redo, redo, undo, undo
static final String METADATA_DEFINITION_NAME
static final int MODE_QUERY
static final int MODE_FULLEDIT
static final int MODE_APPEND
boolean allowWrite()
FeatureType getDefaultFeatureType() throws DataException
FeatureType
.FeatureType
.DataException
FeatureType getFeatureType(String featureTypeId) throws DataException
FeatureType
matches with
featureTypeId.featureTypeId
- FeatureType
.DataException
List getFeatureTypes() throws DataException
FeatureType
(s).FeatureType
(s).DataException
DataStoreParameters getParameters()
getParameters
in interface DataStore
DataStoreParameters
containing this store's parametersboolean canWriteGeometry(int gvSIGgeometryType) throws DataException
DataException
Envelope getEnvelope() throws DataException
null
if
store not have geometry informationDataException
IProjection getSRSDefaultGeometry() throws DataException
DataException
void export(DataServerExplorer explorer, String provider, NewFeatureStoreParameters params) throws DataException
explorer
- DataServerExplorer
targetparams
- New parameters of this store that will be used on the target
explorerDataException
FeatureSet getFeatureSet() throws DataException
NOTE: if you use this method to get a
FeatureSet
, you must get sure it is disposed
(@see Disposable.dispose()
) in any case, even if an
error occurs while getting the data. It is recommended to use the
accept
methods instead, which handle everything for you.
Take into account the accept methods may use a fast iterator to
get the features.
ReadException
- if there is any error while reading the featuresDataException
DataStore.accept(org.gvsig.tools.visitor.Visitor)
FeatureSet getFeatureSet(String filter) throws DataException
DataException
FeatureSet getFeatureSet(String filter, String sortBy) throws DataException
DataException
FeatureSet getFeatureSet(String filter, String sortBy, boolean asc) throws DataException
DataException
FeatureSet getFeatureSet(FeatureQuery featureQuery) throws DataException
NOTE: if you use this method to get a
FeatureSet
, you must get sure it is disposed
(@see Disposable.dispose()
) in any case, even if an
error occurs while getting the data. It is recommended to use the
accept
methods instead, which handle everything for you.
Take into account the accept methods may use a fast iterator to
get the features.
featureQuery
- defines the characteristics of the features to returnReadException
- if there is any error while reading the featuresDataException
DataStore.accept(org.gvsig.tools.visitor.Visitor,
org.gvsig.fmap.dal.DataQuery)
void getFeatureSet(FeatureQuery featureQuery, Observer observer) throws DataException
featureQuery
- defines the characteristics of the features to returnobserver
- to be notified of each loaded FeatureDataException
- if there is any error while loading the featuresvoid getFeatureSet(Observer observer) throws DataException
observer
- to be notified of each loaded FeatureDataException
- if there is any error while loading the featuresList<Feature> getFeatures(FeatureQuery query, int pageSize)
query
- to filter the returned feature listpageSize
- the page size of the listList<Feature> getFeatures(FeatureQuery query)
Feature getFeatureByReference(FeatureReference reference) throws DataException
reference
- a unique FeatureReferenceDataException
Feature getFeatureByReference(FeatureReference reference, FeatureType featureType) throws DataException
reference
- a unique FeatureReferencefeatureType
- FeatureType to which the requested Feature belongsDataException
void edit() throws DataException
DataException
void edit(int mode) throws DataException
mode
- DataException
void cancelEditing() throws DataException
DataException
void finishEditing() throws DataException
DataException
void commitChanges() throws DataException
DataException
boolean canCommitChanges() throws DataException
DataException
boolean isEditing()
boolean isAppending()
FeatureSet
.void update(EditableFeatureType featureType) throws DataException
FeatureType
in the store with the changes in the
EditableFeatureType
.FeatureSet
from this store that are used will be invalidated.featureType
- an EditableFeatureType
with the changes.DataException
void update(EditableFeature feature) throws DataException
Feature
in the store with the changes in the
EditableFeature
.FeatureSet
from this store that was still in use will be
invalidated. You can override this using
FeatureSet.update(EditableFeature)
.feature
- the feature to be updatedDataException
void delete(Feature feature) throws DataException
Feature
from the store.FeatureSet
from this store that was still in use will be
invalidated. You can override this using Iterator.remove()
from
FeatureSet
.feature
- The feature to be deleted.DataException
void insert(EditableFeature feature) throws DataException
Feature
in the store.FeatureSet
from this store that was still in use will be
invalidated. You can override this using
FeatureSet.insert(EditableFeature)
.feature
- The feature to be insertedDataException
EditableFeature createNewFeature() throws DataException
EditableFeature
DataException
EditableFeature createNewFeature(FeatureType type, Feature defaultValues) throws DataException
FeatureType
and uses the given
Feature
as default values to initialize it.type
- the new feature's feature typedefaultValues
- a feature whose values are used as default values for the new
feature.DataException
EditableFeature createNewFeature(FeatureType type, boolean defaultValues) throws DataException
FeatureType
. The flag
defaultValues is used to indicate whether the new feature should be
initialized with default values or not.type
- the new feature's feature typedefaultValues
- if true the new feature is initialized with each attribute's
default value.DataException
EditableFeature createNewFeature(boolean defaultValues) throws DataException
FeatureType
. The flag
defaultValues is used to indicate whether the new feature should be
initialized with default values or not.defaultValues
- if true the new feature is initialized with each attribute's
default value.DataException
EditableFeature createNewFeature(Feature defaultValues) throws DataException
FeatureType
.
The new feature should be initialized with the values of the feature
passed as parameter.
Values are inicialiced by name from the feature specified. Error in
value assignement are ignoreds.defaultValues
- the values to initialize the new feature.DataException
void validateFeatures(int mode) throws DataException
FeatureSet
.mode
- can be one of {MODE_QUERY, MODE_FULLEDIT, MODE_APPEND}DataException
boolean isAppendModeSupported()
void beginEditingGroup(String description) throws NeedEditingModeException
description
- Description of the editing group.NeedEditingModeException
void endEditingGroup() throws NeedEditingModeException
NeedEditingModeException
FeatureIndex createIndex(FeatureType featureType, String attributeName, String indexName) throws DataException
featureType
- The FeatureType to which the indexed attribute belongs.attributeName
- The name of the attributed to be indexedindexName
- The index nameFeatureIndex
FeatureIndexException
- if there is an error creating the indexDataException
FeatureIndex createIndex(String indexTypeName, FeatureType featureType, String attributeName, String indexName) throws DataException
indexTypeName
- the type of the index to be created. That name is
related to one of the registered index providersfeatureType
- The FeatureType to which the indexed attribute belongs.attributeName
- The name of the attributed to be indexedindexName
- The index nameFeatureIndex
FeatureIndexException
- if there is an error creating the indexDataException
FeatureIndex createIndex(FeatureType featureType, String attributeName, String indexName, Observer observer) throws DataException
Observer
parameter is provided to be
notified ( FeatureStoreNotification.INDEX_FILLING_SUCCESS
)
when the index has finished filling with data and is available to be
used.featureType
- The FeatureType to which the indexed attribute belongs.attributeName
- The name of the attributed to be indexedindexName
- The index nameobserver
- to notify to when the created index has finished filling
with data and is available to be used. The observer will
receive then a
FeatureStoreNotification.INDEX_FILLING_SUCCESS
notification, with the index object if it has finished
successfully, or a
FeatureStoreNotification.INDEX_FILLING_ERROR
notification with the exception object if there has been
any error in the process. Optional.FeatureIndex
FeatureIndexException
- if there is an error creating the indexDataException
FeatureStoreNotification.INDEX_FILLING_STARTED
,
FeatureStoreNotification.INDEX_FILLING_SUCCESS
,
FeatureStoreNotification.INDEX_FILLING_CANCELLED
,
FeatureStoreNotification.INDEX_FILLING_ERROR
FeatureIndex createIndex(String indexTypeName, FeatureType featureType, String attributeName, String indexName, Observer observer) throws DataException
Observer
parameter is provided to be
notified ( FeatureStoreNotification.INDEX_FILLING_SUCCESS
)
when the index has finished filling with data and is available to be
used.indexTypeName
- the type of the index to be created. That name is
related to one of the registered index providersfeatureType
- The FeatureType to which the indexed attribute belongs.attributeName
- The name of the attributed to be indexedindexName
- The index nameobserver
- to notify to when the created index has finished filling
with data and is available to be used. The observer will
receive then a
FeatureStoreNotification.INDEX_FILLING_SUCCESS
notification, with the index object if it has finished
successfully, or a
FeatureStoreNotification.INDEX_FILLING_ERROR
notification with the exception object if there has been
any error in the process. Optional.FeatureIndex
FeatureIndexException
- if there is an error creating the indexDataException
FeatureStoreNotification.INDEX_FILLING_STARTED
,
FeatureStoreNotification.INDEX_FILLING_SUCCESS
,
FeatureStoreNotification.INDEX_FILLING_CANCELLED
,
FeatureStoreNotification.INDEX_FILLING_ERROR
FeatureIndexes getIndexes()
void setSelection(FeatureSet selection) throws DataException
FeatureSet
selection
- A FeatureSet
with the requested selectionDataException
FeatureSelection createFeatureSelection() throws DataException
FeatureSelection
FeatureSelection
DataException
FeatureSelection getFeatureSelection() throws DataException
FeatureSelection
.
Create a empty selection if not exits.
Manage of the selection can be slow on some data sources.
Use with care.
In data sources that do not support position access to records,
it may be slow to retrieve items from the selection. In some data
sources it may be necessary to access to this to retrieve each
item in the selection.FeatureSelection
.DataException
boolean isLocksSupported()
FeatureLocks getLocks() throws DataException
DataException
FeatureStoreTransforms getTransforms()
FeatureQuery createFeatureQuery()
FeatureQuery
associated to this store.FeatureQuery
associated to this store.long getFeatureCount() throws DataException
DataException
boolean isKnownEnvelope()
FeatureStoreProvider#getEnvelope()
method doesn't return
the full envelope.boolean hasRetrievedFeaturesLimit()
int getRetrievedFeaturesLimit()
FeatureStoreProvider#hasRetrievedFeaturesLimit()
returns
true,
it returns the limit of features retrieved from the provider.Feature getFeature(DynObject dynobject)
dynobject
- Iterator iterator()
ExpressionBuilder createExpressionBuilder()
ExpressionBuilder createExpression()
void createCache(String name, DynObject parameters) throws DataException
DataException
FeatureCache getCache()
boolean isBroken()
Throwable getBreakingsCause()
SpatialIndex wrapSpatialIndex(SpatialIndex index)
index
-