Class JMapServerDataManager
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataManagerCallback
(JMapServerDataManagerCallback callbackListener) Adds a JMapServerDataManagerCallback to this JMapServerDataManager.void
void
Adds a new datasource in the data manager.void
addDataSource
(SpatialDataSourceInfo dataSourceInfo) Adds a new spatial data source in the data manager.addElements
(JMapServerProject project, JMapServerVectorLayer vectorLayer, EditionTransaction.Insert transaction) addElements
(JMapServerProject project, JMapServerVectorLayer vectorLayer, EditionTransaction.Insert transaction, Projection currentProjection) void
cancelDataSourceJob
(int dataSourceId) void
cancelServerLayerJob
(int projetId, int layerId) boolean
containsDataSource
(int dataSourceId) Checks if the data manager contains a certain data source.void
createIndex
(int dataSourceId, String[] fields) Creates an index to improve query efficiency on the corresponding field.protected void
Returns an unmodifiable iterator of all spatial data sources.boolean
Deletes all spatial data sources.boolean
deleteDataSource
(int dataSourceId) Deletes the specified spatial data source.deleteElements
(JMapServerProject project, JMapServerVectorLayer vectorLayer, EditionTransaction.Delete transaction) boolean
deleteIndex
(int dataSourceId, String[] fields) Deletes an existing index.void
dropOldJMapServerTables
(Connection conn, String schema) EditionResult[][]
editElements
(JMapServerProject serverProject, JMapServerVectorLayer serverVectorLayer, EditionTransaction[] transactions, Projection projection) void
estimateLayerTiling
(JMapServerProject project, JMapServerVectorLayer serverVectorLayer, boolean launchCachingJob) extractAttributes
(JMapServerProject project, JMapServerVectorLayer vectorLayer, QueryFilter[] queryFilters, Attribute[] attributes, Map<String, ?> extraParameters) This method extracts attributes from a vector layer.extractElements
(JMapServerProject project, JMapServerVectorLayer vectorLayer, long[] elementIds) extractElements
(JMapServerProject project, JMapServerVectorLayer vectorLayer, long[] elementIds, Projection projection) extractElements
(JMapServerProject project, JMapServerVectorLayer vectorLayer, QueryFilter[] queryFilters, Attribute[] attributes) extractElements
(JMapServerProject project, JMapServerVectorLayer vectorLayer, QueryFilter[] queryFilters, Attribute[] attributes, Projection projection) This method extracts JMapGeoElement objects from a vector layer.extractElements
(JMapServerProject serverProject, JMapServerVectorLayer serverVectorLayer, QueryFilter[] queryFilters, Attribute[] attributes, Projection targetProjection, int pageSize, int offset) This method extracts JMapGeoElement objects from a vector layer.extractElements
(String query) This method extracts the JMapGeoElement objects that satisfy the specified pseudo-SQL query.extractElements
(String query, long[] jmapIds) This method extracts the K2DElement objects that satisfy the specified pseudo-SQL query.extractElements
(String query, long[] jmapIds, OrientedRectangle extent) This method extracts the K2DElement objects that satisfy the specified pseudo-SQL query.byte[]
extractRasterData
(RasterDataSource rasterDs, Rectangle bounds, Projection projection, int imageWidth, int imageHeight, RasterTransformationInfo[] trInfos, RasterParameters parameters) byte[]
extractRasterData
(JMapServerProject serverProject, JMapServerRasterLayer serverRasterLayer, Rectangle bounds, int imageWidth, int imageHeight, RasterTransformationInfo[] rasterTransformationInfos) Extracts raster data (images) from the specified raster layer enclosed in the specified project.Vector
<byte[]> extractTiles
(JMapServerProject project, JMapServerVectorLayer vectorLayer, int[] tiles) This method returns a Vector containing the requested tiles specified in parameter tiles.protected List
<byte[]> extractTilesFromCache
(JMapServerProject project, JMapServerVectorLayer vectorLayer, int[] tiles) WARNING!!! THIS METHOD FETCH TILE FROM CACHE ONLY! IT DOESN'T CREATE NEW TILES!!! THIS IS USED FOR DEBUGGING!void
fireDataSourceAddedEvent
(int dataSourceId) void
fireDataSourceDeletedEvent
(int dataSourceId) void
fireDataSourceExtractionCallback
(DataSourceExtractionEvent dataSourceExtractionEvent) fired before a data extraction takes place.void
fireDataSourceUpdatedEvent
(int dataSourceId) void
Removes all entries which were cached in the memory and the disk cache.void
flushCache
(int dataSourceId) Removes the cache data related to all layers based on the specified spatial data source id.void
flushCache
(int projectId, int layerId) Removes from all caches the data that matches the specified id.void
flushCache
(int projectId, int layerId, int tileId) Removes a specific tile from the cache.void
Flushes the disk cache.getDataSource
(int dataSourceId) Gets the spatial datasource having the specified id.getDataSource
(String name) Gets the spatial data source having the specified name.getDiskCacheMonitoringInfo
(int projectId, int layerId) getMemoryCacheMonitoringInfo
(int projectId, int layerId) getSpatialDatasourceTableName
(int dataSourceId) Returns the table name of the specified SpatialDatasource id.Job manager interface to add background job to data manager.boolean
indexExists
(int dataSourceId, String field) Checks if an index exist for the specified fieldspreProcessQuery
(String sqlQuery) void
removeDataManagerCallback
(JMapServerDataManagerCallback callbackListener) Removes the JMapServerDataManagerCallback from JMapServerDataManagervoid
void
updateCache
(JMapServerProject project, JMapServerLayer layer) void
updateDataSource
(SpatialDataSourceInfo dataSourceInfo) Updates the datasource.updateElements
(JMapServerProject project, JMapServerVectorLayer vectorLayer, EditionTransaction.Update transaction) updateElements
(JMapServerProject project, JMapServerVectorLayer vectorLayer, EditionTransaction.Update transaction, Projection currentProjection) void
updateStatistics
(JMapServerProject project, JMapServerLayer layer, Attribute[] attributes)
-
Method Details
-
createIndex
Creates an index to improve query efficiency on the corresponding field.- Parameters:
dataSourceId
- the data source unique id.fields
- the array string containing the fields to be indexed.
-
indexExists
Checks if an index exist for the specified fields- Parameters:
dataSourceId
- the data source unique id.field
- a field name.- Returns:
- true if the index already exists false otherwise.
-
deleteIndex
Deletes an existing index.- Parameters:
dataSourceId
- the data source unique id.fields
- the array string containing the specified fields.
-
containsDataSource
public boolean containsDataSource(int dataSourceId) Checks if the data manager contains a certain data source.- Parameters:
dataSourceId
- the data source unique id.- Returns:
- true if the data manager contains the data source, false otherwise.
-
getDataSource
Gets the spatial datasource having the specified id.- Parameters:
dataSourceId
- the data source unique id.- Returns:
- an instance of the SpatialDataSource having the corresponding id.
-
getDataSource
Gets the spatial data source having the specified name.- Parameters:
name
- the specified name.- Returns:
- an instance of the SpatialDataSource having the corresponding name.
-
dataSources
Returns an unmodifiable iterator of all spatial data sources.- Returns:
- an unmodifiable iterator of all spatial data sources.
-
deleteAllDataSources
public boolean deleteAllDataSources()Deletes all spatial data sources. -
dropOldJMapServerTables
-
createJMapServerTables
- Throws:
SQLException
-
deleteDataSource
public boolean deleteDataSource(int dataSourceId) Deletes the specified spatial data source.- Parameters:
dataSourceId
- the id of the spatial data source to be deleted.
-
flushCache
public void flushCache(int dataSourceId) Removes the cache data related to all layers based on the specified spatial data source id.- Parameters:
dataSourceId
- the spatial data source id
-
flushCache
public void flushCache(int projectId, int layerId) Removes from all caches the data that matches the specified id.- Parameters:
projectId
- the unique identifier of the project.layerId
- the layerId which data will be deleted.
-
flushCache
public void flushCache(int projectId, int layerId, int tileId) Removes a specific tile from the cache.- Parameters:
projectId
- the unique identifier of the project.layerId
- the unique identifier of the layer.tileId
- the tileId which data will be deleted.
-
cancelDataSourceJob
public void cancelDataSourceJob(int dataSourceId) -
cancelServerLayerJob
public void cancelServerLayerJob(int projetId, int layerId) -
getWorkerThreadManager
Job manager interface to add background job to data manager.- Returns:
- WorkerThreadManagerFacade
-
updateDataSource
Updates the datasource.- Parameters:
dataSourceInfo
- the corresponding JMapServerLayer instance.
-
updateStatistics
public void updateStatistics(JMapServerProject project, JMapServerLayer layer, Attribute[] attributes) -
updateCache
-
addDataSource
Adds a new spatial data source in the data manager. The new data source will not be updated until a call to method updateDataSource().- Parameters:
dataSourceInfo
- the corresponding spatial data source info instance.- Throws:
Exception
-
addDataSource
Adds a new datasource in the data manager. The new data source will not be indexed until a call to method updateDataSource().- Parameters:
ds
- the corresponding SpatialDataSource to be added.- Throws:
Exception
-
extractTiles
public Vector<byte[]> extractTiles(JMapServerProject project, JMapServerVectorLayer vectorLayer, int[] tiles) throws Exception This method returns a Vector containing the requested tiles specified in parameter tiles.- Parameters:
project
- the projectvectorLayer
- the vector layer info.tiles
- an array of tile id's.- Returns:
- a Vector containing serialized tiles, ordered exactly the same way they were requested.
- Throws:
Exception
-
extractTilesFromCache
protected List<byte[]> extractTilesFromCache(JMapServerProject project, JMapServerVectorLayer vectorLayer, int[] tiles) throws Exception WARNING!!! THIS METHOD FETCH TILE FROM CACHE ONLY! IT DOESN'T CREATE NEW TILES!!! THIS IS USED FOR DEBUGGING!- Parameters:
project
- the projectvectorLayer
- the vector layer info.tiles
- an array of tile id's.- Returns:
- a Vector containing serialized tiles, ordered exactly the same way they were requested.
- Throws:
Exception
-
flushCache
public void flushCache()Removes all entries which were cached in the memory and the disk cache. -
flushDiskCache
public void flushDiskCache()Flushes the disk cache. -
getSpatialDatasourceTableName
Returns the table name of the specified SpatialDatasource id.null
is returned if the SpatialDatasource is a ServerDataSource.- Parameters:
dataSourceId
- the data source unique id.- Returns:
- tableName;
null
if not found or if the SpatialDatasource is a ServerDataSource
-
preProcessQuery
-
extractAttributes
public DataSet extractAttributes(JMapServerProject project, JMapServerVectorLayer vectorLayer, QueryFilter[] queryFilters, Attribute[] attributes, Map<String, ?> extraParameters) throws ExceptionThis method extracts attributes from a vector layer. Only the elements that satisfy the specified query filters are returned. If the specified layer is not based on a spatial data source that is a subtype of SQLDataSource, SQL filters are ignored.- Parameters:
project
- The project enclosing the layer to queryvectorLayer
- The layer to queryqueryFilters
- the filters to applyattributes
- the list of attributes to return.extraParameters
- mapped parameters.- Returns:
- the extracted attributes
- Throws:
Exception
-
editElements
public EditionResult[][] editElements(JMapServerProject serverProject, JMapServerVectorLayer serverVectorLayer, EditionTransaction[] transactions, Projection projection) -
addElements
public EditionResult[] addElements(JMapServerProject project, JMapServerVectorLayer vectorLayer, EditionTransaction.Insert transaction, Projection currentProjection) -
addElements
public EditionResult[] addElements(JMapServerProject project, JMapServerVectorLayer vectorLayer, EditionTransaction.Insert transaction) -
updateElements
public EditionResult[] updateElements(JMapServerProject project, JMapServerVectorLayer vectorLayer, EditionTransaction.Update transaction, Projection currentProjection) -
updateElements
public EditionResult[] updateElements(JMapServerProject project, JMapServerVectorLayer vectorLayer, EditionTransaction.Update transaction) -
deleteElements
public EditionResult[] deleteElements(JMapServerProject project, JMapServerVectorLayer vectorLayer, EditionTransaction.Delete transaction) -
extractElements
public JMapGeoElement[] extractElements(JMapServerProject project, JMapServerVectorLayer vectorLayer, QueryFilter[] queryFilters, Attribute[] attributes, Projection projection) throws Exception This method extracts JMapGeoElement objects from a vector layer. Only the elements that satisfy the specified query filters are returned. If the specified layer is not based on a spatial data source that is a subtype of SQLDataSource, SQL filters are ignored.- Parameters:
project
- The project enclosing the layer to queryvectorLayer
- The layer to queryqueryFilters
- the filters to applyattributes
- the list of attributes to include in the returned elementsprojection
- the projection used to extract the element, if null project's projection is used- Returns:
- JMapGeoElement[] the extracted elements
- Throws:
Exception
-
extractElements
public JMapGeoElement[] extractElements(JMapServerProject serverProject, JMapServerVectorLayer serverVectorLayer, QueryFilter[] queryFilters, Attribute[] attributes, Projection targetProjection, int pageSize, int offset) throws Exception This method extracts JMapGeoElement objects from a vector layer. Only the elements that satisfy the specified query filters are returned. If the specified layer is not based on a spatial data source that is a subtype of SQLDataSource, SQL filters are ignored.- Parameters:
serverProject
- The project enclosing the layer to queryserverVectorLayer
- The layer to queryqueryFilters
- the filters to applyattributes
- the list of attributes to include in the returned elementstargetProjection
- the projection used to extract the element, if null project's projection is usedpageSize
- the maximum number of elements that will be returned (0 = no limit)offset
- the number of features to skip from the result set when extracting elements- Returns:
- JMapGeoElement[] the extracted elements
- Throws:
Exception
-
extractElements
public JMapGeoElement[] extractElements(JMapServerProject project, JMapServerVectorLayer vectorLayer, long[] elementIds) throws Exception - Throws:
Exception
-
extractElements
public JMapGeoElement[] extractElements(JMapServerProject project, JMapServerVectorLayer vectorLayer, long[] elementIds, Projection projection) throws Exception - Throws:
Exception
-
extractElements
public JMapGeoElement[] extractElements(JMapServerProject project, JMapServerVectorLayer vectorLayer, QueryFilter[] queryFilters, Attribute[] attributes) throws Exception - Throws:
Exception
-
extractElements
This method extracts the JMapGeoElement objects that satisfy the specified pseudo-SQL query.Syntax: select $element from $source{ $project{project name} $layer{layer name}} where ... select $element from $join{$source{$project{project name} $layer{layer name} $field{layer field name}} and $database{$name{database name} $query{select * from ...} $field{database field name}}}
The attributes included in the returned elements correspond to the list of bound attributes for the specified layer of the specified project.
- Parameters:
query
- the query to execute- Returns:
- JMapGeoElement[] the matching elements
- Throws:
Exception
-
extractElements
This method extracts the K2DElement objects that satisfy the specified pseudo-SQL query. Only the elements that have their id included in the specified list are returned.Syntax: select $element from $source{ $project{project name} $layer{layer name}} where ... select $element from $join{$source{$project{project name} $layer{layer name} $field{layer field name}} and $database{$name{database name} $query{select * from ...} $field{database field name}}}
The attributes included in the returned elements correspond to the list of bound attributes for the specified layer of the specified project.
- Parameters:
query
- the query to executejmapIds
- limit extraction to the specified element ids- Returns:
- JMapGeoElement[] the matching elements
- Throws:
Exception
-
extractElements
public JMapGeoElement[] extractElements(String query, long[] jmapIds, OrientedRectangle extent) throws Exception This method extracts the K2DElement objects that satisfy the specified pseudo-SQL query. Only the elements that have their id included in the specified list are returned.Syntax: select $element from $source{ $project{project name} $layer{layer name}} where ... select $element from $join{$source{$project{project name} $layer{layer name} $field{layer field name}} and $database{$name{database name} $query{select * from ...} $field{database field name}}}
The attributes included in the returned elements correspond to the list of bound attributes for the specified layer of the specified project.
- Parameters:
query
- the query to executejmapIds
- limit extraction to the specified element idsextent
- the extent to search into.- Returns:
- JMapGeoElement[] the matching elements
- Throws:
Exception
-
extractRasterData
public byte[] extractRasterData(RasterDataSource rasterDs, Rectangle bounds, Projection projection, int imageWidth, int imageHeight, RasterTransformationInfo[] trInfos, RasterParameters parameters) throws Exception - Throws:
Exception
-
extractRasterData
public byte[] extractRasterData(JMapServerProject serverProject, JMapServerRasterLayer serverRasterLayer, Rectangle bounds, int imageWidth, int imageHeight, RasterTransformationInfo[] rasterTransformationInfos) throws Exception Extracts raster data (images) from the specified raster layer enclosed in the specified project. The returned image covers the specified bounds in world coordinates and has the specified width and height. The image is returned as a byte array and is encoded as specified in the raster layer parameters.- Parameters:
serverProject
- The project enclosing the specified raster layerserverRasterLayer
- The raster layer to querybounds
- The world coordinate bounds (in project 'map projection') of the image to produceimageWidth
- The width of the image (pixels)imageHeight
- The height of the image (pixels)- Throws:
Exception
-
getDiskCacheMonitoringInfo
-
getMemoryCacheMonitoringInfo
-
getDiskCacheMonitoringInfo
-
getMemoryCacheMonitoringInfo
-
estimateLayerTiling
public void estimateLayerTiling(JMapServerProject project, JMapServerVectorLayer serverVectorLayer, boolean launchCachingJob) -
addDataManagerEventListener
-
removeDataManagerEventListener
-
addDataManagerCallback
Adds a JMapServerDataManagerCallback to this JMapServerDataManager. A JMapServerDataManagerCallback can be used to listen to, for example, data extraction callbacks. The callback will contain the extraction event (DataSourceExtractionEvent) and this event's properties can be changed to alter the behavior or the extraction. For instance, adding or removing a Spatial or Attribute filter before the extraction actually takes place. -
removeDataManagerCallback
Removes the JMapServerDataManagerCallback from JMapServerDataManager -
fireDataSourceAddedEvent
public void fireDataSourceAddedEvent(int dataSourceId) -
fireDataSourceUpdatedEvent
public void fireDataSourceUpdatedEvent(int dataSourceId) -
fireDataSourceDeletedEvent
public void fireDataSourceDeletedEvent(int dataSourceId) -
fireDataSourceExtractionCallback
fired before a data extraction takes place. The DataSourceExtractionEvent's properties can be changed and the new properties will be used when extracting the data.
-