MaatDeamon
MaatDeamon

Reputation: 9771

Access the running DSpace Instance for update on Item from a Service on the side

I have a Service that I launch with DSpace using Spring. This service is not meant to be access from within DSpace code. It is an independent service, that read from an external service and whenever appropriate, this service should access the running DSpace instance, query the necessary item and do some update on it.

Given that based on how DSpace services instantiation are set up (Spring), I cannot inject the DSpace instance in that service (I'm using DSpace in Tomcat), I was wondering what would be the best way to achieve this.

So far the only way I see, is to use the method new Dspace() which deliver the running instance, and get what I want. This would have to be done on demand from that service, handling the case where the instance is probably not start yet.

In short I cannot inject the DSpace instance in a service that I register in DSpace, I can only use the DSpace instance by a global variable.

I just want to confirm if it is the only way, or if there is another way.

That is, is there a way to running some procedure that continuously access the DSpace instance and update its item based on what the procedure reads from an external service.

I am using DSpace 1.8.

Upvotes: 0

Views: 74

Answers (1)

Mark Wood
Mark Wood

Reputation: 354

In DSpace 1.8.x, the only ways I can think of are your method (use dspace-services-api/dspace-services-impl and dspace-api to look up, modify, and save the Item) or to directly update the database. Letting DSpace code handle the database and the assetstore for you is probably the better approach, and is the one that I would choose.

Upvotes: 1

Related Questions