There should be two options for creating a new feature type via the REST
api:
1) POST /rest/workspaces/<ws>/datastores/<store>/featureTypes
Where the content must contain the name of the feature type, along with
all the other information about attributes
or:
2) PUT to /rest/workspaces/<ws>/datastores/<store>/featureTypes/<ftName>
Where the content contains optionally the feature type name, along with
all the other information about attributes
Looked over the patch and a few comments:
* When throwing exceptions it is best to throw a RestletException and
pass in a status code, else the client will just receive a 500 (server
internal error). But for the validation cases in
FeautreTypeResource.buildFeatureType() it is more appropriate to send
back an error relaying that the client did not specify the request
properly. Probably a 400 or something.
* Rename XStreamPersister.setHideAttributes() to something more
descriptive of being applicable only to feature types,
setHideFeatureTypeAttributes() or something.
* I see some dead code in the patch for XStreamPersister? doUnmarshal()
* The change to ResourcePool:
- if (info.getAttributes() != null &&
!info.getAttributes().isEmpty()) {
+ if (info.getAttributes() != null &&
!info.getAttributes().isEmpty() &&
info.getAttributes().get(0).getBinding() != null) {
Can you explain the rationale here?
Also a heads up. One of the pains of xstream is adding new properties to
an object but also dealing with old representations of it on disk. Since
xstream does not use the default constructor any newly defined
attributes that are not in a representation will always be set to null
regardless of what the default constructor does.
So in this case when reading older configurations
AttributeTypeINfo.getBInding() and getLength() will result in null.
Perhaps this is ok... but it might be wise to implement
AttributeTypeInfoImpl.readResolve() to initialize them to sensible defaults.
Nice work on the patch. A very cool feature.
-Justin
On 3/23/10 1:04 PM, Andrea Aime wrote:
> Hi,
> I have a first patch for the above attached to
> http://jira.codehaus.org/browse/GEOS-3872
>
> I think I need a clarification though. I though we were
> going to post to a feature type description to:
> /rest/workspaces/<ws>/datastores/<store>
>
> but as far as I can see DataStoreResource already handles
> post and it does for the creation of a new store... I guess
> the stores list delegates to it for the post handling somehow.
>
> So I added the creation code into FeatureTypeResource.
> The latter was already managing POST with the assumption
> the feature type was already in the store and just needed
> to be published, with the patch it will first look to see
> if it's there, if not, it will create it and then
> configure it.
>
> I see how this can be troublesome though, a typo in the
> feature type name post-ed and an attempted configuration
> will turn into the creation of a new feature type
> (well, sort of, it will fail anyways you did not specify any
> attribute list).
>
> However, if it's considered more desirable to post directly
> to the store resources, what other changes are necessary?
>
> Cheers
> Andrea
>
> PS: I know the previous mails talked about a bigger
> change, but since this is low priority work that is
> done only when I have nothing else to do I'd prefer
> to start commiting smaller, self contained patches that
> add one bit of the overall plan at a time.
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Geoserver-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel