Java Doc for DataStore.java in  » GIS » GeoTools-2.4.1 » org » geotools » data » 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 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.geotools.data.DataStore

All known Subclasses:   org.geotools.data.AbstractDataStore,  org.geotools.caching.DelayedDataStore,  org.geotools.data.jdbc.JDBC1DataStore,  org.geotools.data.dir.DirectoryDataStore,  org.geotools.data.store.ContentDataStore,  org.geotools.data.hsql.HsqlDataStore,  org.geotools.data.postgis.PostgisDataStore,  org.geotools.data.store.AbstractDataStore2,
DataStore
public interface DataStore (Code)
Represents a Physical Store for FeatureTypes.

The source of data for FeatureTypes. Shapefiles, databases tables, etc. are referenced through this interface.

Summary of our requirements:

  • Provides lookup of available Feature Types
  • Provides access to low-level Readers/Writers API for a feature type
  • Provides access to high-level FeatureSource/Store/Locking API a feature type
  • Handles the conversion of filters into data source specific queries
  • Handles creation of new Feature Types
  • Provides access of Feature Type Schema information
Suggestions:
  • GeoAPI - has reduced this to api to the FeatureStore construct Jody - since we are no longer using the FeatureReader/ReaderWriter in client code this would not be a bad idea.

author:
   Jody Garnett, Refractions Research
version:
   $Id: DataStore.java 27585 2007-10-23 13:08:01Z aaime $




Method Summary
 voidcreateSchema(FeatureType featureType)
     Creates storage for a new featureType.
 voiddispose()
     Disposes of this data store and releases any resource that it is using.

A DataStore cannot be used after dispose has been called, neither can any data access object it helped create, such as FeatureReader , FeatureSource or FeatureCollection .

This operation can be called more than once without side effects.

There is no thread safety assurance associated with this method.

 FeatureReadergetFeatureReader(Query query, Transaction transaction)
     Access a FeatureReader providing access to Feature information.

Filter is used as a low-level indication of constraints. (Implementations may resort to using a FilteredFeatureReader, or provide their own optimizations)

FeatureType provides a template for the returned FeatureReader

  • featureType.getTypeName(): used by JDBC as the table reference to query against.
 FeatureSourcegetFeatureSource(String typeName)
     Access a FeatureSource for typeName providing a high-level API.
 FeatureWritergetFeatureWriter(String typeName, Filter filter, Transaction transaction)
     Access FeatureWriter for modification of existing DataStore contents.

To limit FeatureWriter to the FeatureTypes defined by this DataStore, typeName is used to indicate FeatureType.

 FeatureWritergetFeatureWriter(String typeName, Transaction transaction)
     Access FeatureWriter for modification of the DataStore typeName.
 FeatureWritergetFeatureWriterAppend(String typeName, Transaction transaction)
     Aquire a FeatureWriter for adding new content to a FeatureType.
 LockingManagergetLockingManager()
     Retrieve a per featureID based locking service from this DataStore.

It is common to return an instanceof InProcessLockingManager for DataStores that do not provide native locking.

AbstractFeatureLocking makes use of this service to provide locking support.

 FeatureTypegetSchema(String typeName)
     Retrieve FeatureType metadata by typeName.
 String[]getTypeNames()
     Retrieves a list of of the available FeatureTypes.
 FeatureSourcegetView(Query query)
     Access a FeatureSource for Query providing a high-level API.

The provided Query does not need to completely cover the existing schema for Query.getTypeName().

 voidupdateSchema(String typeName, FeatureType featureType)
     Used to force namespace and CS info into a persistent change.



Method Detail
createSchema
void createSchema(FeatureType featureType) throws IOException(Code)
Creates storage for a new featureType.

The provided featureType we be accessable by the typeName provided by featureType.getTypeName().


Parameters:
  featureType - FetureType to add to DataStore
throws:
  IOException - If featureType cannot be created



dispose
void dispose()(Code)
Disposes of this data store and releases any resource that it is using.

A DataStore cannot be used after dispose has been called, neither can any data access object it helped create, such as FeatureReader , FeatureSource or FeatureCollection .

This operation can be called more than once without side effects.

