com.supermap.services
Class DataDownloadService
- java.lang.Object
-
- com.supermap.services.ServiceBase
-
- com.supermap.services.DataDownloadService
-
public class DataDownloadService extends ServiceBase
Data download class, used to download data from iServer to local host. Users need to set related callback setResponseCallback, which can get the operation result and server response, etc.
-
-
Constructor Summary
Constructors Constructor and Description DataDownloadService(java.lang.String url)
Create a new DataDownloadService object according to the given url.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
download(java.lang.String fullUrl, int fromIndex, int toIndex)
Gets the object set in the specified data service address.void
download(java.lang.String serviceName, java.lang.String datasourceName, java.lang.String datasetName, int fromIndex, int toIndex)
Download all object collection from iServer.void
downloadAll(java.lang.String fullUrl)
Gets the all object sets in the specified data service address.void
downloadAll(java.lang.String serviceName, java.lang.String datasourceName, java.lang.String datasetName)
Download all the object collection from iServer.void
downloadDataset(java.lang.String urlDataset, Datasource datasource)
Upload a dataset from the server (support point, line and region dataset), and there isn't a dataset with same name in local datasource.void
updateDataset(java.lang.String urlDataset, DatasetVector dataset)
Update local dataset from the server (support point, line and region dataset), and there isn't a dataset with same name in local datasource.-
Methods inherited from class com.supermap.services.ServiceBase
getResponseCallback, getUrl, setResponseCallback, setServerName, setUrl
-
-
-
-
Constructor Detail
-
DataDownloadService
public DataDownloadService(java.lang.String url)
Create a new DataDownloadService object according to the given url.- Parameters:
url
- specified url address.
-
-
Method Detail
-
downloadAll
public void downloadAll(java.lang.String serviceName, java.lang.String datasourceName, java.lang.String datasetName)
Download all the object collection from iServer.- Parameters:
serviceName
- service name.datasourceName
- datasource name.datasetName
- dataset name.- Example:
- The following codes show how to download the data from the server.
public void DownService() { //Example URL: http://192.168.170.59:8090/iserver/services/data-testmap/rest/data/datasources/testmap/datasets/point DataDownloadService downloadService = new DataDownloadService("http://192.168.170.59:8090"); String serviceName = "data-testmap/rest"; String datasourceName = "testmap"; String datasetName = "Rivers"; downloadService.setResponseCallback(new ResponseCallback() { @Override public void requestSuccess() { // TODO Auto-generated method stub System.out.println("Request Success"); } @Override public void requestFailed(String arg0) { // TODO Auto-generated method stub System.out.println("Request Failed"); } @Override public void receiveResponse(FeatureSet featureSet) { // TODO Auto-generated method stub System.out.println("Receive Response"); if (arg0 instanceof FeatureSet) { FeatureSet featureSet = (FeatureSet)arg0; featureSet.moveFirst(); while (!featureSet.isEOF()) { Geometry geo = featureSet.getGeometry(); if (geo == null) { featureSet.moveNext(); continue; } featureSet.moveNext(); } System.out.println("Feature count is " + featureSet.getFeatureCount()); } } } }); downloadService.download(serviceName, datasourceName, datasetName, 1, 15); }
-
download
public void download(java.lang.String serviceName, java.lang.String datasourceName, java.lang.String datasetName, int fromIndex, int toIndex)
Download all object collection from iServer.- Parameters:
serviceName
- service name.datasourceName
- datasource name.datasetName
- dataset name.fromIndex
- start subscript.toIndex
- end subscript.
-
download
public void download(java.lang.String fullUrl, int fromIndex, int toIndex)
Gets the object set in the specified data service address.- Parameters:
fullUrl
- The data service address. e.g., http://127.0.0.1:8090/iserver/services/data-China400/rest/data/datasources/China400/datasets/City_RfromIndex
- start subscript.toIndex
- end subscript.
-
downloadAll
public void downloadAll(java.lang.String fullUrl)
Gets the all object sets in the specified data service address.- Parameters:
fullUrl
- The data service address. e.g., http://127.0.0.1:8090/iserver/services/data-China400/rest/data/datasources/China400/datasets/City_R
-
downloadDataset
public void downloadDataset(java.lang.String urlDataset, Datasource datasource)
Upload a dataset from the server (support point, line and region dataset), and there isn't a dataset with same name in local datasource. It will create a attribute dataset both in local and server, which is used to record the situations that the downloaded dataset has been modified. The synchronization dataset name is "_Table". If failed to download, it will call the requestFaild () method in ResponseCallback; If successsful, it will call requestSuccess() method.- Parameters:
urlDataset
- The address of the dataset is on the server.datasource
- Local datasource.Notes: urlDataset example: http://192.168.0.131:8090/iserver/services/data-changchun/rest/data/datasources/Changchun/datasets/Edit_Line.
-
updateDataset
public void updateDataset(java.lang.String urlDataset, DatasetVector dataset)
Update local dataset from the server (support point, line and region dataset), and there isn't a dataset with same name in local datasource. It will create a attribute dataset both in local and server, If failed to update, it will call the requestFaild () method in ResponseCallback; If successsful, it will call requestSuccess() method.- Parameters:
urlDataset
- The address that dataset is on the server.dataset
- Local dataset.Notes: urlDataset example: http://192.168.0.131:8090/iserver/services/data-changchun/rest/data/datasources/Changchun/datasets/Edit_Line.
-
-