You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Natalia Shilenkova <ns...@gmail.com> on 2008/03/07 03:31:36 UTC
Resource insert/update
Hi All,
Recently I had to work on some code that would require to add unique
resources to Xindice database. Currently, collections can only "store"
resources, which will add new resource if the key does not exist in
the collection and will overwrite the resource with new data if key
already exists. What I needed instead was a way to "insert" or
"update" resource, where collection would get updated only if resource
with that key does not exist in case of insert or does exist in case
of update. Since Xindice does not support transactions or constraints,
I ended up creating new service that would allow user to insert/update
resources.
Are there any objections to adding this functionality to trunk?
Regards,
Natalia
Re: Resource insert/update
Posted by Natalia Shilenkova <ns...@gmail.com>.
On Wed, Mar 12, 2008 at 9:00 PM, Vadim Gritsenko <va...@reverycodes.com> wrote:
>
> On Mar 9, 2008, at 9:08 PM, Natalia Shilenkova wrote:
>
> > The interface is very straightforward:
> > void insertResource(Resource res) throws XMLDBException
> > void updateResource(Resource res) throws XMLDBException
> > void storeResource(Resource res) throws XMLDBException
>
> Ok. So storeResource() corresponds to existing
> org.xmldb.api.base.Collection.storeResource() method, while
> insertResource and updateResource will delegate to corresponding
> methods on org.apache.xindice.core.Collection?
Exactly.
> > I am not sure about service name, though. Any suggestions?
>
> Only ResourceManagementService comes to mind.
Hmm... That exactly what I named the service :) Oh well,
ResourceManagementService it is.
Regards,
Natalia
Re: Resource insert/update
Posted by Vadim Gritsenko <va...@reverycodes.com>.
On Mar 9, 2008, at 9:08 PM, Natalia Shilenkova wrote:
> On Sat, Mar 8, 2008 at 7:23 PM, Vadim Gritsenko
> <va...@reverycodes.com> wrote:
>>
>> On Mar 6, 2008, at 9:31 PM, Natalia Shilenkova wrote:
>>
>>> Recently I had to work on some code that would require to add unique
>>> resources to Xindice database. Currently, collections can only
>>> "store"
>>> resources, which will add new resource if the key does not exist in
>>> the collection and will overwrite the resource with new data if key
>>> already exists. What I needed instead was a way to "insert" or
>>> "update" resource, where collection would get updated only if
>>> resource
>>> with that key does not exist in case of insert or does exist in case
>>> of update. Since Xindice does not support transactions or
>>> constraints,
>>> I ended up creating new service that would allow user to insert/
>>> update
>>> resources.
>>>
>>> Are there any objections to adding this functionality to trunk?
>>
>> Makes sense to me. What service do you propose to add? Care to
>> describe the interface?
>
> The interface is very straightforward:
> void insertResource(Resource res) throws XMLDBException
> void updateResource(Resource res) throws XMLDBException
> void storeResource(Resource res) throws XMLDBException
Ok. So storeResource() corresponds to existing
org.xmldb.api.base.Collection.storeResource() method, while
insertResource and updateResource will delegate to corresponding
methods on org.apache.xindice.core.Collection?
> I am not sure about service name, though. Any suggestions?
Only ResourceManagementService comes to mind.
Vadim
Re: Resource insert/update
Posted by Natalia Shilenkova <ns...@gmail.com>.
On Sat, Mar 8, 2008 at 7:23 PM, Vadim Gritsenko <va...@reverycodes.com> wrote:
>
> On Mar 6, 2008, at 9:31 PM, Natalia Shilenkova wrote:
>
> > Recently I had to work on some code that would require to add unique
> > resources to Xindice database. Currently, collections can only "store"
> > resources, which will add new resource if the key does not exist in
> > the collection and will overwrite the resource with new data if key
> > already exists. What I needed instead was a way to "insert" or
> > "update" resource, where collection would get updated only if resource
> > with that key does not exist in case of insert or does exist in case
> > of update. Since Xindice does not support transactions or constraints,
> > I ended up creating new service that would allow user to insert/update
> > resources.
> >
> > Are there any objections to adding this functionality to trunk?
>
> Makes sense to me. What service do you propose to add? Care to
> describe the interface?
The interface is very straightforward:
void insertResource(Resource res) throws XMLDBException
void updateResource(Resource res) throws XMLDBException
void storeResource(Resource res) throws XMLDBException
I am not sure about service name, though. Any suggestions?
Regards,
Natalia
Re: Resource insert/update
Posted by Vadim Gritsenko <va...@reverycodes.com>.
On Mar 6, 2008, at 9:31 PM, Natalia Shilenkova wrote:
> Recently I had to work on some code that would require to add unique
> resources to Xindice database. Currently, collections can only "store"
> resources, which will add new resource if the key does not exist in
> the collection and will overwrite the resource with new data if key
> already exists. What I needed instead was a way to "insert" or
> "update" resource, where collection would get updated only if resource
> with that key does not exist in case of insert or does exist in case
> of update. Since Xindice does not support transactions or constraints,
> I ended up creating new service that would allow user to insert/update
> resources.
>
> Are there any objections to adding this functionality to trunk?
Makes sense to me. What service do you propose to add? Care to
describe the interface?
Vadim