Class PostgreServerHandler
java.lang.Object
com.kheops.jmap.server.datasources.egdb.EgdbHandler
com.kheops.jmap.server.datasources.egdb.PostgreServerHandler
Implements all needed methods to handle an Postgre database.
-
Field Summary
Fields inherited from class com.kheops.jmap.server.datasources.egdb.EgdbHandler
requestFID, requestOID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendAttributeFilter(AttributeFilter filter, StringBuffer filterBuffer) Append to the filter buffer a new condition using the attribute's name and attribute's value.voidappendGeometryTypesFilter(GeometryTypesFilter filter, StringBuffer filterBuffer) Append to the filter buffer a new condition using the geometry type.voidappendSpatialFilter(SpatialQueryFilter filter, StringBuffer filterBuffer) Append to the filter buffer a new condition using the method to determine relationship between geometries.voidappendSqlFilter(SQLQueryFilter filter, StringBuffer queryBuffer, StringBuffer orderByBuffer) Append to the filter buffer a new condition using the boundaries.buildGeometrySelectStatement(Attribute[] attributes) Build the select statement for geometry storage type.Method to decode a geometryvoiddetermineBinaryInformation(EgdbFeatureConfig featureConfig) Set feature geometry table, indexes and spatial column name where the geometry is stored.Method to encode a JMap geometryintExtract the srid form the spatial reference tableprotected StringFor versioned layer, this method establishes the restriction to exclude elements that have been removed.intgetAttributeCount(String attributeName, String queryFilter) Method for attribute statistics.Domain[]Return the available coded value domains if they exist, otherwise return an empty array.Gets the geometry type name of the layer: ST_POINT, ST_POLYGON,...String[]Get all available name of the existing layersDomain[]Return the available range domains if they exist, otherwise return and empty array All available domains will be returned even if they are used or notMethod to return the definition of the all columns of the ESRI Data base.protected StringgetDbInstance(String urlConnection) To return the instance's name of the ESRI databaseReturn an String with the defaults storage type inside the DBTUNE table.The name of Delta table A (adds)The name of Delta table D (deletes)intReturn the total amount of spatial elementsgetFeatureExtent(String queryFilter) Return the extend of the filtered features when the storage type is SDEBINAY and as consequence a feature table must existsProperties of the feature falseX, falseY, minX, minY, maxX, maxY, gSize, xyUnits, dbNameReturn the name of the feature tablegetGeometryExtent(String filter) Return the extend of the filtered features when the storage type is GEOMETRYTo get the geometry column name of the layer.When the storage type is binary then the spatial data is saved in the feature table and its attributes remain in the base table.getGeometryStorageType(String key_config) To get the name of the geometry identifier column name.Return the name of the table which register the last object id value of the layer.Return the name of the spatial index tableintgetJMapAvailableGeometryType(String geometryType) Gets the JMap geometry type of the layerReturn a String with the layer configuration keyword that was specified when the layer was created e.g.intgetLayerGeometryTypeCode(Geometry geometry) Get the SDE geometry type code.intReturn the layer id from the layers tableintThis method is deprecated, use extractSridFromSpatialReference() instead Return the srid from sde_spatial_references table.longgetNextId(int requestId) Used during the insert transaction, to generate the identifier of the new record to insertgetNumericStats(String attributeName, String queryFilter) Calculate MIN, MAX, AVG, STDEV for numeric attributegetRelatedDomainName(String attributeName) Return the domain name related to an attribute if both are related.protected String[]Return an array with the names of the default systems tablesintReturn the identifier of the base table in the SDE_table_registry table.getUniqueValues(String attributeName, String queryFilter) Return the unique values to storing themReturn the version of the Enterprise GeoDataBase e.g 10.0.0 or 10.2.1protected StringFor versioned layer, this method establishes the restriction to exclude elements that have been removed or those elements that correspond to an old version.voidinsertElement(JMapGeoElement geoElement, EditionResult result, Attribute[] attributes) Execute the insertion of the new geoElement.booleanThe feature is versioned or notvoidloadRelationships(Attribute attribute) Find possible relationShips with the given attributeprocessDeleteStatement(long elementsIds) Delete elements from base table.processUpdateStatement(JMapGeoElement[] elements, Attribute[] attributes) Update elements for unversioned layers.processVersionedDeleteStatement(long elementsIds) Insert elements in delete delta tables.processVersionedUpdateStatement(JMapGeoElement[] elements, Attribute[] attributes) Update elements for versioned layers.setupQueryFilters(QueryFilter[] queryFilters) Build the SQL condition to apply the query filters.protected intConvert an EGDB domain type to SQL typeMethods inherited from class com.kheops.jmap.server.datasources.egdb.EgdbHandler
availableSchemaNames, buildBinarySqlQuery, buildGeometrySqlQuery, buildQuery, buildVersionedGeometrySqlQuery, bytesToHex, calculateGeometryArea, calculateGeometryLength, calculateNumOfPts, checkGeodatabaseFromSchema, convertCodedValues, convertComparisonClauses, databaseSchema, existsAdditionalSystemTables, extractAttributeName, extractAttributeValues, extractLayerGeometries, filterExcludeRemovedElementsFromBase, getAttributes, getAvailableDomains, getDefaultVersionState, getEgdbDataSourceInfo, getEgdbDialect, getElementsCount, getStorageType, getVersionedElements, isGeodatabase, queryStatesFromVersion, setEgdbDataSourceInfo, setEgdbDialect, systemSchema, updateEgdbDataSourceInfo
-
Constructor Details
-
PostgreServerHandler
-
-
Method Details
-
encode
Description copied from class:EgdbHandlerMethod to encode a JMap geometry- Specified by:
encodein classEgdbHandler- Throws:
SQLException
-
decode
Description copied from class:EgdbHandlerMethod to decode a geometry- Specified by:
decodein classEgdbHandler- Parameters:
spatialData- Spatial data to decodenumofpts- Valid for OGCWKB and SDEBINARY storage type. Useful only for SDEBINARY storage type. For the other storage type is null- Returns:
- The decoded JMap geometry
- Throws:
Exception
-
appendSqlFilter
public void appendSqlFilter(SQLQueryFilter filter, StringBuffer queryBuffer, StringBuffer orderByBuffer) throws Exception Description copied from class:EgdbHandlerAppend to the filter buffer a new condition using the boundaries.- Specified by:
appendSqlFilterin classEgdbHandler- Throws:
Exception
-
appendSpatialFilter
Description copied from class:EgdbHandlerAppend to the filter buffer a new condition using the method to determine relationship between geometries.- Specified by:
appendSpatialFilterin classEgdbHandler- Parameters:
filter- Spatial relationship method between geometries.filterBuffer- String buffer which value is the query which the filter is going to append
-
appendGeometryTypesFilter
Description copied from class:EgdbHandlerAppend to the filter buffer a new condition using the geometry type.- Specified by:
appendGeometryTypesFilterin classEgdbHandler- Parameters:
filter- Available geometry typefilterBuffer- String buffer which value is the query which the filter is going to append.
-
appendAttributeFilter
Description copied from class:EgdbHandlerAppend to the filter buffer a new condition using the attribute's name and attribute's value. The statement is build taking into account the attribute's value data type.- Specified by:
appendAttributeFilterin classEgdbHandler- Parameters:
filter- Attribute used in the condition.filterBuffer- String buffer which value is the query which the filter is going to append.
-
getIdColumn
Description copied from class:EgdbHandlerTo get the name of the geometry identifier column name.- Specified by:
getIdColumnin classEgdbHandler- Returns:
- The name of the ID column in the base table
- Throws:
SQLException
-
getGeometrySpatialColumn
Description copied from class:EgdbHandlerTo get the geometry column name of the layer.- Specified by:
getGeometrySpatialColumnin classEgdbHandler- Returns:
- The name of the Geometry column in the base table
- Throws:
Exception
-
getColumnDefinition
Description copied from class:EgdbHandlerMethod to return the definition of the all columns of the ESRI Data base. Every particular handler need to implement the way to get it. In the return array is included the OBJECT_ID and the SHAPE columns- Specified by:
getColumnDefinitionin classEgdbHandler- Throws:
SQLException
-
getVersion
Description copied from class:EgdbHandlerReturn the version of the Enterprise GeoDataBase e.g 10.0.0 or 10.2.1- Specified by:
getVersionin classEgdbHandler- Throws:
SQLException- Error occurred while retrieving the version of the Enterprise GeoDatabase
-
getLayerConfig
Description copied from class:EgdbHandlerReturn a String with the layer configuration keyword that was specified when the layer was created e.g. DEFAULTS, GEOMETRY, WKB_GEOMETRY. Other values need to be explored- Specified by:
getLayerConfigin classEgdbHandler- Throws:
SQLException- Error raised extracting the configuration of a layer
-
getDefaultsStorageType
Description copied from class:EgdbHandlerReturn an String with the defaults storage type inside the DBTUNE table. The result depends of the DBMS e.g. SQLServer: Geometry, Geography, SDEBinary, OGCWKB- Specified by:
getDefaultsStorageTypein classEgdbHandler- Throws:
SQLException- Error raised extracting the default storage type
-
getGeometryStorageType
- Specified by:
getGeometryStorageTypein classEgdbHandler- Throws:
SQLException- Error raised extracting the geometry storage type
-
getAvailableLayerNames
Description copied from class:EgdbHandlerGet all available name of the existing layers- Specified by:
getAvailableLayerNamesin classEgdbHandler- Throws:
SQLException
-
getDbInstance
Description copied from class:EgdbHandlerTo return the instance's name of the ESRI database- Specified by:
getDbInstancein classEgdbHandler
-
getLayerId
public int getLayerId()Description copied from class:EgdbHandlerReturn the layer id from the layers table- Specified by:
getLayerIdin classEgdbHandler
-
getFeatureTableName
Description copied from class:EgdbHandlerReturn the name of the feature table- Specified by:
getFeatureTableNamein classEgdbHandler
-
getIndexTableName
Description copied from class:EgdbHandlerReturn the name of the spatial index table- Specified by:
getIndexTableNamein classEgdbHandler
-
getDeltaTableAdds
Description copied from class:EgdbHandlerThe name of Delta table A (adds)- Specified by:
getDeltaTableAddsin classEgdbHandler- Throws:
SQLException
-
getDeltaTableDeletes
Description copied from class:EgdbHandlerThe name of Delta table D (deletes)- Specified by:
getDeltaTableDeletesin classEgdbHandler- Throws:
SQLException
-
getFeatureProperties
Description copied from class:EgdbHandlerProperties of the feature falseX, falseY, minX, minY, maxX, maxY, gSize, xyUnits, dbName- Specified by:
getFeaturePropertiesin classEgdbHandler- Throws:
SQLException- Raised when an exception occurs retrieving the properties of the feature
-
getAvailableCodedValueDomains
Description copied from class:EgdbHandlerReturn the available coded value domains if they exist, otherwise return an empty array. All available domains will be returned even if they are used or not- Specified by:
getAvailableCodedValueDomainsin classEgdbHandler- Throws:
Exception- Raised while loading the coded value domains
-
getAvailableRangeDomains
Description copied from class:EgdbHandlerReturn the available range domains if they exist, otherwise return and empty array All available domains will be returned even if they are used or not- Specified by:
getAvailableRangeDomainsin classEgdbHandler- Throws:
Exception- Raised while loading the range domains
-
getRelatedDomainName
Description copied from class:EgdbHandlerReturn the domain name related to an attribute if both are related. Otherwise return null- Specified by:
getRelatedDomainNamein classEgdbHandler- Throws:
SQLException
-
isVersioned
Description copied from class:EgdbHandlerThe feature is versioned or not- Specified by:
isVersionedin classEgdbHandler- Throws:
SQLException- raised while retrieving the definition column of the layer
-
setupQueryFilters
Description copied from class:EgdbHandlerBuild the SQL condition to apply the query filters. The method also reduce the search when storage type is SDEBinary- Specified by:
setupQueryFiltersin classEgdbHandler- Throws:
Exception
-
getAvailableGeometryType
Description copied from class:EgdbHandlerGets the geometry type name of the layer: ST_POINT, ST_POLYGON,...- Specified by:
getAvailableGeometryTypein classEgdbHandler- Returns:
- ST_GEOMETRY type
- Throws:
SQLException
-
getTableRegistryId
Description copied from class:EgdbHandlerReturn the identifier of the base table in the SDE_table_registry table. This identifier is used to find the delta tables when the layer is versioned- Specified by:
getTableRegistryIdin classEgdbHandler- Throws:
SQLException- Raised when an error occurs retrieving the registry id of the layer
-
getGeometrySpatialDataColumn
Description copied from class:EgdbHandlerWhen the storage type is binary then the spatial data is saved in the feature table and its attributes remain in the base table. So it is necessary to know where to look for the geometry spatial data to extract the layer's elements.- Specified by:
getGeometrySpatialDataColumnin classEgdbHandler- Throws:
SQLException
-
getFeatureExtent
Description copied from class:EgdbHandlerReturn the extend of the filtered features when the storage type is SDEBINAY and as consequence a feature table must exists- Specified by:
getFeatureExtentin classEgdbHandler
-
getJMapAvailableGeometryType
Description copied from class:EgdbHandlerGets the JMap geometry type of the layer- Specified by:
getJMapAvailableGeometryTypein classEgdbHandler- Returns:
- ST_GEOMETRY type
-
getAttributeCount
Description copied from class:EgdbHandlerMethod for attribute statistics. Calculate the distinct count of a attribute- Specified by:
getAttributeCountin classEgdbHandler- Throws:
Exception
-
getUniqueValues
public Hashtable<Object,Object> getUniqueValues(String attributeName, String queryFilter) throws Exception Description copied from class:EgdbHandlerReturn the unique values to storing them- Specified by:
getUniqueValuesin classEgdbHandler- Throws:
Exception
-
getNumericStats
Description copied from class:EgdbHandlerCalculate MIN, MAX, AVG, STDEV for numeric attribute- Specified by:
getNumericStatsin classEgdbHandler- Throws:
Exception
-
getElementCount
Description copied from class:EgdbHandlerReturn the total amount of spatial elements- Specified by:
getElementCountin classEgdbHandler- Throws:
SQLException
-
getSystemTables
Description copied from class:EgdbHandlerReturn an array with the names of the default systems tables- Specified by:
getSystemTablesin classEgdbHandler
-
determineBinaryInformation
Description copied from class:EgdbHandlerSet feature geometry table, indexes and spatial column name where the geometry is stored.- Specified by:
determineBinaryInformationin classEgdbHandler- Throws:
SQLException- Raised when an error occurs extracting feature geometry table, indexes or spatial column name
-
extractSridFromSpatialReference
Description copied from class:EgdbHandlerExtract the srid form the spatial reference table- Specified by:
extractSridFromSpatialReferencein classEgdbHandler- Throws:
SQLException- Error occurred while retrieving the srid of the layer
-
getLayerSrid
Description copied from class:EgdbHandlerThis method is deprecated, use extractSridFromSpatialReference() instead Return the srid from sde_spatial_references table. This value is used to work with SQLServer geo-database to extract and insert elements- Specified by:
getLayerSridin classEgdbHandler- Throws:
Exception
-
getGeometryExtent
Description copied from class:EgdbHandlerReturn the extend of the filtered features when the storage type is GEOMETRY- Specified by:
getGeometryExtentin classEgdbHandler- Throws:
Exception
-
insertElement
public void insertElement(JMapGeoElement geoElement, EditionResult result, Attribute[] attributes) throws Exception Description copied from class:EgdbHandlerExecute the insertion of the new geoElement. Prepare insertion query statement.- Specified by:
insertElementin classEgdbHandler- Parameters:
geoElement- New element to be insertedresult- Out parameter with the operation's result- Throws:
Exception
-
getIdentifierManagerTableName
Description copied from class:EgdbHandlerReturn the name of the table which register the last object id value of the layer. This name is useful to identify the store procedure's name to execute and return the next objectId value. This value is going to be use into an insert statement.- Specified by:
getIdentifierManagerTableNamein classEgdbHandler- Throws:
SQLException
-
getNextId
Description copied from class:EgdbHandlerUsed during the insert transaction, to generate the identifier of the new record to insert- Specified by:
getNextIdin classEgdbHandler- Returns:
- The next ID available or 0 if none exists
- Throws:
Exception
-
processDeleteStatement
Description copied from class:EgdbHandlerDelete elements from base table. This method is used to delete element for unversioned layers- Specified by:
processDeleteStatementin classEgdbHandler
-
processVersionedDeleteStatement
Description copied from class:EgdbHandlerInsert elements in delete delta tables. This method is used to delete elements for versioned layers.- Specified by:
processVersionedDeleteStatementin classEgdbHandler- Throws:
Exception
-
processUpdateStatement
Description copied from class:EgdbHandlerUpdate elements for unversioned layers.- Specified by:
processUpdateStatementin classEgdbHandler
-
processVersionedUpdateStatement
public EditionResult[] processVersionedUpdateStatement(JMapGeoElement[] elements, Attribute[] attributes) throws Exception Description copied from class:EgdbHandlerUpdate elements for versioned layers.- Specified by:
processVersionedUpdateStatementin classEgdbHandler- Throws:
Exception
-
getLayerGeometryTypeCode
Description copied from class:EgdbHandlerGet the SDE geometry type code. This is the code inserted in entity column when a geometry is inserted in F# table. POINT_SHAPE 1 LINE_SHAPE 2 AREA_SHAPE 8- Specified by:
getLayerGeometryTypeCodein classEgdbHandler
-
toSqlType
Description copied from class:EgdbHandlerConvert an EGDB domain type to SQL type- Specified by:
toSqlTypein classEgdbHandler
-
loadRelationships
Description copied from class:EgdbHandlerFind possible relationShips with the given attribute- Specified by:
loadRelationshipsin classEgdbHandler- Throws:
SQLException
-
buildGeometrySelectStatement
Description copied from class:EgdbHandlerBuild the select statement for geometry storage type.- Specified by:
buildGeometrySelectStatementin classEgdbHandler
-
getVersionedElements10
Description copied from class:EgdbHandlerFor versioned layer, this method establishes the restriction to exclude elements that have been removed or those elements that correspond to an old version. Elements from delta table 'A' which are in delta table 'D' are not included in the result. This method may change depending on DMBS because it call the function SDE_get_view_state() included on ArcGIS 10.x- Specified by:
getVersionedElements10in classEgdbHandler- Returns:
- Sql query to be used into a sql condition.
-
filterExcludeRemovedElementsFromBase10
Description copied from class:EgdbHandlerFor versioned layer, this method establishes the restriction to exclude elements that have been removed. Elements from base table which are in delta table 'D' are not included in the result. This method may change depending on DMBS because it call the function SDE_get_view_state() included on ArcGIS 10.x- Specified by:
filterExcludeRemovedElementsFromBase10in classEgdbHandler- Returns:
- Sql query to be used into a sql condition.
- Throws:
SQLException
-