Java Doc for PostgisDataStore.java in  » GIS » GeoTools-2.4.1 » org » geotools » data » postgis » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.data.postgis 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.geotools.data.jdbc.JDBCDataStore
   org.geotools.data.postgis.PostgisDataStore

All known Subclasses:   org.geotools.data.postgis.WrappedPostgisDataStore,
PostgisDataStore
public class PostgisDataStore extends JDBCDataStore implements DataStore(Code)
Postgis DataStore implementation.

This datastore by default will read/write geometries in WKT format.
Optionally use of WKB can be turned on, in which case you may want to turn on also the use of the bytea function, that fasten the data trasfer, but that it's available only from version 0.7.2 onwards.


author:
   Chris Holmes, TOPP
author:
   Andrea Aime
author:
   Paolo Rizzi
version:
   $Id: PostgisDataStore.java 29506 2008-02-29 09:27:36Z aaime $


Field Summary
final protected static  LoggerLOGGER
     The logger for the postgis module.
public  intOPTIMIZE_MODE
    
final public static  intOPTIMIZE_SAFE
    
final public static  intOPTIMIZE_SQL
    
protected  booleanWKBEnabled
    
protected  booleanbyteaEnabled
    
protected  booleanbyteaWKB
     postgis 1.0 changed the way WKB is handled, this needs to be set if version >1.
