01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.feature;
17:
18: /**
19: * An interface for the construction of Features.
20: * <p>
21: * Geotools 2.0: As Features always require a FeatureType the best place
22: * to implement this is in the FeatureType itself,
23: * thus the FeatureType interface extends this interface. Other
24: * FeatureFactories may be implemented, but they should probably be
25: * constructed with a FeatureType.
26: * </p>
27: * <p>
28: * Geotools 2.1: This class is under revision, pleae help out with feedback.
29: * Please see experimental FeatureFactory2 (a subclass) for the current best
30: * idea of what is needed.
31: * </p>
32: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/feature/FeatureFactory.java $
33: * @version $Id: FeatureFactory.java 20651 2006-07-21 07:51:54Z jgarnett $
34: *
35: * @task REVISIT: consider a static create(Object[] attributes, String
36: * FeatureID, FeatureType type) method.
37: * @task REVISIT: move these methods directly to FeatureType? This would not
38: * allow independent FeatureFactories, but I'm not sure if those are
39: * useful at all.
40: */
41: public interface FeatureFactory {
42: /**
43: * Creates a new feature, with a generated unique featureID. This is less
44: * than ideal, as a FeatureID should be persistant over time, generally
45: * created by a datasource. This method is more for testing that doesn't
46: * need featureID.
47: *
48: * @deprecated Schema information is required
49: * @param attributes the array of attribute values
50: * @return The created feature
51: * @throws IllegalAttributeException if the FeatureType does not validate
52: * the attributes.
53: */
54: Feature create(Object[] attributes)
55: throws IllegalAttributeException;
56:
57: /**
58: * Creates a new feature, with the proper featureID.
59: *
60: * @deprecated Schema information is required
61: * @param attributes the array of attribute values.
62: * @param featureID the feature ID.
63: *
64: * @return the created feature.
65: *
66: * @throws IllegalAttributeException if the FeatureType does not validate
67: * the attributes.
68: */
69: Feature create(Object[] attributes, String featureID)
70: throws IllegalAttributeException;
71: }
|