|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.geotools.data.AbstractDataStore
org.geotools.data.AbstractFileDataStore
org.geotools.data.shapefile.ShapefileDataStore
A DataStore implementation which allows reading and writing from Shapefiles.
| Nested Class Summary | |
protected static class |
ShapefileDataStore.Reader
An AttributeReader implementation for Shapefile. |
protected class |
ShapefileDataStore.Writer
A FeatureWriter for ShapefileDataStore. |
| Field Summary | |
protected java.net.URL |
dbfURL
|
protected java.net.URI |
namespace
|
protected java.net.URL |
prjURL
|
protected Lock |
readWriteLock
|
protected FeatureType |
schema
|
protected java.net.URL |
shpURL
|
protected java.net.URL |
shxURL
|
protected boolean |
useMemoryMappedBuffer
|
protected java.net.URL |
xmlURL
|
| Fields inherited from class org.geotools.data.AbstractDataStore |
isWriteable, listenerManager, LOGGER |
| Constructor Summary | |
ShapefileDataStore(java.net.URL url)
Creates a new instance of ShapefileDataStore. |
|
ShapefileDataStore(java.net.URL url,
java.net.URI namespace)
this sets the datastore's namespace during construction (so the schema - FeatureType - will have the correct value) You can call this with namespace = null, but I suggest you give it an actual namespace. |
|
ShapefileDataStore(java.net.URL url,
java.net.URI namespace,
boolean useMemoryMapped)
this sets the datastore's namespace during construction (so the schema - FeatureType - will have the correct value) You can call this with namespace = null, but I suggest you give it an actual namespace. |
|
| Method Summary | |
protected void |
copyAndDelete(java.net.URL src,
long temp)
Copy the file at the given URL to the original |
protected static DbaseFileHeader |
createDbaseHeader(FeatureType featureType)
Attempt to create a DbaseFileHeader for the FeatureType. |
protected FeatureReader |
createFeatureReader(java.lang.String typeName,
ShapefileDataStore.Reader r,
FeatureType readerSchema)
|
protected java.lang.String |
createFeatureTypeName()
Create the type name of the single FeatureType this DataStore represents. |
protected FeatureWriter |
createFeatureWriter(java.lang.String typeName,
Transaction transaction)
Create a FeatureWriter for the given type name. |
protected java.util.Map |
createMetadata(java.lang.String typeName)
Latch onto xmlURL if it is there, we may be able to get out of calculating the bounding box! |
void |
createSchema(FeatureType featureType)
Set the FeatureType of this DataStore. |
protected ShapefileDataStore.Reader |
getAttributesReader(boolean readDbf)
Returns the attribute reader, allowing for a pure shapefile reader, or a combined dbf/shp reader. |
protected com.vividsolutions.jts.geom.Envelope |
getBounds(Query query)
Computes the bounds of the features for the specified feature type that satisfy the query provided that there is a fast way to get that result. |
protected int |
getCount(Query query)
Gets the number of the features that would be returned by this query for the specified feature type. |
protected java.lang.String |
getCurrentTypeName()
|
protected FeatureReader |
getFeatureReader()
Singular version, which must be implemented to represent a Reader for the url being read. |
protected FeatureReader |
getFeatureReader(java.lang.String typeName)
Create a FeatureReader for the provided type name. |
protected FeatureReader |
getFeatureReader(java.lang.String typeName,
Query query)
Just like the basic version, but adds a small optimization: if no attributes are going to be read, don't uselessly open and read the dbf file. |
FeatureSource |
getFeatureSource(java.lang.String typeName)
Default implementation based on getFeatureReader and getFeatureWriter. |
protected java.nio.channels.ReadableByteChannel |
getReadChannel(java.net.URL url)
Obtain a ReadableByteChannel from the given URL. |
FeatureType |
getSchema()
Singular version, returns the FeatureType for the url being read. |
FeatureType |
getSchema(java.lang.String typeName)
Obtain the FeatureType of the given name. |
protected java.io.File |
getStorageFile(java.net.URL url,
long temp)
Get a temproray File based on the URL passed in |
protected java.net.URL |
getStorageURL(java.net.URL url,
long temp)
Get a temporary URL for storage based on the one passed in |
java.lang.String[] |
getTypeNames()
Get an array of type names this DataStore holds. |
protected java.nio.channels.WritableByteChannel |
getWriteChannel(java.net.URL url)
Obtain a WritableByteChannel from the given URL. |
boolean |
isLocal()
Determine if the location of this shapefile is local or remote. |
protected DbaseFileReader |
openDbfReader()
Convenience method for opening a DbaseFileReader. |
protected PrjFileReader |
openPrjReader()
Convenience method for opening a DbaseFileReader. |
protected ShapefileReader |
openShapeReader()
Convenience method for opening a ShapefileReader. |
protected AttributeType[] |
readAttributes()
Create the AttributeTypes contained within this DataStore. |
protected void |
typeCheck(java.lang.String requested)
A convenience method to check if a type name is correct. |
| Methods inherited from class org.geotools.data.AbstractFileDataStore |
getFeatureSource, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, updateSchema |
| Methods inherited from class org.geotools.data.AbstractDataStore |
createLockingManager, getFeatureReader, getFeatureWriter, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getLockingManager, getUnsupportedFilter, getView, updateSchema |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final java.net.URL shpURL
protected final java.net.URL dbfURL
protected final java.net.URL shxURL
protected final java.net.URL prjURL
protected final java.net.URL xmlURL
protected Lock readWriteLock
protected java.net.URI namespace
protected FeatureType schema
protected boolean useMemoryMappedBuffer
| Constructor Detail |
public ShapefileDataStore(java.net.URL url)
throws java.net.MalformedURLException
url - The URL of the shp file to use for this DataSource.
java.lang.NullPointerException - DOCUMENT ME!
. - If computation of related URLs (dbf,shx) fails.
java.net.MalformedURLException
public ShapefileDataStore(java.net.URL url,
java.net.URI namespace)
throws java.net.MalformedURLException
url - namespace -
public ShapefileDataStore(java.net.URL url,
java.net.URI namespace,
boolean useMemoryMapped)
throws java.net.MalformedURLException
url - namespace - useMemoryMapped - | Method Detail |
protected java.util.Map createMetadata(java.lang.String typeName)
This method is called by the createTypeEntry anonymous inner class DefaultTypeEntry.
createMetadata in class AbstractDataStoretypeName - DOCUMENT ME!
public boolean isLocal()
protected java.nio.channels.ReadableByteChannel getReadChannel(java.net.URL url)
throws java.io.IOException
url - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
protected java.nio.channels.WritableByteChannel getWriteChannel(java.net.URL url)
throws java.io.IOException
url - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
protected FeatureReader getFeatureReader(java.lang.String typeName)
throws java.io.IOException
getFeatureReader in class AbstractDataStoretypeName - The name of the FeatureType to create a reader for.
java.io.IOException - If an error occurs during creation
protected FeatureReader getFeatureReader()
throws java.io.IOException
AbstractFileDataStore
getFeatureReader in class AbstractFileDataStorejava.io.IOExceptionorg.geotools.data.DataStore#getFeatureReader(java.lang.String)
protected FeatureReader getFeatureReader(java.lang.String typeName,
Query query)
throws java.io.IOException
getFeatureReader in class AbstractDataStorejava.io.IOExceptionAbstractDataStore.getFeatureReader(java.lang.String,
org.geotools.data.Query)
protected FeatureReader createFeatureReader(java.lang.String typeName,
ShapefileDataStore.Reader r,
FeatureType readerSchema)
throws SchemaException
SchemaException
protected ShapefileDataStore.Reader getAttributesReader(boolean readDbf)
throws java.io.IOException
readDbf - - if true, the dbf fill will be opened and read
java.io.IOException
protected ShapefileReader openShapeReader()
throws java.io.IOException
java.io.IOException - If an error occurs during creation.
DataSourceException - DOCUMENT ME!
protected DbaseFileReader openDbfReader()
throws java.io.IOException
java.io.IOException - If an error occurs during creation.
protected PrjFileReader openPrjReader()
throws java.io.IOException,
org.opengis.referencing.FactoryException
java.io.IOException - If an error occurs during creation.
org.opengis.referencing.FactoryException - DOCUMENT ME!public java.lang.String[] getTypeNames()
getTypeNames in interface DataStoregetTypeNames in class AbstractDataStoreprotected java.lang.String createFeatureTypeName()
protected java.lang.String getCurrentTypeName()
protected void typeCheck(java.lang.String requested)
throws java.io.IOException
requested - The type name requested.
java.io.IOException - If the type name is not available
protected FeatureWriter createFeatureWriter(java.lang.String typeName,
Transaction transaction)
throws java.io.IOException
createFeatureWriter in class AbstractDataStoretypeName - The typeName of the FeatureType to writetransaction - DOCUMENT ME!
java.io.IOException - If the typeName is not available or some other error
occurs.
public FeatureType getSchema(java.lang.String typeName)
throws java.io.IOException
getSchema in interface DataStoregetSchema in class AbstractDataStoretypeName - The name of the FeatureType.
java.io.IOException - If a type by the requested name is not present.
public FeatureType getSchema()
throws java.io.IOException
AbstractFileDataStore
getSchema in class AbstractFileDataStorejava.io.IOExceptionDataStore.getSchema(java.lang.String)
protected AttributeType[] readAttributes()
throws java.io.IOException
java.io.IOException - If AttributeType reading fails
public void createSchema(FeatureType featureType)
throws java.io.IOException
createSchema in interface DataStorecreateSchema in class AbstractDataStorefeatureType - The desired FeatureType.
java.io.IOException - If the DataStore is remote.
protected com.vividsolutions.jts.geom.Envelope getBounds(Query query)
throws java.io.IOException
AbstractDataStoreWill return null if there is not fast way to compute the bounds. Since it's based on some kind of header/cached information, it's not guaranteed to be real bound of the features
getBounds in class AbstractDataStorequery -
java.io.IOException
public FeatureSource getFeatureSource(java.lang.String typeName)
throws java.io.IOException
AbstractDataStoreWe should be able to optimize this to only get the RowSet once
getFeatureSource in interface DataStoregetFeatureSource in class AbstractDataStorejava.io.IOExceptionDataStore.getFeatureSource(java.lang.String)
protected int getCount(Query query)
throws java.io.IOException
AbstractDataStore
If getBounds(Query) returns -1 due to expense consider
using getFeatures(Query).getCount() as a an alternative.
getCount in class AbstractDataStorequery - Contains the Filter and MaxFeatures to find the bounds for.
-1
if count is too expensive to calculate or any errors or occur.
java.io.IOException - if there are errors getting the countAbstractDataStore.getCount(org.geotools.data.Query)
protected static DbaseFileHeader createDbaseHeader(FeatureType featureType)
throws java.io.IOException,
DbaseFileException
featureType - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
DbaseFileException - DOCUMENT ME!
protected java.net.URL getStorageURL(java.net.URL url,
long temp)
throws java.net.MalformedURLException
url - DOCUMENT ME!temp - DOCUMENT ME!
java.net.MalformedURLException
protected java.io.File getStorageFile(java.net.URL url,
long temp)
url - DOCUMENT ME!temp - DOCUMENT ME!
protected void copyAndDelete(java.net.URL src,
long temp)
throws java.io.IOException
src - DOCUMENT ME!temp - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||