org.geotools.data.vpf
Class VPFFeatureClass

java.lang.Object
  extended byorg.geotools.data.vpf.VPFFeatureClass
All Implemented Interfaces:
DataTypesDefinition, FeatureType, FileConstants

public class VPFFeatureClass
extends java.lang.Object
implements DataTypesDefinition, FileConstants, FeatureType

A VPF feature class. Note that feature classes may contain one or more feature types. However, all of the feature types of a feature class share the same schema. A feature type will therefore delegate its schema related operations to its feature class.

Author:
Jeff Yutzler

Field Summary
 
Fields inherited from interface org.geotools.data.vpf.ifc.DataTypesDefinition
BIG_ENDIAN_ORDER, CHAR_NULL_VALUE, DATA_2_COORD_F, DATA_2_COORD_F_LEN, DATA_2_COORD_R, DATA_2_COORD_R_LEN, DATA_3_COORD_F, DATA_3_COORD_F_LEN, DATA_3_COORD_R, DATA_3_COORD_R_LEN, DATA_DATE_TIME, DATA_DATE_TIME_LEN, DATA_LEVEL1_TEXT, DATA_LEVEL2_TEXT, DATA_LEVEL3_TEXT, DATA_LONG_FLOAT, DATA_LONG_FLOAT_LEN, DATA_LONG_INTEGER, DATA_LONG_INTEGER_LEN, DATA_NULL_FIELD, DATA_NULL_FIELD_LEN, DATA_SHORT_FLOAT, DATA_SHORT_FLOAT_LEN, DATA_SHORT_INTEGER, DATA_SHORT_INTEGER_LEN, DATA_TEXT, DATA_TRIPLET_ID, DATA_TRIPLET_ID_LEN, LEAST_SIGNIF_FIRST, LITTLE_ENDIAN_ORDER, MOST_SIGNIF_FIRST, STRING_NULL_VALUE, STRING_NULL_VALUES
 
