HandleManager in DSpace 6?

17 views
Skip to first unread message

euler

unread,
May 8, 2020, 11:16:21 AM5/8/20
to DSpace Technical Support
Dear All,

I would like to ask for your help regarding the HandleManager class in DSpace version 5. I posted a question about this in SO [1] but unfortunately, I got no responses. It seems the HandleManager class no longer exists in DSpace 6. I used HandleManager previously on a modified FeedbackForm to extract the handle and other metadata from an item.

    String handle = parameters.getParameter("handle","unknown");
   
DSpaceObject dso = HandleManager.resolveToObject(context, handle);

   
if (!(dso instanceof Item)) {
       
return;
   
}
   
Request request = ObjectModelHelper.getRequest(objectModel);

   
Item item = (Item) dso;


   
// Build the item viewer division.
   
Division documentdelivery = body.addInteractiveDivision("DocumentDelivery-form",
            contextPath
+ "/documentdelivery/" + parameters.getParameter("handle","unknown"), Division.METHOD_POST,"primary");

Can somebody help me with how to extract the handle (and other metadata) of the referring page based on DSpace 6x? [2] I always get the "Page not found" when I try to access http://example.com/documentdelivery/123456789/1234 coming from http://example.com/handle/123456789/1234. I have been trying many combinations but I did not get what I want. I'm working on this for almost a week now and this is the only part of my customization that stopped me from upgrading our production server into version 6.4.

Any help would be greatly appreciated! Thanks in advance!
euler

Tim Donohue

unread,
May 8, 2020, 11:31:18 AM5/8/20
to euler, DSpace Technical Support
Hi Euler,

In DSpace 6, we had a larger API refactor.  So, most "Manager" style classes were replaced with a Service class.  Therefore, the HandleManager is now a HandleService. 

And here's just one example of how it can be used similarly: https://github.com/DSpace/DSpace/blob/dspace-6_x/dspace-api/src/main/java/org/dspace/checker/HandleDispatcher.java#L83  If you search the codebase though, you'll find many many more examples.

Tim

From: dspac...@googlegroups.com <dspac...@googlegroups.com> on behalf of euler <esn...@seafdec.org.ph>
Sent: Friday, May 8, 2020 10:16 AM
To: DSpace Technical Support <dspac...@googlegroups.com>
Subject: [dspace-tech] HandleManager in DSpace 6?
 
--
All messages to this mailing list should adhere to the DuraSpace Code of Conduct: https://duraspace.org/about/policies/code-of-conduct/
---
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/63405fb2-3563-4ca1-8a2b-ac87561ec6db%40googlegroups.com.

euler

unread,
May 9, 2020, 10:32:28 AM5/9/20
to DSpace Technical Support
Dear Tim,

Thanks for the information regarding the Service class. I searched the codebase and found examples that use the HandleService class. One example that is closest to my needs is the SuggestServlet also known as the Item Recommendation feature. Unfortunately, that feature is for the JSP interface. Changing my 5x code from DSpaceObject dso = HandleManager.resolveToObject(context, handle) into DSpaceObject dso = handleService.resolveToObject(context, handle), I get the Page not found error. Migrating my code to be 6x compatible is not so trivial to me. Looking at other examples is so overwhelming and daunting to me since I'm not a Java programmer. Most of my customizations are mostly based on existing code that I have little grasp of and I seldom touch the underlying Java code.

This is one of my customizations that I really need to upgrade to DSpace version 6. Since our repository contains more metadata-only items than items with restricted bitstreams, this feature is used more compared to the request a copy feature. Unfortunately for me, my skill set is not enough to upgrade my working 5x code to 6x code. Even though I offered a bounty for my question in SO hoping that it will draw more attention, it is not a guarantee that someone will post an answer for it. I'm at loss now on how to solve this and so would like to ask from this list for any help.

Thanks in advance.
Euler
To unsubscribe from this group and stop receiving emails from it, send an email to dspac...@googlegroups.com.

euler

unread,
May 10, 2020, 9:50:09 PM5/10/20
to DSpace Technical Support
Dear Tim,

Thankfully, I managed to solve my problem. I posted my answer to my SO post here: https://stackoverflow.com/a/61721051/1919069. Thank you so much for the pointers, Tim!

Thanks,
Euler
Reply all
Reply to author
Forward
0 new messages