| java.lang.Object org.vfny.geoserver.global.dto.DataTransferObjectFactory
DataTransferObjectFactory | public class DataTransferObjectFactory (Code) | | Generate Data Transfer Objects from "real" objects in the system.
This class is used to isolate the DTO from the details of generating them.
This allows DTO objects to be safely used as a wire protocol with out
unrequired dependencies on such things as AttributeType and FeatureType.
This class may choose to opperate as a facade on the services of global.xml?
author: jgarnett, Refractions Research, Inc. author: $Author: dmzwiers $ (last modification) version: $Id: DataTransferObjectFactory.java 6893 2007-05-29 09:38:46Z groldan $ |
Method Summary | |
public static AttributeTypeInfoDTO | create(String schemaBase, AttributeType attributeType) Construct DTO based on provided AttributeType. | public static AttributeTypeInfoDTO | create(String schemaBase, String attributeName) Construct any of the well-known GML attributeTypes. | public static FeatureTypeInfoDTO | create(String dataStoreId, FeatureType schema) Construct DTO based on provided schema. | public static List | generateAttributes(FeatureType schema) List of attributes DTO information gernated from schema. | public static List | generateRequiredAttributes(String schemaBase) List of attribtue DTO information generated from schemaBase.
Please note this is currently only used for display by TypesForm,
TypeInfo simply makes use of getRequiredBaseAttributes to select
AttributeTypes from the FeatureType schema.
More specifically the values of isNillable, minOccurs and maxOccurs
provided by the DataStore may not agree with the results of this
function. | public static List | getElements(String name, Class type) Mappings for name and type, or null if not found. | public static String[] | getRequiredBaseAttributes(String schemaBase) Required Attributes for schemaBase. | public static boolean | isManditory(String schemaBase, String attribute) Test is attribute is a required attribtue of schemaBase. |
schemaBaseMap | public static Map schemaBaseMap(Code) | | |
create | public static AttributeTypeInfoDTO create(String schemaBase, AttributeType attributeType)(Code) | | Construct DTO based on provided AttributeType.
GMLUtils is used to provide the mapping from
attributeType.getName/attributeType.getType() to an XML type/fragement.
Parameters: attributeType - Real geotools2 AttributeType Data Transfer Object for provided attributeType |
create | public static AttributeTypeInfoDTO create(String schemaBase, String attributeName)(Code) | | Construct any of the well-known GML attributeTypes.
SchemaBase is used to ensure that attribute required by the XMLSchema
have a minOccurs of 1.
This method uses NameSpaceTranslatorFactorys for xs and gml in order to
provide accurate type information describing the provided attribute
Parameters: schemaBase - used to determine manditory attributes Parameters: attributeName - Name of attribute being described DataTransferObject encapsulating attribute information. |
create | public static FeatureTypeInfoDTO create(String dataStoreId, FeatureType schema)(Code) | | Construct DTO based on provided schema.
GMLUtils is used to provide the mapping to an XML type/fragement for
each attribute
Parameters: dataStoreId - Used as a backpointer to locate dataStore Parameters: schema - Real geotools2 FeatureType Data Transfer Object for provided schema |
generateAttributes | public static List generateAttributes(FeatureType schema)(Code) | | List of attributes DTO information gernated from schema.
Parameters: schema - |
generateRequiredAttributes | public static List generateRequiredAttributes(String schemaBase)(Code) | | List of attribtue DTO information generated from schemaBase.
Please note this is currently only used for display by TypesForm,
TypeInfo simply makes use of getRequiredBaseAttributes to select
AttributeTypes from the FeatureType schema.
More specifically the values of isNillable, minOccurs and maxOccurs
provided by the DataStore may not agree with the results of this
function. TypeInfo opperatates on the assumption minOccurs=1, maxOccurs=1
and AttributeType.isNillable() is correct.
Parameters: schemaBase - SchemaBase List of AttributeTypeInfoDTO representative of schemaBase requiredAttributes |
getElements | public static List getElements(String name, Class type)(Code) | | Mappings for name and type, or null if not found.
List construction order:
- Use of property types if name and exact type match one of the gml
properties references.
For name="pointProperty", type=com.vividsolutions.jts.geom.Point maps to:
gml:PointPropertyType
- Search the schema for defined types are checked for an exact match
based on type.
For type=java.lang.String maps to:
xs:string
- A linear seach of the defined types is made making use of
isAssignable.
For type=com.vividsolutions.jts.geom.Geometry maps to:
gml:PointType gml:LineStringType gml:LinearRingType gml:BoxType gml:PolygonType gml:GeometryCollectionType gml:MultiPointType gml:MultiLineStringType, gml:MultiPolygonType
- As a wild assumption we assume
xs:string can be used.
For type=java.net.URL maps to: xs:string
All mappings are consulted using using a linear search.
The list is returned in the order of most specific to least specific.
Complete Example:
name="pointProperty", class=type=com.vividsolutions.jts.geom.Point
Expected Mapping:
- gml:PointPropertyType - pointProperty & Point.class match
- gml:PointType - Point.class match
- gml:AbstractGeometry - Point instance of Geometry match
- xs:string - String assumption
Parameters: name - attribute name Parameters: type - attribtue type List of NameSpaceElements is returned in the order of most specific to least specific. |
getRequiredBaseAttributes | public static String[] getRequiredBaseAttributes(String schemaBase)(Code) | | Required Attributes for schemaBase.
This information is a hardcoded representation of what woudl be available
if we had actually parsed the GML XMLSchema.
Parameters: schemaBase - |
isManditory | public static boolean isManditory(String schemaBase, String attribute)(Code) | | Test is attribute is a required attribtue of schemaBase.
True if attribute is required for schemaBase |
|
|