Fields inherited from interface org.geotools.data.vpf.ifc.FileConstants
AREA_BOUMDING_RECTANGLE_TABLE, AREA_FEATURE_TABLE, AREA_JOIN_TABLE, AREA_THEMATIC_INDEX, CHARACTER_VALUE_DESCRIPTION_TABLE, COLUMN_MANDATORY, COLUMN_MANDATORY_AT_LEVEL_0, COLUMN_MANDATORY_AT_LEVEL_1, COLUMN_MANDATORY_AT_LEVEL_2, COLUMN_MANDATORY_AT_LEVEL_3, COLUMN_MANDATORY_IF_TILES, COLUMN_OPTIONAL, COLUMN_OPTIONAL_FP, COMPLEX_BOUNDING_RECTANGLE_TABLE, COMPLEX_FEATURE_TABLE, COMPLEX_JOIN_TABLE, COMPLEX_THEMATIC_INDEX, CONNECTED_NODE_PRIMITIVE, CONNECTED_NODE_SPATIAL_INDEX, COVERAGE_ATTRIBUTE_TABLE, DATA_QUALITY_COVERAGE, DATA_QUALITY_TABLE, DATABASE_HEADER_TABLE, DIAGNOSITC_POINT_TABLE, DIR_DQ, DIR_GAZETTE, DIR_LIBREF, DIR_TILEREF, EDGE_BOUNDING_RECTANGLE, EDGE_PRIMITIVE, EDGE_SPATIAL_INDEX, ENTITY_NODE_PRIMITIVE, ENTITY_NODE_SPATIAL_INDEX, EXT_ABR, EXT_AFT, EXT_AJT, EXT_ATI, EXT_CBR, EXT_CFT, EXT_CJT, EXT_CTI, EXT_DOC, EXT_DPT, EXT_FIT, EXT_FTI, EXT_JTI, EXT_LBR, EXT_LFT, EXT_LJT, EXT_LTI, EXT_PBR, EXT_PFT, EXT_PJT, EXT_PTI, EXT_RAT, EXT_RPT, EXT_TFT, EXT_TTI, FACE_BOUNDING_RECTANGLE, FACE_PRIMITIVE, FACE_SPATIAL_INDEX, FEATURE_CLASS_ATTRIBUTE_TABLE, FEATURE_CLASS_SCHEMA_TABLE, FEATURE_INDEX_TABLE, FEATURE_THEMATIC_INDEX, GEOGRAPHIC_REFERENCE_TABLE, INTEGER_VALUE_DESCRIPTION_TABLE, JOIN_THEMATIC_INDEX, KEY_NON_UNIQUE, KEY_PRIMARY, KEY_UNIQUE, LIBRARY_ATTTIBUTE_TABLE, LIBRARY_HEADER_TABLE, LIBRARY_REFERENCE_COVERAGE, LINE_BOUNDING_RECTANGLE_TABLE, LINE_FEATURE_TABLE, LINE_JOIN_TABLE, LINE_THEMATIC_INDEX, NAMES_REFERENCE_COVERAGE, NARRATIVE_TABLE, POINT_BOUNDING_RECTANGLE_TABLE, POINT_FEATURE_TABLE, POINT_JOIN_TABLE, POINT_THEMATIC_INDEX, REGISTRATION_POINT_TABLE, RELATED_ATTRIBUTE_TABLE, RING_TABLE, TABLE_CAT, TABLE_CHAR, TABLE_CND, TABLE_CSI, TABLE_DHT, TABLE_DQT, TABLE_EBR, TABLE_EDG, TABLE_END, TABLE_ESI, TABLE_FAC, TABLE_FBR, TABLE_FCA, TABLE_FCS, TABLE_FSI, TABLE_GRT, TABLE_INT, TABLE_LAT, TABLE_LHT, TABLE_NSI, TABLE_RNG, TABLE_TSI, TABLE_TXT, TEXT_FEATURE_TABLE, TEXT_PRIMITIVE, TEXT_SPATIAL_INDEX, TEXT_THEMATIC_TABLE, TILE_REFERENCE_COVERAGE, VPF_ELEMENT_SEPARATOR, VPF_FIELD_SEPARATOR, VPF_RECORD_SEPARATOR
 
Constructor Summary
VPFFeatureClass(VPFCoverage cCoverage, java.lang.String cName, java.lang.String cDirectoryName)
          Constructor
VPFFeatureClass(VPFCoverage cCoverage, java.lang.String cName, java.lang.String cDirectoryName, java.net.URI cNamespace)
          Constructor
 
Method Summary
 Feature create(java.lang.Object[] attributes)
          Scheduled for removal in Geotools 2.2, please use FeatureFactory.
 Feature create(java.lang.Object[] attributes, java.lang.String featureID)
          Scheduled for removal in Geotools 2.2, please use FeatureFactory.
 Feature duplicate(Feature feature)
          Create a duplicate of the provided feature, must delegate to an appropriate FeatureFactory create method.
 boolean equals(java.lang.Object obj)
          FeatureType check based on namespace, typeName, attributes and ancestors.
 int find(AttributeType type)
          Find the position of a given AttributeType.
 int find(java.lang.String attName)
          Find the position of an AttributeType which matches the given String.
 FeatureType[] getAncestors()
          Obtain an array of this FeatureType's direct ancestors.
 int getAttributeCount()
          The number of attribues defined by this schema.
 AttributeType getAttributeType(int position)
          Gets the schema attributeType at the specified index.
 AttributeType getAttributeType(java.lang.String xPath)
          Gets the attributeType at this xPath, if the specified attributeType does not exist then null is returned.
 AttributeType[] getAttributeTypes()
          AttributeTypes for this FeatureType, all attributes defined by this FeatureType and its super types define schema for feature instances.
 VPFCoverage getCoverage()
          The coverage that owns this feature class
 GeometryAttributeType getDefaultGeometry()
          Gets the default geometry AttributeType.
 java.lang.String getDirectoryName()
          The path to the directory that contains this feature class
 java.util.List getFileList()
          Returns a list of file objects
 VPFGeometryFactory getGeometryFactory()
           
 java.util.List getJoinList()
          DOCUMENT ME!
 java.net.URI getNamespace()
          Gets the global schema namespace.
 java.lang.String getTypeName()
          Gets the type name for this schema.
 boolean hasAttributeType(java.lang.String xPath)
          This is only used twice in the whole geotools code base, and one of those is for a test, so we're removing it from the interface.
 int hashCode()
          Hascode based on namespace, typeName, attributes and ancestors.
 boolean isAbstract()
          Is this FeatureType an abstract type?
 boolean isDescendedFrom(FeatureType type)
          A convenience method for calling
FeatureType f1; FeatureType f2; f1.isDescendedFrom(f2.getNamespace(), f2.getName()); Question: this method duplicates the information provided by getAncestors().
 boolean isDescendedFrom(java.net.URI nsURI, java.lang.String typeName)
          Test to determine whether this FeatureType is descended from the given FeatureType.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VPFFeatureClass

public VPFFeatureClass(VPFCoverage cCoverage,
                       java.lang.String cName,
                       java.lang.String cDirectoryName)
                throws SchemaException
Constructor

Parameters:
cCoverage - the owning coverage
cName - the name of the class
cDirectoryName - the directory containing the class
Throws:
SchemaException - For problems making one of the feature classes as a FeatureType.

VPFFeatureClass

public VPFFeatureClass(VPFCoverage cCoverage,
                       java.lang.String cName,
                       java.lang.String cDirectoryName,
                       java.net.URI cNamespace)
                throws SchemaException
Constructor

Parameters:
cCoverage - the owning coverage
cName - the name of the class
cDirectoryName - the directory containing the class
cNamespace - the namespace to create features with. If null then a default from VPFLibrary.DEFAULTNAMESPACE is assigned.
Throws:
SchemaException - For problems making one of the feature classes as a FeatureType.
Method Detail

getCoverage

public VPFCoverage getCoverage()
The coverage that owns this feature class

Returns:
a VPFCoverage object

getDirectoryName

public java.lang.String getDirectoryName()
The path to the directory that contains this feature class

Returns:
a String value representing the path to the directory.

getFileList

public java.util.List getFileList()
Returns a list of file objects

Returns:
a List containing VPFFile objects

getJoinList

public java.util.List getJoinList()
DOCUMENT ME!

Returns:

getNamespace

public java.net.URI getNamespace()
Description copied from interface: FeatureType
Gets the global schema namespace.

This is often used to record the schema prefix (not the URI) required when writing out this Feature using GML. The supporting application will need to be able to start the GMLWriter off with the correct URI information so everything makes sense.

The Registry interface provided by the data module provides an example of how to store associate FeatureType and namespace information. Please note that you may not have duplicate typeNames in the same Namespace.

Specified by:
getNamespace in interface FeatureType
Returns:
Namespace of schema

getTypeName

public java.lang.String getTypeName()
Description copied from interface: FeatureType
Gets the type name for this schema.

In GML this must be the element name of the Feature.

Specified by:
getTypeName in interface FeatureType
Returns:
The name of this feature type.

getAttributeTypes

public AttributeType[] getAttributeTypes()
Description copied from interface: FeatureType
AttributeTypes for this FeatureType, all attributes defined by this FeatureType and its super types define schema for feature instances.

The provided array of AttributeTypes should be considered as adding to (or overriding) the the AttribtueTypes defined by this FeatureTypes ancestors.

Note Well: Client code should not consider the index provided by the find( attName ) method as a valid index into the returned array.

Specified by:
getAttributeTypes in interface FeatureType
Returns:
Array of AttributeType describing this schema, array may be length 0, but should not be null

