public class RestDataProvider extends RestProviderBase implements ProviderContextAware, DataProvider
REST data service provider.
RESTDataProvider provides services for getting SuperMap iServer data from the REST services and encapsulates GIS functionalities related to SuperMap iServer data.
RestProviderBase.CacheModel, RestProviderBase.RestRequestException
JAVA_POSTFIX, javaConverter, JSON_POSTFIX, jsonConverter, jsonDecoder, lock, logger, message
Constructor and Description |
---|
RestDataProvider()
The constructor.
|
RestDataProvider(RestDataProviderSetting setting)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
EditResult |
addFeatures(java.lang.String datasourceName, java.lang.String datasetName, java.util.List<Feature> targetFeatures)
Adds a set of features of the same type to a specified dataset.
|
boolean |
clearFeatures(java.lang.String datasourceName, java.lang.String datasetName)
Clears the features in a specified dataset.
|
boolean |
containsDataset(java.lang.String datasourceName, java.lang.String datasetName)
Determines whether a specified datasource contains a specified dataset.
|
boolean |
copyDataset(java.lang.String srcDatasourceName, java.lang.String srcDatasetName, java.lang.String destDatasourceName, java.lang.String destDatasetName)
Copies a replication of a specified dataset.
|
boolean |
createDataset(java.lang.String datasourceName, DatasetInfo datasetInfo)
Creates a new dataset in a specified datasource according to the dataset information.
|
boolean |
deleteDataset(java.lang.String datasourceName, java.lang.String datasetName)
Removes the specified dataset in the specified datasource.
|
EditResult |
deleteFeatures(java.lang.String datasourceName, QueryParameter parameters)
Specifies the data source to remove the feature via sql.
|
EditResult |
deleteFeatures(java.lang.String datasourceName, java.lang.String datasetName, int[] ids)
Deletes features from a specified dataset.
|
void |
dispose()
Release the resource object.
|
DatasetInfo |
getDatasetInfo(java.lang.String datasourceName, java.lang.String datasetName)
Gets the information of a specified dataset in a given datasource.
|
java.util.List<DatasetInfo> |
getDatasetInfos(java.lang.String datasourceName)
Gets information about all the datasets in a specified datasource.
|
java.util.List<java.lang.String> |
getDatasetNames(java.lang.String datasourceName)
Gets all dataset names for the current data source.
|
DatasourceInfo |
getDatasourceInfo(java.lang.String datasourceName)
Gets information about a specified datasource.
|
java.util.List<DatasourceInfo> |
getDatasourceInfos()
Gets information about all the datasources corresponding to the current data service provider.
|
java.util.List<DomainInfo> |
getDomainInfos(java.lang.String datasourceName, java.lang.String datasetName)
Gets the domain info of the specified dataset.
|
GetFeatureResult |
getFeature(GetFeatureParameters parameters)
Query and return the feature results.
|
java.util.List<Feature> |
getFeature(java.lang.String datasourceName, QueryParameter queryParam)
Gets features by a SQL query condition.
|
java.util.List<Feature> |
getFeature(java.lang.String datasourceName, QueryParameter queryParam, int maxFeatures)
Gets features by a SQL query condition.
|
java.util.List<Feature> |
getFeature(java.lang.String datasourceName, QueryParameter queryParam, int maxFeatures, int fromIndex, int toIndex) |
java.util.List<Feature> |
getFeature(java.lang.String datasourceName, java.lang.String datasetName, Geometry geometry, double distance, java.lang.String attributeFilter, java.lang.String[] fields)
Gets the features that fall within a buffer of a specified geometric object and meet a certain attribute filter condition.
|
java.util.List<Feature> |
getFeature(java.lang.String datasourceName, java.lang.String datasetName, Geometry geometry, SpatialQueryMode spatialQueryMode, java.lang.String attributeFilter, java.lang.String[] fields)
Gets the features that satisfy certain spatial query mode on a specified geometric object and meet a certain attribute filter condition.
|
java.util.List<Feature> |
getFeature(java.lang.String datasourceName, java.lang.String datasetName, int[] ids, java.lang.String[] fields)
Gets features with specified IDs in a specified dataset.
|
java.util.List<Feature> |
getFeature(java.lang.String datasourceName, java.lang.String datasetName, int[] ids, java.lang.String[] fields, int fromIndex, int toIndex)
Gets the feature in the specified data set according to the specified feature ID in the way of supporting paging.
|
java.util.List<Feature> |
getFeature(java.lang.String datasourceName, java.lang.String datasetName, Rectangle2D bounds, java.lang.String attributeFilter, java.lang.String[] fields)
Gets the features that fall within a specified space and meet a certain attribute filter condition.
|
java.util.List<FieldInfo> |
getFieldInfos(java.lang.String datasourceName, java.lang.String datasetName)
Get all the field info of the specified dataset.
|
protected RestProviderSetting |
getRestProviderSetting()
Return the rest service provider configuration information.
|
boolean |
renameDataset(java.lang.String datasourceName, java.lang.String oldName, java.lang.String newName)
Modifies the name of a specified dataset.
|
protected java.lang.String |
sendAddFeaturesRequest(java.lang.String url, java.util.List<Feature> targetFeatures) |
protected void |
sendCopyDatasetRequest(java.lang.String connection, java.lang.String srcDatasourceName, java.lang.String srcDatasetName, java.lang.String destDatasetName) |
protected java.lang.String |
sendCreateDatasetRequest(java.lang.String createDatasetUrl, DatasetInfo datasetInfo) |
protected void |
sendDeleteDatasetRequest(java.lang.String url) |
protected void |
sendDeleteFeaturesRequest(java.lang.String url) |
protected java.lang.String |
sendDeleteFeaturesRequest(java.lang.String url, java.lang.String text)
Rewrites the sendDeleteFeaturesRequest method, using POST method to simulate DELET to solve the problem calling clearFeature interface wrongly.
|
protected void |
sendGetupdateDatasetInfoRequest(java.lang.String url) |
protected void |
sendupdateDatasetInfoRequest(java.lang.String url, DatasetInfo newDatasetInfo) |
protected void |
sendupdateDatasourceInfoRequest(java.lang.String url, DatasourceInfo newDatasourceInfo) |
protected void |
sendUpdateFeaturesRequest(java.lang.String url, java.util.List<Feature> targetFeatures) |
void |
setProviderContext(ProviderContext context)
Sets the service provider context
|
double |
statistic(java.lang.String datasourceName, java.lang.String datasetName, int fieldIndex, StatisticMode statisticMode)
Calculates statistics on a specified field of a dataset based on a specified statistical mode.
|
double |
statistic(java.lang.String datasourceName, java.lang.String datasetName, java.lang.String fieldName, StatisticMode statisticMode)
Calculates statistics on a specified field of a dataset based on a specified statistical mode.
|
void |
updateDatasetInfo(java.lang.String datasourceName, java.lang.String datasetName, DatasetInfo newDatasetInfo)
Updates information about a specified dataset in a given datasource.
|
void |
updateDatasourceInfo(java.lang.String datasourceName, DatasourceInfo newDatasourceInfo)
Updates the original datasource info with new datasource info.
|
EditResult |
updateFeatures(java.lang.String datasourceName, java.lang.String datasetName, java.util.List<Feature> targetFeatures)
Updates features in a specified dataset.
|
void |
updateFieldInfos(java.lang.String datasourceName, java.lang.String datasetName, java.util.List<FieldInfo> newFieldInfos)
A field can be added, deleted, or modified by using this method.All the fields (except the SuperMap system fields) in a dataset are replaced with new fields.
|
clearCache, executeRequest, executeRequest, executeRequest, executeRequestForByteArray, executeRequestForByteArray, executeRequestForByteArray, executeRequestForByteArray, executeRequestForList, executeRequestForList, executeRequestForList, executeRequestForList, executeRequestForStream, executeRequestForStream, executeRequestForStream, executeRequestForText, executeRequestForText, executeRequestForText, handleExeption, init, newAndSetClient, rectifyRestServiceRootURL
public RestDataProvider(RestDataProviderSetting setting)
The constructor.
setting
- The parameter object for setting Rest data service provider.public RestDataProvider()
The constructor.
public void setProviderContext(ProviderContext context)
ProviderContextAware
Sets the service provider context
setProviderContext
in interface ProviderContextAware
context
- service provider contextpublic boolean createDataset(java.lang.String datasourceName, DatasetInfo datasetInfo)
Creates a new dataset in a specified datasource according to the dataset information.
createDataset
in interface DataProvider
datasourceName
- The list of datasource names.datasetInfo
- The dataset information.public boolean deleteDataset(java.lang.String datasourceName, java.lang.String datasetName)
Removes the specified dataset in the specified datasource.
deleteDataset
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.public boolean containsDataset(java.lang.String datasourceName, java.lang.String datasetName)
Determines whether a specified datasource contains a specified dataset.
containsDataset
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.public boolean renameDataset(java.lang.String datasourceName, java.lang.String oldName, java.lang.String newName)
Modifies the name of a specified dataset.
renameDataset
in interface DataProvider
datasourceName
- The list of datasource names.oldName
- The name of the dataset to be modified.newName
- New name.public boolean copyDataset(java.lang.String srcDatasourceName, java.lang.String srcDatasetName, java.lang.String destDatasourceName, java.lang.String destDatasetName)
Copies a replication of a specified dataset.
Copies a replication of a specified dataset from specified datasource to target datasource and saves it with a specified name.
copyDataset
in interface DataProvider
srcDatasourceName
- The name of the source datasource.srcDatasetName
- The name of the source dataset.destDatasourceName
- The target datasource name.destDatasetName
- The target dataset name.public EditResult addFeatures(java.lang.String datasourceName, java.lang.String datasetName, java.util.List<Feature> targetFeatures)
Adds a set of features of the same type to a specified dataset.
Every dataset in SuperMap has a type (DatasetType
). A dataset can be a point, a line, or a region dataset. The features in a dataset are of the same type with the dataset. For instance, the features stored in a point dataset must be point features. Therefore, a feature added to a dataset must be of the same type with that dataset.
addFeatures
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.targetFeatures
- The list of features to be added. The features must be of the same type.public EditResult deleteFeatures(java.lang.String datasourceName, java.lang.String datasetName, int[] ids)
Deletes features from a specified dataset.
deleteFeatures
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.ids
- The IDs of the features to be deleted.public java.util.List<Feature> getFeature(java.lang.String datasourceName, java.lang.String datasetName, Rectangle2D bounds, java.lang.String attributeFilter, java.lang.String[] fields)
Gets the features that fall within a specified space and meet a certain attribute filter condition.
getFeature
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.bounds
- The specified query bounds.attributeFilter
- The attribute filter condition. For example, fieldValue < 100, name like '%Hotel%'fields
- The array of fields to be returned. All the fields are returned if this parameter is null.public EditResult updateFeatures(java.lang.String datasourceName, java.lang.String datasetName, java.util.List<Feature> targetFeatures)
Updates features in a specified dataset.
targetFeatures is used to set the expected features after update, of which the IDs should be identical with the IDs of the features to be updated. The update process is finding out the feature to be updated with the ID from the targetFeatures first, then updating the source feature with the targetFeature.
updateFeatures
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.targetFeatures
- The list of new features whose IDs are the same with those of the features to be updated.public boolean clearFeatures(java.lang.String datasourceName, java.lang.String datasetName)
Clears the features in a specified dataset.
clearFeatures
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.public java.util.List<Feature> getFeature(java.lang.String datasourceName, java.lang.String datasetName, int[] ids, java.lang.String[] fields)
Gets features with specified IDs in a specified dataset.
getFeature
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.ids
- The feature IDs.fields
- The array of fields to be returned. All the fields are returned if this parameter is null.public java.util.List<Feature> getFeature(java.lang.String datasourceName, java.lang.String datasetName, Geometry geometry, double distance, java.lang.String attributeFilter, java.lang.String[] fields)
Gets the features that fall within a buffer of a specified geometric object and meet a certain attribute filter condition.
getFeature
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.geometry
- The geometric object.distance
- The radius of the buffer.attributeFilter
- The attribute filter condition. For example, fieldValue < 100, name like '%Hotel%'fields
- The array of fields to be returned. All the fields are returned if this parameter is null.public java.util.List<Feature> getFeature(java.lang.String datasourceName, java.lang.String datasetName, Geometry geometry, SpatialQueryMode spatialQueryMode, java.lang.String attributeFilter, java.lang.String[] fields)
Gets the features that satisfy certain spatial query mode on a specified geometric object and meet a certain attribute filter condition.
getFeature
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.geometry
- The geometric object.spatialQueryMode
- The spatial query mode.attributeFilter
- The attribute filter condition. For example, fieldValue < 100, name like '%Hotel%'fields
- The array of fields to be returned. All the fields are returned if this parameter is null.public java.util.List<Feature> getFeature(java.lang.String datasourceName, QueryParameter queryParam)
Gets features by a SQL query condition.
getFeature
in interface DataProvider
datasourceName
- The list of datasource names.queryParam
- Query parameter.public java.util.List<Feature> getFeature(java.lang.String datasourceName, QueryParameter queryParam, int maxFeatures)
Gets features by a SQL query condition.
getFeature
in interface DataProvider
datasourceName
- The list of datasource names.queryParam
- Query parameter.maxFeatures
- The maximum features to be returned.public java.util.List<Feature> getFeature(java.lang.String datasourceName, QueryParameter queryParam, int maxFeatures, int fromIndex, int toIndex)
public GetFeatureResult getFeature(GetFeatureParameters parameters)
DataProvider
Query and return the feature results.
getFeature
in interface DataProvider
parameters
- Is the encapsulation of other getFeature parameters.public java.util.List<DatasourceInfo> getDatasourceInfos()
Gets information about all the datasources corresponding to the current data service provider.
getDatasourceInfos
in interface DataProvider
public DatasourceInfo getDatasourceInfo(java.lang.String datasourceName)
Gets information about a specified datasource.
getDatasourceInfo
in interface DataProvider
datasourceName
- The list of datasource names.public void updateDatasourceInfo(java.lang.String datasourceName, DatasourceInfo newDatasourceInfo)
Updates the original datasource info with new datasource info.
updateDatasourceInfo
in interface DataProvider
datasourceName
- The list of datasource names.newDatasourceInfo
- The new datasource info.public java.util.List<DatasetInfo> getDatasetInfos(java.lang.String datasourceName)
Gets information about all the datasets in a specified datasource.
getDatasetInfos
in interface DataProvider
datasourceName
- The list of datasource names.public DatasetInfo getDatasetInfo(java.lang.String datasourceName, java.lang.String datasetName)
Gets the information of a specified dataset in a given datasource.
getDatasetInfo
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.public void updateDatasetInfo(java.lang.String datasourceName, java.lang.String datasetName, DatasetInfo newDatasetInfo)
Updates information about a specified dataset in a given datasource.
updateDatasetInfo
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The name of the dataset to be updated.newDatasetInfo
- The dataset information.public java.util.List<DomainInfo> getDomainInfos(java.lang.String datasourceName, java.lang.String datasetName)
Gets the domain info of the specified dataset.
getDomainInfos
in interface DataProvider
datasourceName
- The datasource name.datasetName
- The dataset name.public java.util.List<FieldInfo> getFieldInfos(java.lang.String datasourceName, java.lang.String datasetName)
Get all the field info of the specified dataset.
getFieldInfos
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.public void updateFieldInfos(java.lang.String datasourceName, java.lang.String datasetName, java.util.List<FieldInfo> newFieldInfos)
A field can be added, deleted, or modified by using this method.All the fields (except the SuperMap system fields) in a dataset are replaced with new fields.
If SuperMap data are used, the alias of the SuperMap system fields cannot be updated.
updateFieldInfos
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.newFieldInfos
- The new field information. If SuperMap data are used, the SuperMap system fields cannot be included in this information list.public double statistic(java.lang.String datasourceName, java.lang.String datasetName, int fieldIndex, StatisticMode statisticMode)
Calculates statistics on a specified field of a dataset based on a specified statistical mode.
statistic
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.fieldIndex
- The field index.statisticMode
- The statistical mode.public double statistic(java.lang.String datasourceName, java.lang.String datasetName, java.lang.String fieldName, StatisticMode statisticMode)
Calculates statistics on a specified field of a dataset based on a specified statistical mode.
statistic
in interface DataProvider
datasourceName
- The list of datasource names.datasetName
- The dataset name.fieldName
- The name of the specified field.statisticMode
- The statistical mode.public void dispose()
Disposable
Release the resource object.
dispose
in interface Disposable
dispose
in class RestProviderBase
protected RestProviderSetting getRestProviderSetting()
RestProviderBase
getRestProviderSetting
in class RestProviderBase
protected java.lang.String sendCreateDatasetRequest(java.lang.String createDatasetUrl, DatasetInfo datasetInfo)
protected void sendDeleteDatasetRequest(java.lang.String url)
protected void sendCopyDatasetRequest(java.lang.String connection, java.lang.String srcDatasourceName, java.lang.String srcDatasetName, java.lang.String destDatasetName)
protected java.lang.String sendAddFeaturesRequest(java.lang.String url, java.util.List<Feature> targetFeatures)
protected void sendDeleteFeaturesRequest(java.lang.String url)
protected java.lang.String sendDeleteFeaturesRequest(java.lang.String url, java.lang.String text)
protected void sendUpdateFeaturesRequest(java.lang.String url, java.util.List<Feature> targetFeatures)
protected void sendupdateDatasourceInfoRequest(java.lang.String url, DatasourceInfo newDatasourceInfo)
protected void sendGetupdateDatasetInfoRequest(java.lang.String url)
protected void sendupdateDatasetInfoRequest(java.lang.String url, DatasetInfo newDatasetInfo)
public EditResult deleteFeatures(java.lang.String datasourceName, QueryParameter parameters)
DataProvider
Specifies the data source to remove the feature via sql.
deleteFeatures
in interface DataProvider
datasourceName
- the name of the datasource.parameters
- Query parameter.public java.util.List<java.lang.String> getDatasetNames(java.lang.String datasourceName)
DataProvider
Gets all dataset names for the current data source.
getDatasetNames
in interface DataProvider
datasourceName
- the data source name.public java.util.List<Feature> getFeature(java.lang.String datasourceName, java.lang.String datasetName, int[] ids, java.lang.String[] fields, int fromIndex, int toIndex)
DataProvider
Gets the feature in the specified data set according to the specified feature ID in the way of supporting paging.
getFeature
in interface DataProvider
datasourceName
- the name of the datasource.datasetName
- the dataset name.ids
- Feature ID.fields
- An array of fields to be returned. When the parameter is null, all fields are returned.fromIndex
- The minimum index number for the result of the pagingtoIndex
- The maximum index number for the result of the paging