protected  PostgisDBInfodbInfo
     PostGIS version information (persisted here so we don't have to keep asking the database what version it is, in perpituity.
protected  booleanestimatedExtent
     set to true if the bounds for a table should be computed using the estimated_extent' function, but beware that this function is less accurate and in some cases *far* less accurate if the data within the actual bounds does not follow a uniform distribution.
protected static  GeometryFactorygeometryFactory
     Factory for producing geometries (from JTS).
protected static  WKTReadergeometryReader
     Well Known Text reader (from JTS).
protected  booleanlooseBbox
     If true then the bounding box filters will use the && postgis operator, which uses the spatial index and performs against the envelope of the geom, leading to greater speed and slightly less accuracy.
protected  booleanschemaEnabled
    
protected  booleanuseGeos
    

Constructor Summary
protected  PostgisDataStore(DataSource dataSource)
    
protected  PostgisDataStore(DataSource dataSource, String namespace)
    
protected  PostgisDataStore(DataSource dataSource, String schema, String namespace)
    
protected  PostgisDataStore(DataSource dataSource, String schema, String namespace, int optimizeMode)
    
public  PostgisDataStore(DataSource dataSource, JDBCDataStoreConfig config, int optimizeMode)
    

Method Summary
protected  booleanallowTable(String tablename)
    
protected  String[]attributeNames(FeatureType featureType, Filter filter)
     Gets the list of attribute names required for both featureType and filter
Parameters:
  featureType - The FeatureType to get attribute names for.
Parameters:
  filter - The filter which needs attributes to filter.
protected  AttributeTypebuildAttributeType(ResultSet metadataRs)
     Constructs an AttributeType from a row in a ResultSet.
protected  FIDMapperbuildFIDMapper(String typeName, FIDMapperFactory factory)
    
protected  FIDMapperFactorybuildFIDMapperFactory(JDBCDataStoreConfig config)
    
protected  FeatureTypebuildSchema(String typeName, FIDMapper mapper)
     Override this method to perform a few permission checks before the super class has a chance to do its thing.
public  PostgisFeatureLockingcreateFeatureLockingInternal(PostgisDataStore ds, FeatureType type)
    
protected  JDBCFeatureWritercreateFeatureWriter(FeatureReader fReader, QueryData queryData)
    
protected  LockingManagercreateLockingManager()
     Allows subclass to create LockingManager to support their needs.
protected  PostgisSQLBuildercreateSQLBuilder()
    
public  voidcreateSchema(FeatureType featureType)
     Creates a FeatureType in this instance of the PostgisDataStore.
protected  intdetermineSRID(String tableName, String geometryColumnName)
    
protected  intgetConcurrency(boolean forWrite)
    
public  PostgisDBInfogetDBInfo()
     Obtains database specific information, such as version, supported functions, etc.
public  DataSourcegetDataSource()
     Obtains the postgis datastore connection pool.
public  EnvelopegetEnvelope(String typeName)
     Retrieve approx bounds of all Features.
public  FeatureReadergetFeatureReader(FeatureType requestType, Filter filter, Transaction transaction)
     This is a public entry point to the DataStore.
public  FeatureSourcegetFeatureSource(String typeName)
     Default implementation based on getFeatureReader and getFeatureWriter.
public  FeatureWritergetFeatureWriter(String typeName, Transaction transaction)
     Retrieve a FeatureWriter over entire dataset.
public  FeatureWritergetFeatureWriterAppend(String typeName, Transaction transaction)
     Retrieve a FeatureWriter for creating new content.

Subclass may wish to implement an optimized featureWriter for this operation.

 AttributeTypegetGeometryAttribute(String tableName, String columnName, boolean nillable)
     Returns an attribute type for a geometry column in a feature table.
protected  AttributeIOgetGeometryAttributeIO(AttributeType type, QueryData queryData)
    
public  intgetOptimizeMode()
    
protected  intgetResultSetType(boolean forWrite)
    
 intgetSRID(String typeName, String geomColName)
    
public  FeatureTypegetSchema(String arg0)
    
public  SQLBuildergetSqlBuilder(String typeName)
    
public  SetgetSupportedHints()
    
public  String[]getTypeNames()
    
protected  voidguessDataStoreOptions()
     Attempts to figure out some optimization options, based on some postgis metadata.
protected  voidinitBuilder(PostgisSQLBuilder builder)
    
public  booleanisByteaEnabled()
    
public  booleanisByteaWKB()
    
public  booleanisEstimatedExtent()
    
public  booleanisLooseBbox()
     Whether the bounding boxes issued against this postgis datastore are on the envelope of the geometry or the actual geometry.
public  booleanisWKBEnabled()
    
protected static  Stringschema(String schema)
     Simple helper method to ensure that a schema is always set.
public  voidsetByteaEnabled(boolean byteaEnabled)
     Enables the use of bytea function for WKB data transfer (will improve performance).
public  voidsetByteaWKB(boolean byteaWKB)
    
public  voidsetEstimatedExtent(boolean estimatedExtent)
     Enables the use of the 'estimated_extent' function for bounds computation.
public  voidsetLooseBbox(boolean isLooseBbox)
     Sets this postgis instance to use a less strict but faster bounding box query.
public  voidsetOptimizeMode(int mode)
     Sets the optimization mode for the datastore.
public  voidsetWKBEnabled(boolean enabled)
    
public  voidupdateSchema(String typeName, FeatureType featureType)
    

Field Detail
LOGGER
final protected static Logger LOGGER(Code)
The logger for the postgis module.



OPTIMIZE_MODE
public int OPTIMIZE_MODE(Code)
Current optimize mode PostgisDataStore.getOptimizeMode()



OPTIMIZE_SAFE
final public static int OPTIMIZE_SAFE(Code)
OPTIMIZE_MODE constants



OPTIMIZE_SQL
final public static int OPTIMIZE_SQL(Code)



WKBEnabled
protected boolean WKBEnabled(Code)
If true, WKB format is used instead of WKT



byteaEnabled
protected boolean byteaEnabled(Code)
If true, the bytea function will be used to optimize even further data loading when using WKB format



byteaWKB
protected boolean byteaWKB(Code)
postgis 1.0 changed the way WKB is handled, this needs to be set if version >1. (it affects the way you send WKB to the database)



dbInfo
protected PostgisDBInfo dbInfo(Code)
PostGIS version information (persisted here so we don't have to keep asking the database what version it is, in perpituity.



estimatedExtent
protected boolean estimatedExtent(Code)
set to true if the bounds for a table should be computed using the estimated_extent' function, but beware that this function is less accurate and in some cases *far* less accurate if the data within the actual bounds does not follow a uniform distribution.



geometryFactory
protected static GeometryFactory geometryFactory(Code)
Factory for producing geometries (from JTS).



geometryReader
protected static WKTReader geometryReader(Code)
Well Known Text reader (from JTS).



looseBbox
protected boolean looseBbox(Code)
If true then the bounding box filters will use the && postgis operator, which uses the spatial index and performs against the envelope of the geom, leading to greater speed and slightly less accuracy.



schemaEnabled
protected boolean schemaEnabled(Code)
Flag indicating whether schema support *



useGeos
protected boolean useGeos(Code)
Enables the use of geos operators




Constructor Detail
PostgisDataStore
protected PostgisDataStore(DataSource dataSource) throws IOException(Code)



PostgisDataStore
protected PostgisDataStore(DataSource dataSource, String namespace) throws IOException(Code)



PostgisDataStore
protected PostgisDataStore(DataSource dataSource, String schema, String namespace) throws IOException(Code)



PostgisDataStore
protected PostgisDataStore(DataSource dataSource, String schema, String namespace, int optimizeMode) throws IOException(Code)



PostgisDataStore
public PostgisDataStore(DataSource dataSource, JDBCDataStoreConfig config, int optimizeMode) throws IOException(Code)




Method Detail
allowTable
protected boolean allowTable(String tablename)(Code)



attributeNames
protected String[] attributeNames(FeatureType featureType, Filter filter) throws IOException(Code)
Gets the list of attribute names required for both featureType and filter
Parameters:
  featureType - The FeatureType to get attribute names for.
Parameters:
  filter - The filter which needs attributes to filter. The list of attribute names required by a filter.
throws:
  IOException - If we can't get the schema.



buildAttributeType
protected AttributeType buildAttributeType(ResultSet metadataRs) throws IOException(Code)
Constructs an AttributeType from a row in a ResultSet. The ResultSet contains the information retrieved by a call to getColumns() on the DatabaseMetaData object. This information can be used to construct an Attribute Type.

This implementation construct an AttributeType using the default JDBC type mappings defined in JDBCDataStore. These type mappings only handle native Java classes and SQL standard column types. If a geometry type is found then getGeometryAttribute is called.

Note: Overriding methods must never move the current row pointer in the result set.


Parameters:
  metadataRs - The ResultSet containing the result of aDatabaseMetaData.getColumns call. The AttributeType built from the ResultSet.
throws:
  IOException - If an error occurs processing the ResultSet.



buildFIDMapper
protected FIDMapper buildFIDMapper(String typeName, FIDMapperFactory factory) throws IOException(Code)



buildFIDMapperFactory
protected FIDMapperFactory buildFIDMapperFactory(JDBCDataStoreConfig config)(Code)

See Also:   org.geotools.data.jdbc.JDBCDataStore.buildFIDMapperFactory(org.geotools.data.jdbc.JDBCDataStoreConfig)



buildSchema
protected FeatureType buildSchema(String typeName, FIDMapper mapper) throws IOException(Code)
Override this method to perform a few permission checks before the super class has a chance to do its thing.



createFeatureLockingInternal
public PostgisFeatureLocking createFeatureLockingInternal(PostgisDataStore ds, FeatureType type) throws IOException(Code)



createFeatureWriter
protected JDBCFeatureWriter createFeatureWriter(FeatureReader fReader, QueryData queryData) throws IOException(Code)
DOCUMENT ME!
Parameters:
  fReader -
Parameters:
  queryData -
throws:
  IOException - DOCUMENT ME!



createLockingManager
protected LockingManager createLockingManager()(Code)
Allows subclass to create LockingManager to support their needs.



createSQLBuilder
protected PostgisSQLBuilder createSQLBuilder()(Code)
Creates a new sql builder for encoding raw sql statements;



createSchema
public void createSchema(FeatureType featureType) throws IOException(Code)
Creates a FeatureType in this instance of the PostgisDataStore. Since we don't yet know which attribute in the FeatureType is the primary key, we will create our own called "fid_tablename", which has its own sequence called "tablename_fid_seq". The user should not interact with this column, although its value will be the FID. This method currently assumes there are only 2 dimensions.
throws:
  IOException - if something goes horribly wrong or the table already exists
See Also:   org.geotools.data.DataStore.createSchema(org.geotools.feature.FeatureType)



determineSRID
protected int determineSRID(String tableName, String geometryColumnName) throws IOException(Code)
DOCUMENT ME!
Parameters:
  tableName -
Parameters:
  geometryColumnName -
throws:
  IOException - DOCUMENT ME!
throws:
  DataSourceException - DOCUMENT ME!



getConcurrency
protected int getConcurrency(boolean forWrite)(Code)



getDBInfo
public PostgisDBInfo getDBInfo()(Code)
Obtains database specific information, such as version, supported functions, etc.



getDataSource
public DataSource getDataSource()(Code)
Obtains the postgis datastore connection pool. ConnectionPool



getEnvelope
public Envelope getEnvelope(String typeName)(Code)
Retrieve approx bounds of all Features.

This result is suitable for a quick map display, illustrating the data. This value is often stored as metadata in databases such as oraclespatial.

null as a generic implementation is not provided.



getFeatureReader
public FeatureReader getFeatureReader(FeatureType requestType, Filter filter, Transaction transaction) throws IOException(Code)
This is a public entry point to the DataStore.

We have given some though to changing this api to be based on query.

Currently this is the only way to retype your features to different name spaces.

(non-Javadoc)
See Also:   org.geotools.data.DataStore.getFeatureReader(org.geotools.feature.FeatureTypeorg.geotools.filter.Filterorg.geotools.data.Transaction)



getFeatureSource
public FeatureSource getFeatureSource(String typeName) throws IOException(Code)
Default implementation based on getFeatureReader and getFeatureWriter.

We should be able to optimize this to only get the RowSet once


See Also:   org.geotools.data.DataStore.getFeatureSource(java.lang.String)



getFeatureWriter
public FeatureWriter getFeatureWriter(String typeName, Transaction transaction) throws IOException(Code)
Retrieve a FeatureWriter over entire dataset.

Quick notes: This FeatureWriter is often used to add new content, or perform summary calculations over the entire dataset.

Subclass may wish to implement an optimized featureWriter for these operations.

It should provide Feature for next() even when hasNext() is false.

Subclasses are responsible for checking with the lockingManger unless they are providing their own locking support.


Parameters:
  typeName -
Parameters:
  transaction -
throws:
  IOException -
See Also:   org.geotools.data.DataStore.getFeatureWriter(java.lang.Stringbooleanorg.geotools.data.Transaction)



getFeatureWriterAppend
public FeatureWriter getFeatureWriterAppend(String typeName, Transaction transaction) throws IOException(Code)
Retrieve a FeatureWriter for creating new content.

Subclass may wish to implement an optimized featureWriter for this operation. One based on prepared statements is a possibility, as we do not require a ResultSet.

To allow new content the FeatureWriter should provide Feature for next() even when hasNext() is false.

Subclasses are responsible for checking with the lockingManger unless they are providing their own locking support.


Parameters:
  typeName -
Parameters:
  transaction -
throws:
  IOException -
See Also:   org.geotools.data.DataStore.getFeatureWriter(java.lang.Stringbooleanorg.geotools.data.Transaction)



getGeometryAttribute
AttributeType getGeometryAttribute(String tableName, String columnName, boolean nillable) throws IOException(Code)
Returns an attribute type for a geometry column in a feature table.
Parameters:
  tableName - The feature table name.
Parameters:
  columnName - The geometry column name.
Parameters:
  nillable - Geometric attribute.
throws:
  IOException - DOCUMENT ME!



getGeometryAttributeIO
protected AttributeIO getGeometryAttributeIO(AttributeType type, QueryData queryData)(Code)

See Also:   org.geotools.data.jdbc.JDBCDataStore.getGeometryAttributeIO(org.geotools.feature.AttributeType)



getOptimizeMode
public int getOptimizeMode()(Code)



getResultSetType
protected int getResultSetType(boolean forWrite)(Code)



getSRID
int getSRID(String typeName, String geomColName) throws IOException(Code)



getSchema
public FeatureType getSchema(String arg0) throws IOException(Code)



getSqlBuilder
public SQLBuilder getSqlBuilder(String typeName) throws IOException(Code)
DOCUMENT ME!
Parameters:
  typeName - DOCUMENT ME!
throws:
  IOException - DOCUMENT ME!



getSupportedHints
public Set getSupportedHints()(Code)



getTypeNames
public String[] getTypeNames() throws IOException(Code)



guessDataStoreOptions
protected void guessDataStoreOptions() throws IOException(Code)
Attempts to figure out some optimization options, based on some postgis metadata. If the version is later than 0.7.2 then bytea will be used to read geometries if WKB is enabled. And it will read if GEOS is enabled from the version string as well.
throws:
  IOException -



initBuilder
protected void initBuilder(PostgisSQLBuilder builder)(Code)



isByteaEnabled
public boolean isByteaEnabled()(Code)
Returns true if the data store is using the bytea function to fasten WKB data transfer, false otherwise



isByteaWKB
public boolean isByteaWKB()(Code)



isEstimatedExtent
public boolean isEstimatedExtent()(Code)

See Also:    PostgisDataStore.setEstimatedExtent(boolean)
See Also:   .



isLooseBbox
public boolean isLooseBbox()(Code)
Whether the bounding boxes issued against this postgis datastore are on the envelope of the geometry or the actual geometry. true if the bounding box is 'loose', against theenvelope instead of the actual geometry.



isWKBEnabled
public boolean isWKBEnabled()(Code)
Returns true if the WKB format is used to transfer geometries, false otherwise



schema
protected static String schema(String schema)(Code)
Simple helper method to ensure that a schema is always set.



setByteaEnabled
public void setByteaEnabled(boolean byteaEnabled)(Code)
Enables the use of bytea function for WKB data transfer (will improve performance). Note this function need not be set by the programmer, as the datastore will use it to optimize performance whenever it can (when postGIS is 0.7.2 or later)
Parameters:
  byteaEnabled -



setByteaWKB
public void setByteaWKB(boolean byteaWKB)(Code)



setEstimatedExtent
public void setEstimatedExtent(boolean estimatedExtent)(Code)
Enables the use of the 'estimated_extent' function for bounds computation.

Beware that this function is an approximation and is dependent on the degree to with the data in the actual bounds follows a uniform distribution.




setLooseBbox
public void setLooseBbox(boolean isLooseBbox)(Code)
Sets this postgis instance to use a less strict but faster bounding box query. Setting this to true will have PostGIS issue bounding box queries against the envelope of the geometry, so some may be slighty wrong, but will perform much faster. The intersects function can still be used to obtain the exact query.
Parameters:
  isLooseBbox - true if this should have a loose Bbox.



setOptimizeMode
public void setOptimizeMode(int mode)(Code)
Sets the optimization mode for the datastore.
Parameters:
  mode - One of PostgisDataStore.OPTIMIZE_SAFE,PostgisDataStore.OPTIMIZE_SQL.



setWKBEnabled
public void setWKBEnabled(boolean enabled)(Code)
If turned on, WKB will be used to transfer geometry data instead of WKT
Parameters:
  enabled -



updateSchema
public void updateSchema(String typeName, FeatureType featureType) throws IOException(Code)

See Also:   org.geotools.data.DataStore.updateSchema(java.lang.Stringorg.geotools.feature.FeatureType)



Fields inherited from org.geotools.data.jdbc.JDBCDataStore
protected DataSource dataSource(Code)(Java Doc)
protected String databaseSchema(Code)(Java Doc)

Methods inherited from org.geotools.data.jdbc.JDBCDataStore
final public Connection connection()(Code)(Java Doc)
protected ContentState createContentState(ContentEntry entry)(Code)(Java Doc)
protected ContentFeatureSource createFeatureSource(ContentEntry entry) throws IOException(Code)(Java Doc)
protected SQLBuilder createSQLBuilder()(Code)(Java Doc)
public void createSchema(FeatureType featureType) throws IOException(Code)(Java Doc)
protected JDBCTypeBuilder createTypeBuilder()(Code)(Java Doc)
protected JDBCTypeBuilder createTypeBuilder(SimpleTypeFactory typeFactory)(Code)(Java Doc)
protected List createTypeNames() throws IOException(Code)(Java Doc)
public DataSource getDataSource()(Code)(Java Doc)
public String getDatabaseSchema()(Code)(Java Doc)
public Logger getLogger()(Code)(Java Doc)
public PrimaryKey getPrimaryKey(ContentEntry entry) throws IOException(Code)(Java Doc)
public PrimaryKey getPrimaryKey(FeatureType featureType) throws IOException(Code)(Java Doc)
public void setDataSource(DataSource dataSource)(Code)(Java Doc)
public void setDatabaseSchema(String databaseSchema)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.