hasAttributeType

public boolean hasAttributeType(java.lang.String xPath)
Description copied from interface: FeatureType
This is only used twice in the whole geotools code base, and one of those is for a test, so we're removing it from the interface. If getAttributeType does not have the AttributeType it will just return null. Gets the number of occurrences of this attribute.

Question: the comment says we are removing this, but it is not depricated? And how the heck can the number of occurances out of a boolean.

Specified by:
hasAttributeType in interface FeatureType
Parameters:
xPath - XPath pointer to attribute type.
Returns:
Number of occurrences.

getAttributeType

public AttributeType getAttributeType(java.lang.String xPath)
Description copied from interface: FeatureType
Gets the attributeType at this xPath, if the specified attributeType does not exist then null is returned.

Question: it is unclear how this interacts with the complete schema defined by this FeatureType and its ancestors (in which a given xpath may refer to several AttributeTypes as restrictions are applied.

Perhaps this method should be restricted to a FlatFeatureType? Or should have the option of returning an array of matching AttributeType in order of inheiritence?

Specified by:
getAttributeType in interface FeatureType
Parameters:
xPath - XPath pointer to attribute type.
Returns:
AttributeType, or null if unavaialble

find

public int find(AttributeType type)
Description copied from interface: FeatureType
Find the position of a given AttributeType.

Match is based on attribute type name, the resulting index may be used with getAttributeType( index ).

Specified by:
find in interface FeatureType
Parameters:
type - The type to search for.
Returns:
-1 if not found, a zero-based index if found.

getDefaultGeometry

public GeometryAttributeType getDefaultGeometry()
Description copied from interface: FeatureType
Gets the default geometry AttributeType.

If the FeatureType has more one geometry it is up to the implementor to determine which geometry is the default. If working with multiple geometries it is best to get the attributeTypes and iterate through them, checking for instances of GeometryAttribtueType.

This should just be used a convenience method when it is known that the features do not have multiple geometries.

Specified by:
getDefaultGeometry in interface FeatureType
Returns:
The attribute type of the default geometry, which will contain the position.

getAttributeCount

public int getAttributeCount()
Description copied from interface: FeatureType
The number of attribues defined by this schema.

This method to allows access to the complete schema as defined by this FeatureType and its ancestors.


getAttributeType

public AttributeType getAttributeType(int position)
Description copied from interface: FeatureType
Gets the schema attributeType at the specified index.

The index is specified with respect to the entire Schema (as defined by this FeatureType and it's ancestors).

Specified by:
getAttributeType in interface FeatureType
Returns:
The attribute type at the specified position.

isDescendedFrom

public boolean isDescendedFrom(java.net.URI nsURI,
                               java.lang.String typeName)
Description copied from interface: FeatureType
Test to determine whether this FeatureType is descended from the given FeatureType. Think of this relationship likes the "extends" relationship in java.

Specified by:
isDescendedFrom in interface FeatureType
Parameters:
nsURI - The namespace URI to use.
typeName - The typeName.
Returns:
true if descendant, false otherwise.

isDescendedFrom

public boolean isDescendedFrom(FeatureType type)
Description copied from interface: FeatureType
A convenience method for calling
 FeatureType f1;
 FeatureType f2;
 f1.isDescendedFrom(f2.getNamespace(), f2.getName());
 

Question: this method duplicates the information provided by getAncestors().

Specified by:
isDescendedFrom in interface FeatureType
Parameters:
type - The type to compare to.
Returns:
true if descendant, false otherwise.

isAbstract

public boolean isAbstract()
Description copied from interface: FeatureType
Is this FeatureType an abstract type?

When true is returned instances of this Feature cannot be created, instead a child FeatureType must use this FeatureType as its ancestor.

Specified by:
isAbstract in interface FeatureType
Returns:
true if abstract, false otherwise.

getAncestors

public FeatureType[] getAncestors()
Description copied from interface: FeatureType
Obtain an array of this FeatureType's direct ancestors. Implementors should return a non-null array (may be of length 0).

GetAncestors() indicates *just* the direct parents of this FeatureType. It capures the inheirtance relationship from the OGC overview document.

Example Code:


 public FeatureType getAncestors()}
     return new FeatureType[]{ getSuper(), };
 }
 