There is no thread safety assurance associated with this method. For example, client code will have to make sure this method is not called while retrieving/saving data from/to the storage, or be prepared for the consequences.




getFeatureReader
FeatureReader getFeatureReader(Query query, Transaction transaction) throws IOException(Code)
Access a FeatureReader providing access to Feature information.

Filter is used as a low-level indication of constraints. (Implementations may resort to using a FilteredFeatureReader, or provide their own optimizations)

FeatureType provides a template for the returned FeatureReader

  • featureType.getTypeName(): used by JDBC as the table reference to query against. Shapefile reader may need to store a lookup to the required filename.
  • featureType.getAttributeTypes(): describes the requested content. This may be a subset of the complete FeatureType defined by the DataStore.
  • getType.getNamespace(): describes the requested namespace for the results (may be different then the one used internally)

Transaction to externalize DataStore state on a per Transaction basis. The most common example is a JDBC datastore saving a Connection for use across several FeatureReader requests. Similarly a Shapefile reader may wish to redirect FeatureReader requests to a alternate filename over the course of a Transaction.

Notes For Implementing DataStore

Subclasses may need to retrieve additional attributes, beyond those requested by featureType.getAttributeTypes(), in order to correctly apply the filter.
These Additional attribtues should be not be returned by FeatureReader. Subclasses may use ReTypeFeatureReader to aid in acomplishing this.

Helper classes for implementing a FeatureReader (in order):

  • DefaultFeatureReader - basic support for creating a FeatureReader for an AttributeReader
  • FilteringFeatureReader - filtering support
  • DiffFeatureReader - In-Process Transaction Support (see TransactionStateDiff)
  • ReTypeFeatureReader - Feature Type schema manipulation of namesspace and attribute type subsets
  • EmptyFeatureReader - provides no content for Filter.EXCLUDE optimizations

Sample use (not optimized):


 if (filter == Filter.EXCLUDE) {
 return new EmptyFeatureReader(featureType);
 }
 String typeName = featureType.getTypeName();
 FeatureType schema = getSchema( typeName );
 FeatureReader reader = new DefaultFeatureReader( getAttributeReaders(), schema );
 if (filter != Filter.INCLUDE) {
 reader = new FilteringFeatureReader(reader, filter);
 }
 if (transaction != Transaction.AUTO_COMMIT) {
 Map diff = state(transaction).diff(typeName);
 reader = new DiffFeatureReader(reader, diff);
 }
 if (!featureType.equals(reader.getFeatureType())) {
 reader = new ReTypeFeatureReader(reader, featureType);
 }
 return reader
 

Locking support does not need to be provided for FeatureReaders.


Parameters:
  query - Requested form of the returned Features and the filter usedto constraints the results
Parameters:
  transaction - Transaction this query operates against FeatureReader Allows Sequential Processing of featureType



getFeatureSource
FeatureSource getFeatureSource(String typeName) throws IOException(Code)
Access a FeatureSource for typeName providing a high-level API.

The resulting FeatureSource may implment more functionality:


 FeatureSource fsource = dataStore.getFeatureSource( "roads" );
 FeatureStore fstore = null;
 if( fsource instanceof FeatureLocking ){
 fstore = (FeatureStore) fs;
 }
 else {
 System.out.println("We do not have write access to roads");
 }
 
 

Parameters:
  typeName - FeatureSource (or subclass) providing operations for typeName



getFeatureWriter
FeatureWriter getFeatureWriter(String typeName, Filter filter, Transaction transaction) throws IOException(Code)
Access FeatureWriter for modification of existing DataStore contents.

To limit FeatureWriter to the FeatureTypes defined by this DataStore, typeName is used to indicate FeatureType. The resulting feature writer will allow modifications against the same FeatureType provided by getSchema( typeName )

The FeatureWriter will provide access to the existing contents of the FeatureType referenced by typeName. The provided filter will be used to skip over Features as required.

Notes For Implementing DataStore

The returned FeatureWriter does not support the addition of new Features to FeatureType (it would need to police your modifications to agree with filer). As such it will return false for getNext() when it reaches the end of the Query and NoSuchElementException when next() is called.

