Hi Justin

The problem is in this line of DataStoreFileResource.java (based on GS
2.0.2):

line 120:
 DataStoreInfo info = catalog.getDataStoreByName(datastore) ;

I change to:

 DataStoreInfo info = catalog.getDataStoreByName(workspace, datastore) ;

and works ok.

Also I did a small change in same file to store the shapefiles in folders
like data/workspace/datastore instead of data/datastore that can be
interesting to have by default in REST API:

line 107:
            directory = catalog.getResourceLoader().find( "data/" +
datastore );
changed to
            directory = catalog.getResourceLoader().find( "data/" +
workspace + "/" + datastore );


Regards,
Jose García

On Wed, Dec 15, 2010 at 3:55 PM, Justin Deoliveira <[email protected]>wrote:

> Hi Jose,
>
> Yes, it should be possible to have two datastores with the same name but in
> different workspaces, so probably a bug. Do you have a stack trace that
> occurs when the attempt to create the second datastore occurs?
>
> -Justin
>
> On Wed, Dec 15, 2010 at 4:12 AM, jose garcia <[email protected]> wrote:
>
>> Hi
>>
>> I did a small change in REST API to store shapefiles in
>> data/workspace/datastore instead of default data/datastore folders. The idea
>> of this is to allow to publish different shapefiles with same name (also
>> same datastore name) in different workspaces like:
>>
>> workspace1:waterways
>> workspace2:waterways
>>
>> The next call to the REST service:
>>
>> curl -u admin:geoserver -XPUT -H "Content-type: application/zip"
>> --data-binary @waterways.zip
>> http://localhost:8080/geoserver/rest/workspaces/*workspace1*
>> /datastores/waterways/file.shp
>>
>>
>>    - Creates a data folder: data/*workspace1*/waterways with waterways
>>    shapefile
>>    - Configures the datastore waterways in workspace1.
>>
>>
>> But later the next call:
>>
>> curl -u admin:geoserver -XPUT -H "Content-type: application/zip"
>> --data-binary @waterways.zip
>> http://localhost:8080/geoserver/rest/workspaces/*workspace2*
>> /datastores/waterways/file.shp
>>
>>
>>    - Creates a data folder: data/*workspace2*/waterways with waterways
>>    shapefile
>>    - A datastore waterways* in not created* in workspace2.
>>
>>
>> Is not possible to have same datastore name in different workspaces? I
>> noticed that also using GUI, i get an exception if trying to create a
>> datastore with same name i other workspace.
>>
>> Thanks and regards,
>> Jose García
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Lotusphere 2011
>> Register now for Lotusphere 2011 and learn how
>> to connect the dots, take your collaborative environment
>> to the next level, and enter the era of Social Business.
>> http://p.sf.net/sfu/lotusphere-d2d
>> _______________________________________________
>> Geoserver-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>>
>
>
> --
> Justin Deoliveira
> OpenGeo - http://opengeo.org
> Enterprise support for open source geospatial.
>
>
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to