|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectArcSDEAdapter
public class ArcSDEAdapter
Utility class to deal with SDE specifics such as creating SeQuery objects from geotool's Query's, mapping SDE types to Java ones and JTS Geometries, etc.
Constructor Summary | |
---|---|
ArcSDEAdapter()
|
Method Summary | |
---|---|
static FeatureTypeInfo |
createInprocessViewSchema(ISession session,
String typeName,
String namespace,
PlainSelect qualifiedSelect,
SeQueryInfo queryInfo)
Creates a schema for the "SQL SELECT" like view definition |
static void |
createSchema(SimpleFeatureType featureType,
Map<String,String> hints,
ISession session)
Creates the given featuretype in the underlying ArcSDE database. |
static SeColumnDefinition |
createSeColumnDefinition(AttributeDescriptor type)
Creates the column definition as used by the ArcSDE Java API, for the given AttributeType. |
static FeatureTypeInfo |
fetchSchema(String typeName,
String namespace,
ISession session)
Fetches the schema of a given ArcSDE featureclass and creates its corresponding Geotools FeatureType |
static Class<? extends Geometry> |
getGeometryTypeFromLayerMask(int seShapeType)
Returns the mapping JTS geometry type for the ArcSDE Shape type given by the bitmask seShapeType
This bitmask is composed of a combination of the following shape types, as defined in the
ArcSDE Java API:
SE_NIL_TYPE_MASK = 1;
SE_POINT_TYPE_MASK = 2;
SE_LINE_TYPE_MASK = 4;
SE_AREA_TYPE_MASK = 16;
SE_MULTIPART_TYPE_MASK = 262144;
(Note that the type SE_SIMPLE_LINE_TYPE_MASK is not used)
|
static Class<? extends Geometry> |
getGeometryTypeFromSeShape(SeShape shape)
Returns the most appropriate Geometry class that matches the shape's type. |
static Class<?> |
getJavaBinding(Integer sdeType)
Returns the Java class binding for a given SDE column type. |
static long |
getNumericFid(Identifier id)
Returns the numeric identifier of a FeatureId, given by the full qualified name of the featureclass prepended to the ArcSDE feature id. ej: SDE.SDE.SOME_LAYER.1 |
static long |
getNumericFid(String fid)
Returns the numeric identifier of a FeatureId, given by the full qualified name of the featureclass prepended to the ArcSDE feature id. ej: SDE.SDE.SOME_LAYER.1 |
static long[] |
getNumericFids(Set<Identifier> identifiers)
|
static int |
guessShapeTypes(GeometryDescriptor attribute)
|
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArcSDEAdapter()
Method Detail |
---|
public static int guessShapeTypes(GeometryDescriptor attribute)
public static SeColumnDefinition createSeColumnDefinition(AttributeDescriptor type) throws SeException
type
- the source attribute definition.
SeColumnDefinition
object matching the properties of the source
AttributeType.
SeException
- if the SeColumnDefinition constructor throws it due to some invalid parameterpublic static FeatureTypeInfo fetchSchema(String typeName, String namespace, ISession session) throws IOException
IOException
- if an exception is caught accessing the sde feature class metadata.public static FeatureTypeInfo createInprocessViewSchema(ISession session, String typeName, String namespace, PlainSelect qualifiedSelect, SeQueryInfo queryInfo) throws IOException
IOException
public static Class<?> getJavaBinding(Integer sdeType)
Mappings are:
SeColumnDefinition.TYPE_BLOB
: byte[].class this one is pending further
development, not supported currently but just ignored
SeColumnDefinition.TYPE_CLOB
: String
.class
SeColumnDefinition.TYPE_DATE
: Date
.class
SeColumnDefinition.TYPE_FLOAT32
: Float
.class
SeColumnDefinition.TYPE_FLOAT64
: Double
.class
SeColumnDefinition.TYPE_INT16
: Short
.class
SeColumnDefinition.TYPE_INT32
: Integer
.class
SeColumnDefinition.TYPE_INT64
: Long
.class
SeColumnDefinition.TYPE_NCLOB
: String
.class
SeColumnDefinition.TYPE_NSTRING
: String
.class
SeColumnDefinition.TYPE_UUID
: String
.class
Currently there're no bindings defined for:
SeColumnDefinition#TYPE_XML
SeColumnDefinition.TYPE_RASTER
To obtain the JTS Geometry class binding for an sde column of type
SeColumnDefinition.TYPE_SHAPE
use getGeometryTypeFromLayerMask(int)
.
sdeType
-
null
if its not supportedpublic static Class<? extends Geometry> getGeometryTypeFromLayerMask(int seShapeType)
seShapeType
This bitmask is composed of a combination of the following shape types, as defined in the ArcSDE Java API:
SE_NIL_TYPE_MASK = 1; SE_POINT_TYPE_MASK = 2; SE_LINE_TYPE_MASK = 4; SE_AREA_TYPE_MASK = 16; SE_MULTIPART_TYPE_MASK = 262144;(Note that the type SE_SIMPLE_LINE_TYPE_MASK is not used)
seShapeType
-
IllegalArgumentException
public static Class<? extends Geometry> getGeometryTypeFromSeShape(SeShape shape) throws SeException
Geometry
class that matches the shape's type.
shape
- SeShape instance for which to infer the matching geometry class, can't be null
SeException
- propagated if thrown by SeShape.getType()
IllegalArgumentException
- if none of the JTS geometry classes can be matched to the shape type (shouldnt
happen as for the types
defined in the esri arcsde java
api 9.0)public static long getNumericFid(Identifier id) throws IllegalArgumentException
id
- a geotools FeatureID
IllegalArgumentException
- If the given string is not properly formatted [anystring].[long value]public static long getNumericFid(String fid) throws IllegalArgumentException
id
- a geotools FeatureID
IllegalArgumentException
- If the given string is not properly formatted [anystring].[long value]public static long[] getNumericFids(Set<Identifier> identifiers) throws IllegalArgumentException
IllegalArgumentException
public static void createSchema(SimpleFeatureType featureType, Map<String,String> hints, ISession session) throws IOException, IllegalArgumentException
The common use case to create an ArcSDE layer is to setup the SeTable object with all the non-geometry attributes first, then create the SeLayer and set the geometry column name and its properties. This approach brings a nice problem, since we need to create the attributes in exactly the same order as specified in the passed FeatureType, which means that the geometry attribute needs not to be the last one.
To avoid this, the following workaround is performed: instead of creating the schema as
described above, we will first create the SeTable with a single, temporary column, since it
is not possible to create a table without columns. The, we will iterate over the
AttributeTypes and add them as they appear using
SeTable.addColumn(SeColumnDefinition)
. But if we found that the current
AttributeType is geometric, instead of adding the column we just create the SeLayer object.
This way, the geometric attribute is inserted at the end, and then we keep iterating and
adding the rest of the columns. Finally, the first column is removed, since it was temporary
(note that I advertise it, it is a _workaround_).
Sometimes some 'extra' information is required to correctly create the underlying ArcSDE
SeLayer. For instance, a specific configuration keyword might be required to be used (instead
of "DEFAULTS"), or a particular column might need to be marked as the rowid column for the
featuretype. A non-null hints
parameter contains a mapping from a list of
well-known String
keys to values. The possible keys are listed in the table
below. keys with any other values are ignored.
key name | key value type | default value (if applicable) | ||||||||
configuration.keyword | String |
"DEFAULTS" | ||||||||
rowid.column.type | String - "NONE", "USER" and "SDE" are the only valid values |
"NONE" | ||||||||
rowid.column.name | String |
null |
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |