[Dspace-tech] How to trigger post-submission processing?
Hi all, I want to trigger a programmatic process once an item has been submitted into DSpace and the handle is created - where is the best hook for that? I looked into the configurable submission non-interactive step, but I think that would run before the handle has been created and the item has been confirmed successfully submitted. Thanks, Gary GARY BROWNE | Development Programmer Library IT Services | University Library THE UNIVERSITY OF SYDNEY Level 1, Fisher Library F03 | The University of Sydney | NSW | 2006 M 0405 647 868 | F +61 2 9036 E gary.bro...@sydney.edu.au | W http://sydney.edu.au Sent from my plain old desktop computer. CRICOS 00026A This email plus any attachments to it are confidential. Any unauthorised use is strictly prohibited. If you receive this email in error, please delete it and any attachments. Please think of our environment and only print this e-mail if necessary. -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ DSpace-tech mailing list DSpace-tech@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspace-tech
Re: [Dspace-tech] How to trigger post-submission processing?
Hi Gary, On 14/11/11 14:08, Gary Browne wrote: I want to trigger a programmatic process once an item has been submitted into DSpace and the handle is created - where is the best hook for that? I looked into the configurable submission non-interactive step, but I think that would run before the handle has been created and the item has been confirmed successfully submitted. Do you want to make changes to the item? If you don't want to make any changes (for example if you want to send an e-mail to an additional recipient) then you can use a custom event handler, attached to the Item+Install event. The problem with this approach is that you can't make changes to items inside the event handler code. So if you want to make changes to the item (for example, attaching a coverpage to all PDF bitstreams in the item), the best way forward seems to be 1. write a curation task that makes the required changes to the item 2. set up a scheduled job that processes a given curation task queue very often (eg every 2 minutes) 3. set up an event handler that queues the curation task for the item, using the queue from step 2. There is code (neither pretty not terribly well-documented I'm afraid) that follows the second approach here: https://github.com/lconz-irr/Curation-Tasks. https://github.com/lconz-irr/Curation-Tasks/blob/master/src/main/java/nz/ac/lconz/irr/curate/CurateOnInstallation.java is the event consumer to queue the addcover task in the queue named continuously -- just use the same name as configured in curate.cfg for your task. You'd set this up in dspace.cfg as # consumer to queue an item for curation (addcover task, queue continuously) event.consumer.author_notify_archive.class = nz.ac.lconz.irr.curate.CurateOnInstallation event.consumer.author_notify_archive.filters = Item+Install You'll then need a crontab line (or whatever the Windows equivalent is) similar to this: */2 * * * * /usr/local/dspace/bin/dspace curate -q continuously (If you wish to follow the first approach, ie no modifications of the item needed, just set up your event consumer the same way I've set up the CurateOnInstallation consumer -- but you won't need the curation task or the cronjob.) cheers, Andrea -- Dr Andrea Schweer IRR Technical Specialist, ITS Information Systems The University of Waikato, Hamilton, New Zealand -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ DSpace-tech mailing list DSpace-tech@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspace-tech
Re: [Dspace-tech] How to trigger post-submission processing?
Thanks for your swift reply Andrea, I should be more specific - I'm running DSpace 1.6.2 which I believe doesn't have the curation system in place yet (thankfully - that 'simple' system seems way too complicated for my feeble mind). I don't want to make changes to the item. What I want to do is basically flag new/updated items, and store their details in a db for a specific export and processing operation at a later time. Could you give some more detail on the Item+Install event? In what class(es) would I find that/those? Thanks for your help, Gary GARY BROWNE | Development Programmer Library IT Services | University Library THE UNIVERSITY OF SYDNEY Level 1, Fisher Library F03 | The University of Sydney | NSW | 2006 M 0405 647 868 | F +61 2 9036 E gary.bro...@sydney.edu.au | W http://sydney.edu.au Sent from my plain old desktop computer. CRICOS 00026A This email plus any attachments to it are confidential. Any unauthorised use is strictly prohibited. If you receive this email in error, please delete it and any attachments. Please think of our environment and only print this e-mail if necessary. -Original Message- From: Andrea Schweer [mailto:schw...@waikato.ac.nz] Sent: Monday, 14 November 2011 1:09 PM To: dspace-tech@lists.sourceforge.net Subject: Re: [Dspace-tech] How to trigger post-submission processing? Hi Gary, On 14/11/11 14:08, Gary Browne wrote: I want to trigger a programmatic process once an item has been submitted into DSpace and the handle is created - where is the best hook for that? I looked into the configurable submission non-interactive step, but I think that would run before the handle has been created and the item has been confirmed successfully submitted. Do you want to make changes to the item? If you don't want to make any changes (for example if you want to send an e-mail to an additional recipient) then you can use a custom event handler, attached to the Item+Install event. The problem with this approach is that you can't make changes to items inside the event handler code. So if you want to make changes to the item (for example, attaching a coverpage to all PDF bitstreams in the item), the best way forward seems to be 1. write a curation task that makes the required changes to the item 2. set up a scheduled job that processes a given curation task queue very often (eg every 2 minutes) 3. set up an event handler that queues the curation task for the item, using the queue from step 2. There is code (neither pretty not terribly well-documented I'm afraid) that follows the second approach here: https://github.com/lconz-irr/Curation-Tasks. https://github.com/lconz-irr/Curation- Tasks/blob/master/src/main/java/nz/ac/lconz/irr/curate/CurateOnInstalla tion.java is the event consumer to queue the addcover task in the queue named continuously -- just use the same name as configured in curate.cfg for your task. You'd set this up in dspace.cfg as # consumer to queue an item for curation (addcover task, queue continuously) event.consumer.author_notify_archive.class = nz.ac.lconz.irr.curate.CurateOnInstallation event.consumer.author_notify_archive.filters = Item+Install You'll then need a crontab line (or whatever the Windows equivalent is) similar to this: */2 * * * * /usr/local/dspace/bin/dspace curate -q continuously (If you wish to follow the first approach, ie no modifications of the item needed, just set up your event consumer the same way I've set up the CurateOnInstallation consumer -- but you won't need the curation task or the cronjob.) cheers, Andrea -- Dr Andrea Schweer IRR Technical Specialist, ITS Information Systems The University of Waikato, Hamilton, New Zealand --- --- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ DSpace-tech mailing list DSpace-tech@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspace-tech -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ DSpace-tech mailing list DSpace-tech@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspace-tech
Re: [Dspace-tech] How to trigger post-submission processing?
Hi Gary, On 14/11/11 16:05, Gary Browne wrote: I should be more specific - I'm running DSpace 1.6.2 which I believe doesn't have the curation system in place yet (thankfully - that 'simple' system seems way too complicated for my feeble mind). I don't want to make changes to the item. The approach with the event consumer works in 1.6.2 as well -- but not for your case, see below. You're correct, the curation system didn't exist yet in 1.6.2 (it does take a bit of time to understand, but it's actually really powerful!). What I want to do is basically flag new/updated items, and store their details in a db for a specific export and processing operation at a later time. Could you give some more detail on the Item+Install event? In what class(es) would I find that/those? The event types are defined in org.dspace.event.Event: https://scm.dspace.org/svn/repo/dspace/tags/dspace-1.6.2/dspace-api/src/main/java/org/dspace/event/Event.java for the 1.6.2 version. Unfortunately, the Install event type wasn't introduced until 1.7 either. You could create a custom modification of the WorkflowManager class (look at the archive method) or of the InstallItem class (look at the second installItem method). But taking a step back -- if you're after both new and updated items, might it work to query the DSpace database directly? The item table has a last_modified timestamp that should be updated whenever an item is modified (including when it's made live). cheers, Andrea -- Dr Andrea Schweer IRR Technical Specialist, ITS Information Systems The University of Waikato, Hamilton, New Zealand -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ DSpace-tech mailing list DSpace-tech@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspace-tech