Specified by:
getAncestors in interface FeatureType
Returns:
An array of ancestors.

duplicate

public Feature duplicate(Feature feature)
                  throws IllegalAttributeException
Description copied from interface: FeatureType
Create a duplicate of the provided feature, must delegate to an appropriate FeatureFactory create method.

The implementation is assumed to make use of AttributeType duplicate as required for a deep copy.

//@deprecated This method will be removed in 2.2, please use FeatureFactory obtained from FactoryFinder

Specified by:
duplicate in interface FeatureType
Parameters:
feature -
Returns:
a deep copy of feature
Throws:
IllegalAttributeException

create

public Feature create(java.lang.Object[] attributes)
               throws IllegalAttributeException
Description copied from interface: FeatureType
Scheduled for removal in Geotools 2.2, please use FeatureFactory.

Creates a new feature, with a generated unique featureID. This is less than ideal, as a FeatureID should be persistant over time, generally created by a datasource. This method is more for testing that doesn't need featureID.

Specified by:
create in interface FeatureType
Parameters:
attributes - the array of attribute values
Returns:
The created feature
Throws:
IllegalAttributeException - if the FeatureType does not validate the attributes.

create

public Feature create(java.lang.Object[] attributes,
                      java.lang.String featureID)
               throws IllegalAttributeException
Description copied from interface: FeatureType
Scheduled for removal in Geotools 2.2, please use FeatureFactory.

Creates a new feature, with the proper featureID.

Specified by:
create in interface FeatureType
Parameters:
attributes - the array of attribute values.
featureID - the feature ID.
Returns:
the created feature.
Throws:
IllegalAttributeException - if the FeatureType does not validate the attributes.

getGeometryFactory

public VPFGeometryFactory getGeometryFactory()
Returns:
Returns the geometryFactory.

find

public int find(java.lang.String attName)
Description copied from interface: FeatureType
Find the position of an AttributeType which matches the given String.

This index may be used with getAttributeType( index ), the search space is the entire schema defined by this FeatureType and its ancestors.

Specified by:
find in interface FeatureType
Parameters:
attName - the name to look for
Returns:
-1 if not found, zero-based index otherwise

equals

public boolean equals(java.lang.Object obj)
Description copied from interface: FeatureType
FeatureType check based on namespace, typeName, attributes and ancestors.

Conceptually FeatureType equality is supped to indicate an exact match based AttributeType and Ancestors. The geotools models includes additional information of namespace and typename.

As far as the geotools data model is concerned any FeatureType implementation should be able to be subsituted for another. (An actually application may provided an implementation that provdes tracking of metadata such as creation history, or support for additional interfaces).

Required implementation:


 
A sample implementation is provided in FeatureTypes.equals( FeatureType, FeatureType ).

Questions:
Q: You may wonder why namespace and typeName are not enought?
A: Geotools often returns a "limitied" schema in response to a query where only a subset of the attributes are requested.
Q: Doesn't that still indicate the same schema?
A: Yes it kind of should, a GML application (such as GeoServer) has to actually follow the application schema and include attributes required by the schema (but not request by the query). This library is more lax in its treatment, and expects you to uses isDecendedFrom as required.

Specified by:
equals in interface FeatureType

hashCode

public int hashCode()
Description copied from interface: FeatureType
Hascode based on namespace, typeName, attributes and ancestors.

Hascode is always a matched set with an equals implementation, please see the javadocs for equals for a detailed discussion.

Specified by:
hashCode in interface FeatureType


Copyright © GeoTools. All Rights Reserved.