com.ontimize.util.gis.server.dataproviders
Class ShapefileDataProvider

java.lang.Object
  extended by com.ontimize.util.gis.server.dataproviders.ShapefileDataProvider
All Implemented Interfaces:
IDataAccess, IDataProvider

public class ShapefileDataProvider
extends java.lang.Object
implements IDataAccess

Shapefile data provider. It uses ESRI Shapefiles (.shp) as geographic data source.

Layer data will be the union between the information contained on the .dfb file and
the geographic data.

Xml definition parameters:

Name Description Required
fileLocation Shapefile file location Yes
geometry_type Geometry type used by the layer: "point", "line" or "polygon" Yes

Sample definition code:

<DataProvider
     class="com.ontimize.util.gis.server.dataproviders.ShapefileDataProvider"
     type="vectorial">
     <Attribute name="fileLocation" value="maps/shapes/provincias.shp" />
     <Attribute name="geometry_type" value="polygon" />
</DataProvider>


Field Summary
protected  org.geotools.data.shapefile.ShapefileDataStore dataStore
           
protected static java.lang.String FILE_LOCATION
           
protected  java.lang.String fileLocation
           
protected  org.geotools.data.FeatureSource fs
           
(package private)  com.vividsolutions.jts.geom.GeometryFactory gf
           
protected  java.io.File shapefile
           
protected  java.net.URL urlLocation
           
 
Constructor Summary
ShapefileDataProvider()
           
ShapefileDataProvider(java.util.Hashtable parameters)
           
 
Method Summary
 void delete(java.lang.Object keysValues, int sessionId)
          This method must implement a standard delete operation over the set of records defined by keysValues.
 void initProvider(java.util.Hashtable<java.lang.String,java.lang.Object> parameters)
           
 java.lang.Object insert(java.lang.Object attributesValues, int sessionId)
          This method must implement a standard insert operation with the data contained in attributesValues parameter.
 java.lang.Object query(java.lang.Object keysValues, java.lang.Object attributes, int sessionId)
          This method must implement a standard query operation returning the set of data that matches the conditions specified by the keysValues parameter.
protected  java.util.Vector<com.vividsolutions.jts.geom.Geometry> reprojectGeometryVector(java.util.Vector<com.vividsolutions.jts.geom.Geometry> sourceVector, java.util.Hashtable appliedFilters)
           
 void update(java.lang.Object keysValues, java.lang.Object attributesValues, int sessionId)
          This method must implement a standard update operation with the data specified in attributesValues over the set of records defined by keysValues.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_LOCATION

protected static final java.lang.String FILE_LOCATION
See Also:
Constant Field Values

fileLocation

protected java.lang.String fileLocation

urlLocation

protected java.net.URL urlLocation

shapefile

protected java.io.File shapefile

dataStore

protected org.geotools.data.shapefile.ShapefileDataStore dataStore

fs

protected org.geotools.data.FeatureSource fs

gf

com.vividsolutions.jts.geom.GeometryFactory gf
Constructor Detail

ShapefileDataProvider

public ShapefileDataProvider()

ShapefileDataProvider

public ShapefileDataProvider(java.util.Hashtable parameters)
Method Detail

delete

public void delete(java.lang.Object keysValues,
                   int sessionId)
            throws java.lang.Exception
Description copied from interface: IDataAccess
This method must implement a standard delete operation over the set of records defined by keysValues. So, only the records that comply with the conditions specified by keysValues will be deleted.

Specified by:
delete in interface IDataAccess
Parameters:
keysValues - The conditions that the records to be deleted must fulfill
sessionId - Session Id for this user
Throws:
java.lang.Exception

insert

public java.lang.Object insert(java.lang.Object attributesValues,
                               int sessionId)
                        throws java.lang.Exception
Description copied from interface: IDataAccess
This method must implement a standard insert operation with the data contained in attributesValues parameter.

Specified by:
insert in interface IDataAccess
Parameters:
attributesValues - Data to store
sessionId - Session Id for this user
Throws:
java.lang.Exception

update

public void update(java.lang.Object keysValues,
                   java.lang.Object attributesValues,
                   int sessionId)
            throws java.lang.Exception
Description copied from interface: IDataAccess
This method must implement a standard update operation with the data specified in attributesValues over the set of records defined by keysValues. So, only the records that comply with the conditions specified by keysValues will be updated to the new values specified by attributesValues.

Specified by:
update in interface IDataAccess
Parameters:
keysValues - The conditions that the records to be updated must fulfill
attributesValues - The data for updating the records to
sessionId - Session Id for this user
Throws:
java.lang.Exception

query

public java.lang.Object query(java.lang.Object keysValues,
                              java.lang.Object attributes,
                              int sessionId)
                       throws java.lang.Exception
Description copied from interface: IDataProvider
This method must implement a standard query operation returning the set of data that matches the conditions specified by the keysValues parameter. The attributes defines which attributes (or columns if data is obtained from a database) must be recovered, and keysValues specifies which set of records must be recovered.

Specified by:
query in interface IDataProvider
Parameters:
keysValues - Identifiers for the data
attributes - Data attributes to query
sessionId - Session Id for this user
Returns:
Requested data
Throws:
java.lang.Exception

initProvider

public void initProvider(java.util.Hashtable<java.lang.String,java.lang.Object> parameters)
Specified by:
initProvider in interface IDataProvider

reprojectGeometryVector

protected java.util.Vector<com.vividsolutions.jts.geom.Geometry> reprojectGeometryVector(java.util.Vector<com.vividsolutions.jts.geom.Geometry> sourceVector,
                                                                                         java.util.Hashtable appliedFilters)