Skip to end of metadata
Go to start of metadata

Copy DataStore Plug-in from Trunk

In order to minimize missing out on improvments and bug fixes from trunk, before beginning a data store port you should copy the latest and greatest version from trunk.

Be sure to make that trunk itself is in sync with the current stable branch (2.2.x) before proceeding. This can be done by either emailing the list and asking or checking the version control logs.

You can copy over the plugin with the following svn commands.

Get the Plug-in to Compile

The first task is getting code to compile. If you are keen on TDD (Test Driven Development) you will start with tests. (smile). Here are some guidelines and tips that will help.

org.geotools.feature

The org.geotools.feature interfaces are now gone and replaced with org.opengis.feature and org.opengis.feature.type. So references to the old Feature and FeatureType can pretty much be replaced mechanically.

FeatureType

As stated above org.geotools.feature.FeatureType has been removed and placed with org.opengis.feature.FeatureType. In the new model, the old FeatureType best maps to org.opengis.feature.simple.SimpleFeatureType. The following table maps the methods across. In some cases no such mapping exists so the alternative is listed.

FeatureType

SimpleFeatureType

Alternative

getTypeName()

getName().getLocalPart()

getNamespace()

getName().getNamespaceURI()

isDescendedFrom(URI,String)

(error)

Types.isSuperType(AttributeType,AttributeType)

isDescendedFrom(FeatureType)

(error)

Types.isSuperType(AttributeType,AttributeType)

isAbstract()

(tick)

getAnscestors()

getSuper()

getDefaultGeometry()

defaultGeometry()

getAttributeCount()

getNumberOfAttributes()

getAttributeType(String)

get(String)

find(AttributeType)

(error)

find(String)

(error)

getAttributeType(int)

get(int)

getAttributeTypes()

types()

hasAttributeType(String)

(error)

get(String) != null

duplicate(Feature)

(error)

SimpleFeatures.duplicate(SimpleFeature,SimpleFeature)

create(Object[])

(error)

SimpleFeatures.create(SimpleFeatureType,Object[],String

create(Object[], String)

(error)

SimpleFeatures.create(SimpleFeatureType,Object[],String)

Feature

Similar to FeatureType, org.geotools.feature.Feature maps to org.opengis.feature.simple.SimpleFeature.

Feature

SimpleFeature

Alternative

getParent()

(error)

 

setParent(FeatureCollection

(error)

 

getFeatureType()

getType()

 

getID()

(tick)

 

getAttributes(Object[])

values()

 

getAttribute(String)

get(String)

 

getAttribute(int)

get(int)

 

setAttribute(String,Object)

set(String,Object)

 

setAttribute(int,Object)

set(int,Object)

 

getNumberOfAttributes()

(tick)

 

getDefaultGeometry()

defaultGeometry()

 

setDefaultGeometry(Geometry)

defaultGeometry(Object)

 

getBounds()

(tick)

 

FeatureType Creation

Creating feature types is done with SimpleFeatureTypeBuilder.

Feature Creation

Creating features is done with SimpleFeatureBuilder

org.geotools.data

DataStore

The datastore api has mostly maintained backwards compatability. The changes have to do with naming. Methods that accepted a String to reference a FeatureType, no accept a TypeName.

DataStore

AbstractDataStore

The above methods referencing FeatureType by a single String have been deprecated and finalized. So any subclasses of AbstractDataStore are broken and must convert the internal name storage to the TypeName system.

Labels
  • None