Helper classes for implementing a FeatureWriter (in order):

  • InProcessLockingManager.checkedWriter( writer ) - provides a check against locks before allowing modification
  • FilteringFeatureWriter - filtering support for FeatureWriter (does not allow new content)
  • DiffFeatureWriter - In-Process Transaction Support (see TransactionStateDiff)
  • EmptyFeatureWriter - provides no content for Filter.EXCLUDE optimizations

  • Parameters:
      typeName - Indicates featureType to be modified
    Parameters:
      filter - constraints used to limit the modification
    Parameters:
      transaction - Transaction this query operates against FeatureWriter Allows Sequential Modification of featureType



    getFeatureWriter
    FeatureWriter getFeatureWriter(String typeName, Transaction transaction) throws IOException(Code)
    Access FeatureWriter for modification of the DataStore typeName.

    FeatureWriters will need to be limited to the FeatureTypes defined by the DataStore, the easiest way to express this limitation is to the FeatureType by a provided typeName.

    The returned FeatureWriter will return false for getNext() when it reaches the end of the Query.


    Parameters:
      typeName - Indicates featureType to be modified
    Parameters:
      transaction - Transaction to operates against FeatureReader Allows Sequential Processing of featureType



    getFeatureWriterAppend
    FeatureWriter getFeatureWriterAppend(String typeName, Transaction transaction) throws IOException(Code)
    Aquire a FeatureWriter for adding new content to a FeatureType.

    This FeatureWriter will return false for hasNext(), however next() may be used to aquire new Features that may be writen out to add new content.


    Parameters:
      typeName - Indicates featureType to be modified
    Parameters:
      transaction - Transaction to operates against FeatureWriter that may only be used to append new content
    throws:
      IOException -



    getLockingManager
    LockingManager getLockingManager()(Code)
    Retrieve a per featureID based locking service from this DataStore.

    It is common to return an instanceof InProcessLockingManager for DataStores that do not provide native locking.

    AbstractFeatureLocking makes use of this service to provide locking support. You are not limitied by this implementation and may simply return null for this value.

    DataStores may return null, if the handling lockingin another fashion.



    getSchema
    FeatureType getSchema(String typeName) throws IOException(Code)
    Retrieve FeatureType metadata by typeName.

    Retrieves the Schema information as a FeatureType object.


    Parameters:
      typeName - typeName of requested FeatureType FeatureType for the provided typeName
    throws:
      IOException - If typeName cannot be found



    getTypeNames
    String[] getTypeNames() throws IOException(Code)
    Retrieves a list of of the available FeatureTypes.

    This is simply a list of the FeatureType names as aquiring the actual FeatureType schemas may be expensive.

    Warning: this list may not be unique - the types may be in separate namespaces.

    If you need to worry about such things please consider the use of the Catalog and CatalogEntry interface - many DataStores support this. getTypeNames is really a convience method for a Catalog.iterator() where the name of each entry is returned.

    typeNames for available FeatureTypes.



    getView
    FeatureSource getView(Query query) throws IOException, SchemaException(Code)
    Access a FeatureSource for Query providing a high-level API.

    The provided Query does not need to completely cover the existing schema for Query.getTypeName(). The result will mostly likely only be a FeatureSource and probably wont' allow write access by the FeatureStore method.

    By using Query we allow support for reprojection, in addition to overriding the CoordinateSystem used by the native FeatureType.

    We may wish to limit this method to only support Queries using Filter.EXCLUDE.

    Update - GeoServer has an elegatent implementation of this functionality that we could steal. GeoServerFeatureSource, GeoServerFeatureStore and GeoServerFeatureLocking serve as a working prototype.


    Parameters:
      query - Query.getTypeName() locates FeatureType being viewed FeatureSource providing operations for featureType
    throws:
      IOException - If FeatureSource is not available
    throws:
      SchemaException - If fetureType is not covered by existing schema



    updateSchema
    void updateSchema(String typeName, FeatureType featureType) throws IOException(Code)
    Used to force namespace and CS info into a persistent change.

    The provided featureType should completely cover the existing schema. All attributes should be accounted for and the typeName should match.

    Suggestions:

    • Sean - don't do this
    • Jody - Just allow changes to metadata: CS, namespace, and others
    • James - Allow change/addition of attribtues

    Parameters:
      typeName -
    throws:
      IOException -



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