[dryad] r5312 committed - Re-enabling doi?lookup

0 views
Skip to first unread message

dr...@googlecode.com

unread,
Mar 1, 2012, 1:36:30 PM3/1/12
to dryad-...@googlegroups.com
Revision: 5312
Author: fabio.bolognesi75
Date: Thu Mar 1 10:35:26 2012
Log: Re-enabling doi?lookup
http://code.google.com/p/dryad/source/detail?r=5312

Added:

/trunk/dryad/dspace/modules/xmlui/src/main/java/org/dspace/springmvc/DoiController.java
Modified:

/trunk/dryad/dspace/modules/doi/dspace-doi-api/src/main/java/org/dspace/doi/Minter.java

=======================================
--- /dev/null
+++
/trunk/dryad/dspace/modules/xmlui/src/main/java/org/dspace/springmvc/DoiController.java
Thu Mar 1 10:35:26 2012
@@ -0,0 +1,87 @@
+package org.dspace.springmvc;
+
+import org.dspace.app.xmlui.utils.ContextUtil;
+import org.dspace.authorize.AuthorizeException;
+import org.dspace.content.Collection;
+import org.dspace.content.DCValue;
+import org.dspace.content.DSpaceObject;
+import org.dspace.content.Item;
+import org.dspace.content.crosswalk.CrosswalkException;
+import org.dspace.content.crosswalk.DisseminationCrosswalk;
+import org.dspace.core.ConfigurationManager;
+import org.dspace.core.Context;
+import org.dspace.core.PluginManager;
+import org.dspace.doi.DOI;
+import org.dspace.doi.Minter;
+import org.dspace.identifier.IdentifierNotFoundException;
+import org.dspace.identifier.IdentifierNotResolvableException;
+import org.dspace.identifier.IdentifierService;
+import org.dspace.storage.rdbms.DatabaseManager;
+import org.dspace.storage.rdbms.TableRow;
+import org.dspace.utils.DSpace;
+import org.dspace.workflow.DryadWorkflowUtils;
+import org.dspace.workflow.WorkflowRequirementsManager;
+import org.jdom.Element;
+import org.jdom.Namespace;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.View;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.sql.SQLException;
+import java.util.Map;
+
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: fabio.bolognesi
+ * Date: 8/29/11
+ * Time: 12:24 PM
+ * To change this template use File | Settings | File Templates.
+ */
+
+@Controller
+@RequestMapping("/doi")
+public class DoiController {
+
+ private static final Logger LOGGER =
LoggerFactory.getLogger(DoiController.class);
+
+ @RequestMapping("/doi")
+ public void doiLookup(HttpServletRequest request, HttpServletResponse
response) {
+ PrintWriter writer = null;
+ try {
+ writer = response.getWriter();
+ Minter myMinter = new Minter();
+ String doiID = request.getParameter("lookup");
+ DOI doi = myMinter.getKnownDOI(doiID);
+ if(doi != null){
+
+ // return handle:
http://datadryad.org/handle/10255/dryad.20
+ //writer.println(doi.getInternalIdentifier().toString());
+
+ // return resource:
http://localhost:8100/resource/doi:10.5061/dryad.20
+ writer.println(doi.getTargetURL().toString());
+ }
+ else{
+ writer.println("DOI not present.");
+ }
+
+ } catch (Exception e) {
+ writer.println("DOI not present.");
+ }finally{
+ writer.close();
+ }
+
+ }
+}
=======================================
---
/trunk/dryad/dspace/modules/doi/dspace-doi-api/src/main/java/org/dspace/doi/Minter.java
Mon Oct 31 13:39:25 2011
+++
/trunk/dryad/dspace/modules/doi/dspace-doi-api/src/main/java/org/dspace/doi/Minter.java
Thu Mar 1 10:35:26 2012
@@ -129,6 +129,7 @@
* @return
*/
public DOI getKnownDOI(String aDOIString) {
+ if(myLocalDatabase==null) myLocalDatabase =
DOIDatabase.getInstance();
return myLocalDatabase.getByDOI(aDOIString);
}

Reply all
Reply to author
Forward
0 new messages