mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
[DS-2949] Use a more flexible transformer and pass parameters to the transform.
This commit is contained in:

committed by
Mark H. Wood

parent
b6875cddaa
commit
a4caeef8ff
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.content.crosswalk;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.core.Context;
|
||||
import org.jdom.Element;
|
||||
|
||||
/**
|
||||
* Translate DSpace native metadata into an external XML format, with parameters.
|
||||
* This extends {@link DisseminationCrosswalk} by accepting a table of XSL-T global
|
||||
* parameter names and values, which will be passed to the selected transform.
|
||||
*
|
||||
* @author mhwood
|
||||
*/
|
||||
public interface ParameterizedDisseminationCrosswalk
|
||||
extends DisseminationCrosswalk
|
||||
{
|
||||
/**
|
||||
* Execute crosswalk, returning one XML root element as
|
||||
* a JDOM <code>Element</code> object.
|
||||
* This is typically the root element of a document.
|
||||
* <p>
|
||||
*
|
||||
* @param context
|
||||
* @param dso the DSpace Object whose metadata to export.
|
||||
* @param parameters
|
||||
* names and values of parameters to be passed into the transform.
|
||||
* @return root Element of the target metadata, never <code>null</code>.
|
||||
*
|
||||
* @throws CrosswalkInternalException (<code>CrosswalkException</code>) failure of the crosswalk itself.
|
||||
* @throws CrosswalkObjectNotSupported (<code>CrosswalkException</code>) Cannot crosswalk this kind of DSpace object.
|
||||
* @throws IOException I/O failure in services this calls
|
||||
* @throws SQLException Database failure in services this calls
|
||||
* @throws AuthorizeException current user not authorized for this operation.
|
||||
*/
|
||||
public Element disseminateElement(Context context, DSpaceObject dso,
|
||||
Map<String, String> parameters)
|
||||
throws CrosswalkException, IOException, SQLException, AuthorizeException;
|
||||
}
|
@@ -8,16 +8,24 @@
|
||||
package org.dspace.content.crosswalk;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.Reader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.stax.StAXSource;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.SelfNamedPlugin;
|
||||
import org.jdom.Namespace;
|
||||
import org.jdom.transform.XSLTransformException;
|
||||
import org.jdom.transform.XSLTransformer;
|
||||
|
||||
/**
|
||||
* Configurable XSLT-driven Crosswalk
|
||||
@@ -81,7 +89,7 @@ import org.jdom.transform.XSLTransformer;
|
||||
public abstract class XSLTCrosswalk extends SelfNamedPlugin
|
||||
{
|
||||
/** log4j category */
|
||||
private static Logger log = Logger.getLogger(XSLTCrosswalk.class);
|
||||
private static final Logger log = Logger.getLogger(XSLTCrosswalk.class);
|
||||
|
||||
/**
|
||||
* DSpace XML Namespace in JDOM form.
|
||||
@@ -96,16 +104,19 @@ public abstract class XSLTCrosswalk extends SelfNamedPlugin
|
||||
|
||||
/**
|
||||
* Derive list of plugin name from DSpace configuration entries
|
||||
* for crosswalks. The <em>direction</em> parameter should be either
|
||||
* "dissemination" or "submission", so it looks for keys like
|
||||
* <code>crosswalk.submission.{NAME}.stylesheet</code>
|
||||
* for crosswalks.
|
||||
*
|
||||
* @param direction
|
||||
* "dissemination" or "submission", so it looks for keys like
|
||||
* <code>crosswalk.submission.{NAME}.stylesheet</code>
|
||||
* @return names to be given to the plugins of that direction.
|
||||
*/
|
||||
protected static String[] makeAliases(String direction)
|
||||
{
|
||||
String prefix = CONFIG_PREFIX+direction+".";
|
||||
String suffix = CONFIG_STYLESHEET;
|
||||
|
||||
List<String> aliasList = new ArrayList<String>();
|
||||
List<String> aliasList = new ArrayList<>();
|
||||
Enumeration<String> pe = (Enumeration<String>)ConfigurationManager.propertyNames();
|
||||
|
||||
log.debug("XSLTCrosswalk: Looking for config prefix = "+prefix);
|
||||
@@ -121,7 +132,7 @@ public abstract class XSLTCrosswalk extends SelfNamedPlugin
|
||||
return aliasList.toArray(new String[aliasList.size()]);
|
||||
}
|
||||
|
||||
private XSLTransformer transformer = null;
|
||||
private Transformer transformer = null;
|
||||
private File transformerFile = null;
|
||||
private long transformerLastModified = 0;
|
||||
|
||||
@@ -131,7 +142,7 @@ public abstract class XSLTCrosswalk extends SelfNamedPlugin
|
||||
* "dissemination"
|
||||
* @return transformer or null if there was error initializing.
|
||||
*/
|
||||
protected XSLTransformer getTransformer(String direction)
|
||||
protected Transformer getTransformer(String direction)
|
||||
{
|
||||
if (transformerFile == null)
|
||||
{
|
||||
@@ -165,10 +176,18 @@ public abstract class XSLTCrosswalk extends SelfNamedPlugin
|
||||
{
|
||||
log.debug((transformer == null ? "Loading " : "Reloading")+
|
||||
getPluginInstanceName()+" XSLT stylesheet from "+transformerFile.toString());
|
||||
transformer = new XSLTransformer(transformerFile);
|
||||
Reader transformReader = new FileReader(transformerFile);
|
||||
|
||||
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
|
||||
XMLStreamReader xsltReader
|
||||
= inputFactory.createXMLStreamReader(transformReader);
|
||||
|
||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||
transformer = transformerFactory.newTransformer(
|
||||
new StAXSource(xsltReader));
|
||||
transformerLastModified = transformerFile.lastModified();
|
||||
}
|
||||
catch (XSLTransformException e)
|
||||
catch (TransformerConfigurationException | XMLStreamException | FileNotFoundException e)
|
||||
{
|
||||
log.error("Failed to initialize XSLTCrosswalk("+getPluginInstanceName()+"):"+e.toString());
|
||||
}
|
||||
|
@@ -14,7 +14,11 @@ import java.io.OutputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
@@ -36,8 +40,8 @@ import org.jdom.Namespace;
|
||||
import org.jdom.Verifier;
|
||||
import org.jdom.output.Format;
|
||||
import org.jdom.output.XMLOutputter;
|
||||
import org.jdom.transform.XSLTransformException;
|
||||
import org.jdom.transform.XSLTransformer;
|
||||
import org.jdom.transform.JDOMResult;
|
||||
import org.jdom.transform.JDOMSource;
|
||||
|
||||
/**
|
||||
* Configurable XSLT-driven dissemination Crosswalk
|
||||
@@ -65,16 +69,15 @@ import org.jdom.transform.XSLTransformer;
|
||||
* @author Larry Stone
|
||||
* @author Scott Phillips
|
||||
* @author Pascal-Nicolas Becker
|
||||
* @version $Revision$
|
||||
* @see XSLTCrosswalk
|
||||
*/
|
||||
public class XSLTDisseminationCrosswalk
|
||||
extends XSLTCrosswalk
|
||||
implements DisseminationCrosswalk
|
||||
implements ParameterizedDisseminationCrosswalk
|
||||
{
|
||||
/** log4j category */
|
||||
private static Logger log = Logger.getLogger(XSLTDisseminationCrosswalk.class);
|
||||
|
||||
private static final Logger log = Logger.getLogger(XSLTDisseminationCrosswalk.class);
|
||||
|
||||
/** DSpace context, will be created if XSLTDisseminationCrosswalk had been started by command-line. */
|
||||
private static Context context;
|
||||
|
||||
@@ -84,7 +87,7 @@ public class XSLTDisseminationCrosswalk
|
||||
protected static final CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
||||
protected static final ItemService itemService = ContentServiceFactory.getInstance().getItemService();
|
||||
|
||||
private static String aliases[] = makeAliases(DIRECTION);
|
||||
private static final String aliases[] = makeAliases(DIRECTION);
|
||||
|
||||
public static String[] getPluginNames()
|
||||
{
|
||||
@@ -124,7 +127,7 @@ public class XSLTDisseminationCrosswalk
|
||||
{
|
||||
log.warn("No schemaLocation for crosswalk="+myAlias+", key="+prefix+"schemaLocation");
|
||||
}
|
||||
|
||||
|
||||
// sanity check: schemaLocation should have space.
|
||||
else if (schemaLocation.length() > 0 && schemaLocation.indexOf(' ') < 0)
|
||||
{
|
||||
@@ -137,7 +140,7 @@ public class XSLTDisseminationCrosswalk
|
||||
// crosswalk.diss.{PLUGIN_NAME}.namespace.{PREFIX} = {URI}
|
||||
String nsPrefix = prefix + "namespace.";
|
||||
Enumeration<String> pe = (Enumeration<String>)ConfigurationManager.propertyNames();
|
||||
List<Namespace> nsList = new ArrayList<Namespace>();
|
||||
List<Namespace> nsList = new ArrayList<>();
|
||||
while (pe.hasMoreElements())
|
||||
{
|
||||
String key = pe.nextElement();
|
||||
@@ -190,13 +193,16 @@ public class XSLTDisseminationCrosswalk
|
||||
return schemaLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disseminate the DSpace item, collection, or community.
|
||||
*
|
||||
* @see DisseminationCrosswalk
|
||||
*/
|
||||
@Override
|
||||
public Element disseminateElement(Context context, DSpaceObject dso)
|
||||
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
||||
{
|
||||
return disseminateElement(context, dso, new HashMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element disseminateElement(Context context, DSpaceObject dso,
|
||||
Map<String, String> parameters)
|
||||
throws CrosswalkException,
|
||||
IOException, SQLException, AuthorizeException
|
||||
{
|
||||
@@ -210,21 +216,27 @@ public class XSLTDisseminationCrosswalk
|
||||
|
||||
init();
|
||||
|
||||
XSLTransformer xform = getTransformer(DIRECTION);
|
||||
Transformer xform = getTransformer(DIRECTION);
|
||||
if (xform == null)
|
||||
{
|
||||
throw new CrosswalkInternalException("Failed to initialize transformer, probably error loading stylesheet.");
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> parameter : parameters.entrySet())
|
||||
{
|
||||
xform.setParameter(parameter.getKey(), parameter.getValue());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Document ddim = new Document(createDIM(dso));
|
||||
Document result = xform.transform(ddim);
|
||||
Element root = result.getRootElement();
|
||||
JDOMResult result = new JDOMResult();
|
||||
xform.transform(new JDOMSource(ddim), result);
|
||||
Element root = result.getDocument().getRootElement();
|
||||
root.detach();
|
||||
return root;
|
||||
}
|
||||
catch (XSLTransformException e)
|
||||
catch (TransformerException e)
|
||||
{
|
||||
log.error("Got error: "+e.toString());
|
||||
throw new CrosswalkInternalException("XSL translation failed: "+e.toString(), e);
|
||||
@@ -251,7 +263,7 @@ public class XSLTDisseminationCrosswalk
|
||||
|
||||
init();
|
||||
|
||||
XSLTransformer xform = getTransformer(DIRECTION);
|
||||
Transformer xform = getTransformer(DIRECTION);
|
||||
if (xform == null)
|
||||
{
|
||||
throw new CrosswalkInternalException("Failed to initialize transformer, probably error loading stylesheet.");
|
||||
@@ -259,9 +271,11 @@ public class XSLTDisseminationCrosswalk
|
||||
|
||||
try
|
||||
{
|
||||
return xform.transform(createDIM(dso).getChildren());
|
||||
JDOMResult result = new JDOMResult();
|
||||
xform.transform(new JDOMSource(createDIM(dso).getChildren()), result);
|
||||
return result.getResult();
|
||||
}
|
||||
catch (XSLTransformException e)
|
||||
catch (TransformerException e)
|
||||
{
|
||||
log.error("Got error: "+e.toString());
|
||||
throw new CrosswalkInternalException("XSL translation failed: "+e.toString(), e);
|
||||
@@ -494,7 +508,7 @@ public class XSLTDisseminationCrosswalk
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simple command-line rig for testing the DIM output of a stylesheet.
|
||||
* Usage: java XSLTDisseminationCrosswalk <crosswalk-name> <handle> [output-file]
|
||||
@@ -508,7 +522,7 @@ public class XSLTDisseminationCrosswalk
|
||||
log.error("You started Dissemination Crosswalk Test/Export with a wrong number of parameters.");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
String xwalkname = argv[0];
|
||||
String handle = argv[1];
|
||||
OutputStream out = System.out;
|
||||
@@ -525,18 +539,20 @@ public class XSLTDisseminationCrosswalk
|
||||
}
|
||||
}
|
||||
|
||||
DisseminationCrosswalk xwalk = (DisseminationCrosswalk) CoreServiceFactory.getInstance().getPluginService().getNamedPlugin(
|
||||
DisseminationCrosswalk.class, xwalkname);
|
||||
DisseminationCrosswalk xwalk
|
||||
= (DisseminationCrosswalk) CoreServiceFactory.getInstance()
|
||||
.getPluginService()
|
||||
.getNamedPlugin(DisseminationCrosswalk.class, xwalkname);
|
||||
if (xwalk == null)
|
||||
{
|
||||
System.err.println("Error: Cannot find a DisseminationCrosswalk plugin for: \"" + xwalkname + "\"");
|
||||
log.error("Cannot find the Dissemination Crosswalk plugin.");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
context = new Context();
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
||||
|
||||
DSpaceObject dso = null;
|
||||
try
|
||||
{
|
||||
@@ -547,26 +563,26 @@ public class XSLTDisseminationCrosswalk
|
||||
System.err.println("Error: A problem with the database connection occurred, check logs for further information.");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (null == dso)
|
||||
{
|
||||
System.err.println("Can't find a DSpaceObject with the handle \"" + handle + "\"");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (!xwalk.canDisseminate(dso))
|
||||
{
|
||||
System.err.println("Dissemination Crosswalk can't disseminate this DSpaceObject.");
|
||||
log.error("Dissemination Crosswalk can't disseminate this DSpaceObject.");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
Element root = null;
|
||||
try
|
||||
{
|
||||
root = xwalk.disseminateElement(context, dso);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (CrosswalkException | IOException | SQLException | AuthorizeException e)
|
||||
{
|
||||
// as this script is for testing dissemination crosswalks, we want
|
||||
// verbose information in case of an exception.
|
||||
@@ -581,7 +597,7 @@ public class XSLTDisseminationCrosswalk
|
||||
log.error(e.getStackTrace());
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
XMLOutputter xmlout = new XMLOutputter(Format.getPrettyFormat());
|
||||
@@ -603,7 +619,7 @@ public class XSLTDisseminationCrosswalk
|
||||
log.error(e.getStackTrace());
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
context.complete();
|
||||
if (out instanceof FileOutputStream)
|
||||
{
|
||||
|
@@ -12,6 +12,8 @@ import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
@@ -36,8 +38,8 @@ import org.jdom.Element;
|
||||
import org.jdom.input.SAXBuilder;
|
||||
import org.jdom.output.Format;
|
||||
import org.jdom.output.XMLOutputter;
|
||||
import org.jdom.transform.XSLTransformException;
|
||||
import org.jdom.transform.XSLTransformer;
|
||||
import org.jdom.transform.JDOMResult;
|
||||
import org.jdom.transform.JDOMSource;
|
||||
|
||||
/**
|
||||
* Configurable XSLT-driven ingestion Crosswalk
|
||||
@@ -45,7 +47,6 @@ import org.jdom.transform.XSLTransformer;
|
||||
* See the XSLTCrosswalk superclass for details on configuration.
|
||||
*
|
||||
* @author Larry Stone
|
||||
* @version $Revision$
|
||||
* @see XSLTCrosswalk
|
||||
*/
|
||||
public class XSLTIngestionCrosswalk
|
||||
@@ -57,7 +58,7 @@ public class XSLTIngestionCrosswalk
|
||||
|
||||
private static final String DIRECTION = "submission";
|
||||
|
||||
private static String aliases[] = makeAliases(DIRECTION);
|
||||
private static final String aliases[] = makeAliases(DIRECTION);
|
||||
|
||||
private static final CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
|
||||
private static final CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
||||
@@ -106,7 +107,7 @@ public class XSLTIngestionCrosswalk
|
||||
{
|
||||
qualifier = null;
|
||||
}
|
||||
|
||||
|
||||
if ((authority != null && authority.length() > 0) ||
|
||||
(sconf != null && sconf.length() > 0))
|
||||
{
|
||||
@@ -127,21 +128,23 @@ public class XSLTIngestionCrosswalk
|
||||
* they are simply executed.
|
||||
*/
|
||||
@Override
|
||||
public void ingest(Context context, DSpaceObject dso, List<Element> metadata, boolean createMissingMetadataFields)
|
||||
public void ingest(Context context, DSpaceObject dso, List<Element> metadata,
|
||||
boolean createMissingMetadataFields)
|
||||
throws CrosswalkException,
|
||||
IOException, SQLException, AuthorizeException
|
||||
{
|
||||
XSLTransformer xform = getTransformer(DIRECTION);
|
||||
Transformer xform = getTransformer(DIRECTION);
|
||||
if (xform == null)
|
||||
{
|
||||
throw new CrosswalkInternalException("Failed to initialize transformer, probably error loading stylesheet.");
|
||||
}
|
||||
try
|
||||
{
|
||||
List dimList = xform.transform(metadata);
|
||||
ingestDIM(context, dso, dimList, createMissingMetadataFields);
|
||||
JDOMResult result = new JDOMResult();
|
||||
xform.transform(new JDOMSource(metadata), result);
|
||||
ingestDIM(context, dso, result.getResult(), createMissingMetadataFields);
|
||||
}
|
||||
catch (XSLTransformException e)
|
||||
catch (TransformerException e)
|
||||
{
|
||||
log.error("Got error: "+e.toString());
|
||||
throw new CrosswalkInternalException("XSL Transformation failed: "+e.toString(), e);
|
||||
@@ -157,17 +160,20 @@ public class XSLTIngestionCrosswalk
|
||||
public void ingest(Context context, DSpaceObject dso, Element root, boolean createMissingMetadataFields)
|
||||
throws CrosswalkException, IOException, SQLException, AuthorizeException
|
||||
{
|
||||
XSLTransformer xform = getTransformer(DIRECTION);
|
||||
Transformer xform = getTransformer(DIRECTION);
|
||||
if (xform == null)
|
||||
{
|
||||
throw new CrosswalkInternalException("Failed to initialize transformer, probably error loading stylesheet.");
|
||||
}
|
||||
try
|
||||
{
|
||||
Document dimDoc = xform.transform(new Document((Element)root.clone()));
|
||||
JDOMSource source = new JDOMSource(new Document((Element)root.cloneContent()));
|
||||
JDOMResult result = new JDOMResult();
|
||||
xform.transform(source, result);
|
||||
Document dimDoc = result.getDocument();
|
||||
ingestDIM(context, dso, dimDoc.getRootElement().getChildren(), createMissingMetadataFields);
|
||||
}
|
||||
catch (XSLTransformException e)
|
||||
catch (TransformerException e)
|
||||
{
|
||||
log.error("Got error: "+e.toString());
|
||||
throw new CrosswalkInternalException("XSL Transformation failed: "+e.toString(), e);
|
||||
@@ -295,7 +301,7 @@ public class XSLTIngestionCrosswalk
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
XSLTransformer xform = ((XSLTIngestionCrosswalk)xwalk).getTransformer(DIRECTION);
|
||||
Transformer xform = ((XSLTIngestionCrosswalk)xwalk).getTransformer(DIRECTION);
|
||||
if (xform == null)
|
||||
{
|
||||
throw new CrosswalkInternalException("Failed to initialize transformer, probably error loading stylesheet.");
|
||||
@@ -304,16 +310,21 @@ public class XSLTIngestionCrosswalk
|
||||
SAXBuilder builder = new SAXBuilder();
|
||||
Document inDoc = builder.build(new FileInputStream(argv[i+1]));
|
||||
XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
|
||||
Document dimDoc = null;
|
||||
List dimList = null;
|
||||
List dimList;
|
||||
if (list)
|
||||
{
|
||||
dimList = xform.transform(inDoc.getRootElement().getChildren());
|
||||
JDOMSource source = new JDOMSource(inDoc.getRootElement().getChildren());
|
||||
JDOMResult result = new JDOMResult();
|
||||
xform.transform(source, result);
|
||||
dimList = result.getResult();
|
||||
outputter.output(dimList, System.out);
|
||||
}
|
||||
else
|
||||
{
|
||||
dimDoc = xform.transform(inDoc);
|
||||
JDOMSource source = new JDOMSource(inDoc);
|
||||
JDOMResult result = new JDOMResult();
|
||||
xform.transform(source, result);
|
||||
Document dimDoc = result.getDocument();
|
||||
outputter.output(dimDoc, System.out);
|
||||
dimList = dimDoc.getRootElement().getChildren();
|
||||
}
|
||||
|
@@ -8,24 +8,33 @@
|
||||
|
||||
package org.dspace.identifier;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.crosswalk.CrosswalkException;
|
||||
import org.dspace.content.crosswalk.DisseminationCrosswalk;
|
||||
import org.dspace.content.crosswalk.ParameterizedDisseminationCrosswalk;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.factory.CoreServiceFactory;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.utils.DSpace;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.output.XMLOutputter;
|
||||
|
||||
/**
|
||||
* Provide XML based metadata crosswalk for EZID Identifier provider module.
|
||||
*
|
||||
*
|
||||
* @author mohideen
|
||||
*/
|
||||
|
||||
public class DataCiteXMLCreator
|
||||
{
|
||||
/** log4j category */
|
||||
private static Logger log = Logger.getLogger(DataCiteXMLCreator.class);
|
||||
private static final Logger log = Logger.getLogger(DataCiteXMLCreator.class);
|
||||
|
||||
/**
|
||||
* Name of crosswalk to convert metadata into DataCite Metadata Scheme.
|
||||
@@ -37,7 +46,7 @@ public class DataCiteXMLCreator
|
||||
* name of the crosswalk is set by {@link setDisseminationCrosswalk(String)
|
||||
* setDisseminationCrosswalk} which instantiates the crosswalk.
|
||||
*/
|
||||
protected DisseminationCrosswalk xwalk;
|
||||
protected ParameterizedDisseminationCrosswalk xwalk;
|
||||
|
||||
public String getXMLString(Context context, DSpaceObject dso)
|
||||
{
|
||||
@@ -57,12 +66,26 @@ public class DataCiteXMLCreator
|
||||
return null;
|
||||
}
|
||||
|
||||
Element root = null;
|
||||
// Set the transform's parameters.
|
||||
// XXX Should the actual list be configurable?
|
||||
ConfigurationService cfg = new DSpace().getConfigurationService();
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
if (null != cfg.getProperty("identifier.doi.prefix"))
|
||||
parameters.put("prefix", cfg.getProperty("identifier.doi.prefix"));
|
||||
if (null != cfg.getProperty("crosswalk.dissemination.DataCite.publisher"))
|
||||
parameters.put("publisher", cfg.getProperty("crosswalk.dissemination.DataCite.publisher"));
|
||||
if (null != cfg.getProperty("crosswalk.dissemination.DataCite.dataManager"))
|
||||
parameters.put("datamanager", cfg.getProperty("crosswalk.dissemination.DataCite.dataManager"));
|
||||
if (null != cfg.getProperty("crosswalk.dissemination.DataCite.hostingInstitution"))
|
||||
parameters.put("hostinginstitution", cfg.getProperty("crosswalk.dissemination.DataCite.hostingInstitution"));
|
||||
|
||||
// Transform the metadata
|
||||
Element root;
|
||||
try
|
||||
{
|
||||
root = xwalk.disseminateElement(context, dso);
|
||||
root = xwalk.disseminateElement(context, dso, parameters);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (CrosswalkException | IOException | SQLException | AuthorizeException e)
|
||||
{
|
||||
log.error(
|
||||
"Exception while crosswolking DSO " + "with type "
|
||||
@@ -73,13 +96,12 @@ public class DataCiteXMLCreator
|
||||
XMLOutputter xOut = new XMLOutputter();
|
||||
|
||||
return xOut.outputString(root);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the dissemination crosswalk used to convert the metadata
|
||||
* into DataCite Metadata Schema. Used by spring dependency injection.
|
||||
*
|
||||
*
|
||||
* @param CROSSWALK_NAME
|
||||
* The name of the dissemination crosswalk to use.
|
||||
*/
|
||||
@@ -93,8 +115,9 @@ public class DataCiteXMLCreator
|
||||
if (null != this.xwalk)
|
||||
return;
|
||||
|
||||
this.xwalk = (DisseminationCrosswalk) CoreServiceFactory.getInstance().getPluginService().getNamedPlugin(
|
||||
DisseminationCrosswalk.class, this.CROSSWALK_NAME);
|
||||
this.xwalk = (ParameterizedDisseminationCrosswalk) CoreServiceFactory
|
||||
.getInstance().getPluginService()
|
||||
.getNamedPlugin(DisseminationCrosswalk.class, this.CROSSWALK_NAME);
|
||||
|
||||
if (this.xwalk == null)
|
||||
{
|
||||
|
@@ -12,25 +12,25 @@
|
||||
xmlns:dspace="http://www.dspace.org/xmlns/dspace/dim"
|
||||
xmlns="http://datacite.org/schema/kernel-2.2"
|
||||
version="1.0">
|
||||
|
||||
|
||||
<!-- CONFIGURATION -->
|
||||
<!-- The content of the following variable will be used as element publisher. -->
|
||||
<xsl:variable name="publisher">My University</xsl:variable>
|
||||
<xsl:param name="publisher">My University</xsl:param>
|
||||
<!-- The content of the following variable will be used as element contributor with contributorType datamanager. -->
|
||||
<xsl:variable name="datamanager"><xsl:value-of select="$publisher" /></xsl:variable>
|
||||
<xsl:param name="datamanager"><xsl:value-of select="$publisher" /></xsl:param>
|
||||
<!-- The content of the following variable will be used as element contributor with contributorType hostingInstitution. -->
|
||||
<xsl:variable name="hostinginstitution"><xsl:value-of select="$publisher" /></xsl:variable>
|
||||
<xsl:param name="hostinginstitution"><xsl:value-of select="$publisher" /></xsl:param>
|
||||
<!-- Please take a look into the DataCite schema documentation if you want to know how to use these elements.
|
||||
http://schema.datacite.org -->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- DO NOT CHANGE ANYTHING BELOW THIS LINE EXCEPT YOU REALLY KNOW WHAT YOU ARE DOING! -->
|
||||
|
||||
|
||||
<xsl:output method="xml" indent="yes" encoding="utf-8" />
|
||||
|
||||
|
||||
<!-- Don't copy everything by default! -->
|
||||
<xsl:template match="@* | text()" />
|
||||
|
||||
|
||||
<xsl:template match="/dspace:dim[@dspaceType='ITEM']">
|
||||
<!--
|
||||
org.dspace.identifier.doi.DataCiteConnector uses this XSLT to
|
||||
@@ -43,19 +43,19 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://datacite.org/schema/kernel-2.2 http://schema.datacite.org/meta/kernel-2.2/metadata.xsd">
|
||||
|
||||
<!--
|
||||
<!--
|
||||
MANDATORY PROPERTIES
|
||||
-->
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (1)
|
||||
Template Call for DOI identifier.
|
||||
-->
|
||||
-->
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='identifier' and starts-with(., 'http://dx.doi.org/')]" />
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (2)
|
||||
Add creator information.
|
||||
Add creator information.
|
||||
-->
|
||||
<creators>
|
||||
<xsl:choose>
|
||||
@@ -70,9 +70,9 @@
|
||||
</xsl:choose>
|
||||
</creators>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (3)
|
||||
Add Title information.
|
||||
Add Title information.
|
||||
-->
|
||||
<titles>
|
||||
<xsl:choose>
|
||||
@@ -84,8 +84,8 @@
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</titles>
|
||||
|
||||
<!--
|
||||
|
||||
<!--
|
||||
DataCite (4)
|
||||
Add Publisher information from configuration above
|
||||
-->
|
||||
@@ -93,7 +93,7 @@
|
||||
<xsl:value-of select="$publisher" />
|
||||
</publisher>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (5)
|
||||
Add PublicationYear information
|
||||
-->
|
||||
@@ -112,31 +112,31 @@
|
||||
</xsl:choose>
|
||||
</publicationYear>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
OPTIONAL PROPERTIES
|
||||
-->
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (6)
|
||||
Template Call for subjects.
|
||||
-->
|
||||
-->
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='subject']">
|
||||
<subjects>
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='subject']" />
|
||||
</subjects>
|
||||
</xsl:if>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (7)
|
||||
Add contributorType from configuration above.
|
||||
Template Call for Contributors
|
||||
-->
|
||||
-->
|
||||
<contributors>
|
||||
<xsl:element name="contributor">
|
||||
<xsl:attribute name="contributorType">DataManager</xsl:attribute>
|
||||
<xsl:element name="contributorName">
|
||||
<xsl:value-of select="$datamanager"/>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
<xsl:element name="contributor">
|
||||
<xsl:attribute name="contributorType">HostingInstitution</xsl:attribute>
|
||||
@@ -147,10 +147,10 @@
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='contributor'][not(@qualifier='author')]" />
|
||||
</contributors>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (8)
|
||||
Template Call for Dates
|
||||
-->
|
||||
-->
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='date']" >
|
||||
<dates>
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='date']" />
|
||||
@@ -163,10 +163,10 @@
|
||||
<!-- Add resource type. -->
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='type']" />
|
||||
|
||||
<!--
|
||||
<!--
|
||||
Add alternativeIdentifiers.
|
||||
This element is important as it is used to recognize for which
|
||||
DSpace object a DOI is reserved for. See below for further
|
||||
DSpace object a DOI is reserved for. See below for further
|
||||
information.
|
||||
-->
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='identifier' and not(starts-with(., 'http://dx.doi.org/'))]">
|
||||
@@ -177,18 +177,18 @@
|
||||
|
||||
<!-- Add sizes. -->
|
||||
<!--
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='format' and @qualifier='extent']">
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='format' and @qualifier='extent']">
|
||||
<sizes>
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='format' and @qualifier='extent']" />
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='format' and @qualifier='extent']" />
|
||||
</sizes>
|
||||
</xsl:if>
|
||||
-->
|
||||
|
||||
<!-- Add formats. -->
|
||||
<!--
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='format']">
|
||||
<formats>
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='format']" />
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='format']">
|
||||
<formats>
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='format']" />
|
||||
</formats>
|
||||
</xsl:if>
|
||||
-->
|
||||
@@ -205,7 +205,7 @@
|
||||
|
||||
</resource>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<!-- Add doi identifier information. -->
|
||||
<xsl:template match="dspace:field[@mdschema='dc' and @element='identifier' and starts-with(., 'http://dx.doi.org/')]">
|
||||
@@ -213,7 +213,7 @@
|
||||
<xsl:value-of select="substring(., 19)"/>
|
||||
</identifier>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- DataCite (2) :: Creator -->
|
||||
<xsl:template match="//dspace:field[@mdschema='dc' and @element='contributor' and @qualifier='author']">
|
||||
<creator>
|
||||
@@ -233,14 +233,14 @@
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (6), DataCite (6.1)
|
||||
Adds subject and subjectScheme information
|
||||
|
||||
"This term is intended to be used with non-literal values as defined in the
|
||||
DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).
|
||||
As of December 2007, the DCMI Usage Board is seeking a way to express
|
||||
this intention with a formal range declaration."
|
||||
|
||||
"This term is intended to be used with non-literal values as defined in the
|
||||
DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).
|
||||
As of December 2007, the DCMI Usage Board is seeking a way to express
|
||||
this intention with a formal range declaration."
|
||||
(http://dublincore.org/documents/dcmi-terms/#terms-subject)
|
||||
-->
|
||||
<xsl:template match="//dspace:field[@mdschema='dc' and @element='subject']">
|
||||
@@ -252,12 +252,12 @@
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
DataCite (7), DataCite (7.1)
|
||||
<!--
|
||||
DataCite (7), DataCite (7.1)
|
||||
Adds contributor and contributorType information
|
||||
-->
|
||||
<xsl:template match="//dspace:field[@mdschema='dc' and @element='contributor'][not(@qualifier='author')]">
|
||||
<xsl:if test="@qualifier='editor'">
|
||||
<xsl:if test="@qualifier='editor'">
|
||||
<xsl:element name="contributor">
|
||||
<xsl:attribute name="contributorType">Editor</xsl:attribute>
|
||||
<contributorName>
|
||||
@@ -267,7 +267,7 @@
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (8), DataCite (8.1)
|
||||
Adds Date and dateType information
|
||||
-->
|
||||
@@ -303,7 +303,7 @@
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (9)
|
||||
Adds Language information
|
||||
Transforming the language flags according to ISO 639-2/B & ISO 639-3
|
||||
@@ -323,7 +323,7 @@
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (10), DataCite (10.1)
|
||||
Adds resourceType and resourceTypeGeneral information
|
||||
-->
|
||||
@@ -366,7 +366,7 @@
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
DataCite (11), DataCite (11.1)
|
||||
DataCite (11), DataCite (11.1)
|
||||
Adds AlternativeIdentifier and alternativeIdentifierType information
|
||||
Adds all identifiers except the doi.
|
||||
|
||||
@@ -386,11 +386,11 @@
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
DataCite (12), DataCite (12.1)
|
||||
DataCite (12), DataCite (12.1)
|
||||
Adds RelatedIdentifier and relatedIdentifierType information
|
||||
-->
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (13)
|
||||
Adds Size information
|
||||
-->
|
||||
@@ -400,7 +400,7 @@
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (14)
|
||||
Adds Format information
|
||||
-->
|
||||
@@ -410,7 +410,7 @@
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (16)
|
||||
Adds Rights information
|
||||
-->
|
||||
@@ -419,15 +419,15 @@
|
||||
<xsl:value-of select="." />
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
|
||||
<!--
|
||||
DataCite (17)
|
||||
Description
|
||||
-->
|
||||
<xsl:template match="//dspace:field[@mdschema='dc' and @element='description'][not(@qualifier='provenance')]">
|
||||
<xsl:element name="description">
|
||||
<xsl:attribute name="descriptionType">
|
||||
<xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@qualifier='abstract'">Abstract</xsl:when>
|
||||
<xsl:otherwise>Other</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
@@ -435,5 +435,5 @@
|
||||
<xsl:value-of select="." />
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@@ -11,25 +11,25 @@
|
||||
xmlns:dspace="http://www.dspace.org/xmlns/dspace/dim"
|
||||
xmlns="http://datacite.org/schema/kernel-2.2"
|
||||
version="1.0">
|
||||
|
||||
|
||||
<!-- CONFIGURATION -->
|
||||
<!-- The content of the following variable will be used as element publisher. -->
|
||||
<xsl:variable name="publisher">My University</xsl:variable>
|
||||
<xsl:param name="publisher">My University</xsl:param>
|
||||
<!-- The content of the following variable will be used as element contributor with contributorType datamanager. -->
|
||||
<xsl:variable name="datamanager"><xsl:value-of select="$publisher" /></xsl:variable>
|
||||
<xsl:param name="datamanager"><xsl:value-of select="$publisher" /></xsl:param>
|
||||
<!-- The content of the following variable will be used as element contributor with contributorType hostingInstitution. -->
|
||||
<xsl:variable name="hostinginstitution"><xsl:value-of select="$publisher" /></xsl:variable>
|
||||
<xsl:param name="hostinginstitution"><xsl:value-of select="$publisher" /></xsl:param>
|
||||
<!-- Please take a look into the DataCite schema documentation if you want to know how to use these elements.
|
||||
http://schema.datacite.org -->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- DO NOT CHANGE ANYTHING BELOW THIS LINE EXCEPT YOU REALLY KNOW WHAT YOU ARE DOING! -->
|
||||
|
||||
|
||||
<xsl:output method="xml" indent="yes" encoding="utf-8" />
|
||||
|
||||
|
||||
<!-- Don't copy everything by default! -->
|
||||
<xsl:template match="@* | text()" />
|
||||
|
||||
|
||||
<xsl:template match="/dspace:dim[@dspaceType='ITEM']">
|
||||
<!--
|
||||
org.dspace.identifier.doi.DataCiteConnector uses this XSLT to
|
||||
@@ -42,18 +42,18 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://datacite.org/schema/kernel-2.2 http://schema.datacite.org/meta/kernel-2.2/metadata.xsd">
|
||||
|
||||
<!--
|
||||
<!--
|
||||
MANDATORY PROPERTIES
|
||||
-->
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (1)
|
||||
Dummy element for DOI identifier, which is not yet assigned.
|
||||
-->
|
||||
-->
|
||||
<identifier type='DOI'/>
|
||||
<!--
|
||||
<!--
|
||||
DataCite (2)
|
||||
Add creator information.
|
||||
Add creator information.
|
||||
-->
|
||||
<creators>
|
||||
<xsl:choose>
|
||||
@@ -68,9 +68,9 @@
|
||||
</xsl:choose>
|
||||
</creators>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (3)
|
||||
Add Title information.
|
||||
Add Title information.
|
||||
-->
|
||||
<titles>
|
||||
<xsl:choose>
|
||||
@@ -82,8 +82,8 @@
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</titles>
|
||||
|
||||
<!--
|
||||
|
||||
<!--
|
||||
DataCite (4)
|
||||
Add Publisher information from configuration above
|
||||
-->
|
||||
@@ -91,7 +91,7 @@
|
||||
<xsl:value-of select="$publisher" />
|
||||
</publisher>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (5)
|
||||
Add PublicationYear information
|
||||
-->
|
||||
@@ -110,31 +110,31 @@
|
||||
</xsl:choose>
|
||||
</publicationYear>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
OPTIONAL PROPERTIES
|
||||
-->
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (6)
|
||||
Template Call for subjects.
|
||||
-->
|
||||
-->
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='subject']">
|
||||
<subjects>
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='subject']" />
|
||||
</subjects>
|
||||
</xsl:if>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (7)
|
||||
Add contributorType from configuration above.
|
||||
Template Call for Contributors
|
||||
-->
|
||||
-->
|
||||
<contributors>
|
||||
<xsl:element name="contributor">
|
||||
<xsl:attribute name="contributorType">DataManager</xsl:attribute>
|
||||
<xsl:element name="contributorName">
|
||||
<xsl:value-of select="$datamanager"/>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
<xsl:element name="contributor">
|
||||
<xsl:attribute name="contributorType">HostingInstitution</xsl:attribute>
|
||||
@@ -145,10 +145,10 @@
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='contributor'][not(@qualifier='author')]" />
|
||||
</contributors>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (8)
|
||||
Template Call for Dates
|
||||
-->
|
||||
-->
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='date']" >
|
||||
<dates>
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='date']" />
|
||||
@@ -161,10 +161,10 @@
|
||||
<!-- Add resource type. -->
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='type']" />
|
||||
|
||||
<!--
|
||||
<!--
|
||||
Add alternativeIdentifiers.
|
||||
This element is important as it is used to recognize for which
|
||||
DSpace object a DOI is reserved for. See below for further
|
||||
DSpace object a DOI is reserved for. See below for further
|
||||
information.
|
||||
-->
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='identifier' and not(starts-with(., 'http://dx.doi.org/'))]">
|
||||
@@ -175,18 +175,18 @@
|
||||
|
||||
<!-- Add sizes. -->
|
||||
<!--
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='format' and @qualifier='extent']">
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='format' and @qualifier='extent']">
|
||||
<sizes>
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='format' and @qualifier='extent']" />
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='format' and @qualifier='extent']" />
|
||||
</sizes>
|
||||
</xsl:if>
|
||||
-->
|
||||
|
||||
<!-- Add formats. -->
|
||||
<!--
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='format']">
|
||||
<formats>
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='format']" />
|
||||
<xsl:if test="//dspace:field[@mdschema='dc' and @element='format']">
|
||||
<formats>
|
||||
<xsl:apply-templates select="//dspace:field[@mdschema='dc' and @element='format']" />
|
||||
</formats>
|
||||
</xsl:if>
|
||||
-->
|
||||
@@ -203,7 +203,7 @@
|
||||
|
||||
</resource>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<!-- Add doi identifier information. -->
|
||||
<xsl:template match="dspace:field[@mdschema='dc' and @element='identifier' and starts-with(., 'http://dx.doi.org/')]">
|
||||
@@ -211,7 +211,7 @@
|
||||
<xsl:value-of select="substring(., 19)"/>
|
||||
</identifier>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- DataCite (2) :: Creator -->
|
||||
<xsl:template match="//dspace:field[@mdschema='dc' and @element='contributor' and @qualifier='author']">
|
||||
<creator>
|
||||
@@ -231,14 +231,14 @@
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (6), DataCite (6.1)
|
||||
Adds subject and subjectScheme information
|
||||
|
||||
"This term is intended to be used with non-literal values as defined in the
|
||||
DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).
|
||||
As of December 2007, the DCMI Usage Board is seeking a way to express
|
||||
this intention with a formal range declaration."
|
||||
|
||||
"This term is intended to be used with non-literal values as defined in the
|
||||
DCMI Abstract Model (http://dublincore.org/documents/abstract-model/).
|
||||
As of December 2007, the DCMI Usage Board is seeking a way to express
|
||||
this intention with a formal range declaration."
|
||||
(http://dublincore.org/documents/dcmi-terms/#terms-subject)
|
||||
-->
|
||||
<xsl:template match="//dspace:field[@mdschema='dc' and @element='subject']">
|
||||
@@ -250,12 +250,12 @@
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
DataCite (7), DataCite (7.1)
|
||||
<!--
|
||||
DataCite (7), DataCite (7.1)
|
||||
Adds contributor and contributorType information
|
||||
-->
|
||||
<xsl:template match="//dspace:field[@mdschema='dc' and @element='contributor'][not(@qualifier='author')]">
|
||||
<xsl:if test="@qualifier='editor'">
|
||||
<xsl:if test="@qualifier='editor'">
|
||||
<xsl:element name="contributor">
|
||||
<xsl:attribute name="contributorType">Editor</xsl:attribute>
|
||||
<contributorName>
|
||||
@@ -265,7 +265,7 @@
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (8), DataCite (8.1)
|
||||
Adds Date and dateType information
|
||||
-->
|
||||
@@ -301,7 +301,7 @@
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (9)
|
||||
Adds Language information
|
||||
Transforming the language flags according to ISO 639-2/B & ISO 639-3
|
||||
@@ -321,7 +321,7 @@
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (10), DataCite (10.1)
|
||||
Adds resourceType and resourceTypeGeneral information
|
||||
-->
|
||||
@@ -364,7 +364,7 @@
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
DataCite (11), DataCite (11.1)
|
||||
DataCite (11), DataCite (11.1)
|
||||
Adds AlternativeIdentifier and alternativeIdentifierType information
|
||||
Adds all identifiers except the doi.
|
||||
|
||||
@@ -384,11 +384,11 @@
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
DataCite (12), DataCite (12.1)
|
||||
DataCite (12), DataCite (12.1)
|
||||
Adds RelatedIdentifier and relatedIdentifierType information
|
||||
-->
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (13)
|
||||
Adds Size information
|
||||
-->
|
||||
@@ -398,7 +398,7 @@
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (14)
|
||||
Adds Format information
|
||||
-->
|
||||
@@ -408,7 +408,7 @@
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
DataCite (16)
|
||||
Adds Rights information
|
||||
-->
|
||||
@@ -417,15 +417,15 @@
|
||||
<xsl:value-of select="." />
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
|
||||
<!--
|
||||
DataCite (17)
|
||||
Description
|
||||
-->
|
||||
<xsl:template match="//dspace:field[@mdschema='dc' and @element='description'][not(@qualifier='provenance')]">
|
||||
<xsl:element name="description">
|
||||
<xsl:attribute name="descriptionType">
|
||||
<xsl:choose>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@qualifier='abstract'">Abstract</xsl:when>
|
||||
<xsl:otherwise>Other</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
@@ -433,5 +433,5 @@
|
||||
<xsl:value-of select="." />
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@@ -44,7 +44,7 @@ dspace.ui = xmlui
|
||||
dspace.url = ${dspace.baseUrl}/${dspace.ui}
|
||||
|
||||
# Optional: DSpace URL for mobile access
|
||||
# This
|
||||
# This
|
||||
#dspace.mobileUrl = http://mobile.example.com
|
||||
|
||||
# Name of the site
|
||||
@@ -192,7 +192,7 @@ loglevel.other = INFO
|
||||
# To mint DOIs you have to use a DOI registration agency like DataCite. Several
|
||||
# DataCite members offers services as DOI registration agency, so f.e. EZID or
|
||||
# TIB Hannover. To mint DOIs with DSpace you have to get an agreement with an
|
||||
# DOI registration agency. You have to edit
|
||||
# DOI registration agency. You have to edit
|
||||
# [dspace]/config/spring/api/identifier-service.xml and to configure the following
|
||||
# properties.
|
||||
|
||||
@@ -261,13 +261,13 @@ handle.prefix = 123456789
|
||||
# Directory for installing Handle server files
|
||||
handle.dir = ${dspace.dir}/handle-server
|
||||
|
||||
# List any additional prefixes that need to be managed by this handle server
|
||||
# (as for examle handle prefix coming from old dspace repository merged in
|
||||
# List any additional prefixes that need to be managed by this handle server
|
||||
# (as for examle handle prefix coming from old dspace repository merged in
|
||||
# that repository)
|
||||
# handle.additional.prefixes = prefix1[, prefix2]
|
||||
# handle.additional.prefixes = prefix1[, prefix2]
|
||||
|
||||
# By default we hide the list handles method in the JSON endpoint as it could
|
||||
# produce heavy load for large repository
|
||||
# By default we hide the list handles method in the JSON endpoint as it could
|
||||
# produce heavy load for large repository
|
||||
# handle.hide.listhandles = false
|
||||
|
||||
##### Authorization system configuration - Delegate ADMIN #####
|
||||
@@ -358,8 +358,8 @@ filter.plugins = PDF Text Extractor, HTML Text Extractor, \
|
||||
# [To enable Branded Preview]: uncomment and insert the following into the plugin list
|
||||
# Branded Preview JPEG, \
|
||||
|
||||
# [To enable ImageMagick Thumbnail]:
|
||||
# remove "JPEG Thumbnail" from the plugin list
|
||||
# [To enable ImageMagick Thumbnail]:
|
||||
# remove "JPEG Thumbnail" from the plugin list
|
||||
# uncomment and insert the following line into the plugin list
|
||||
# ImageMagick Image Thumbnail, ImageMagick PDF Thumbnail, \
|
||||
|
||||
@@ -413,7 +413,7 @@ filter.org.dspace.app.mediafilter.ExcelFilter.inputFormats = Microsoft Excel, Mi
|
||||
#
|
||||
# bitstream descriptions that do not conform to the following regular expression will not be overwritten
|
||||
# org.dspace.app.mediafilter.ImageMagickThumbnailFilter.replaceRegex = ^Generated Thumbnail$
|
||||
#
|
||||
#
|
||||
# While PDFs may contain transparent spaces, JPEG cannot. As DSpace use JPEG
|
||||
# for the generated thumbnails, PDF containing transparent spaces may lead
|
||||
# to problems. To solve this the exported PDF page is flatten before it is
|
||||
@@ -475,6 +475,9 @@ crosswalk.dissemination.DataCite.schemaLocation = \
|
||||
http://datacite.org/schema/kernel-2.2 \
|
||||
http://schema.datacite.org/meta/kernel-2.2/metadata.xsd
|
||||
crosswalk.dissemination.DataCite.preferList = false
|
||||
crosswalk.dissemination.DataCite.publisher = My University
|
||||
#crosswalk.dissemination.DataCite.dataManager = # defaults to publisher
|
||||
#crosswalk.dissemination.DataCite.hostingInstitution = # defaults to publisher
|
||||
|
||||
# Crosswalk Plugin Configuration:
|
||||
# The purpose of Crosswalks is to translate an external metadata format to/from
|
||||
@@ -512,7 +515,7 @@ plugin.named.org.dspace.content.crosswalk.DisseminationCrosswalk = \
|
||||
org.dspace.content.crosswalk.OREDisseminationCrosswalk = ore, \
|
||||
org.dspace.content.crosswalk.DIMDisseminationCrosswalk = dim, \
|
||||
org.dspace.content.crosswalk.RoleCrosswalk = DSPACE-ROLES
|
||||
|
||||
|
||||
|
||||
# regarding the XSLTDisseminationCrosswalk see the section were it is
|
||||
# configured to avoid error logs! Disable it if you remove its configuration.
|
||||
@@ -730,7 +733,7 @@ org.dspace.app.itemexport.max.size = 200
|
||||
org.dspace.app.batchitemimport.work.dir = ${dspace.dir}/imports
|
||||
|
||||
# Enable performance optimization for select-collection-step collection query
|
||||
# Enable when having
|
||||
# Enable when having
|
||||
# a large number of collections and no Shibboleth or LDAP authentication.
|
||||
# default = false, (disabled)
|
||||
#org.dspace.content.Collection.findAuthorizedPerformanceOptimize = true
|
||||
@@ -779,7 +782,7 @@ webui.licence_bundle.show = false
|
||||
# 4. OAI (every where as there is currently no possibility to authenticate)
|
||||
# Attention: You need to rebuild the OAI SOLR index after every change of
|
||||
# this property. Run [dspace-install]/bin/dspace oai import -c to do so.
|
||||
#
|
||||
#
|
||||
# To designate a field as hidden, add a property here in the form:
|
||||
# metadata.hide.SCHEMA.ELEMENT.QUALIFIER = true
|
||||
#
|
||||
@@ -818,7 +821,7 @@ cc.api.rooturl = http://api.creativecommons.org/rest/1.5
|
||||
|
||||
# Metadata field to hold CC license URI of selected license
|
||||
# NB: XMLUI presentation code expects 'dc.rights.uri' to hold CC data. If you change
|
||||
# this to another field, please consult documentation on how to update UI configuration
|
||||
# this to another field, please consult documentation on how to update UI configuration
|
||||
cc.license.uri = dc.rights.uri
|
||||
|
||||
# Metadata field to hold CC license name of selected license (if defined)
|
||||
@@ -1150,7 +1153,7 @@ recent.submissions.sort-option = dateaccessioned
|
||||
recent.submissions.count = 0
|
||||
|
||||
# name of the browse index to display collection's items.
|
||||
# You can set a "item" type of browse index only.
|
||||
# You can set a "item" type of browse index only.
|
||||
# default = title
|
||||
#webui.collectionhome.browse-name = title
|
||||
|
||||
@@ -1197,7 +1200,7 @@ plugin.single.org.dspace.app.xmlui.aspect.administrative.mapper.SearchRequestPro
|
||||
# to show facets on the site home page, community, collection
|
||||
# comment out the following lines if you disable Discovery or don't want
|
||||
# to show facets on side bars
|
||||
# TagCloudProcessor is responsible for displaying a tag-cloud facet on the
|
||||
# TagCloudProcessor is responsible for displaying a tag-cloud facet on the
|
||||
# site home page, community or collection home page
|
||||
plugin.sequence.org.dspace.plugin.CommunityHomeProcessor = \
|
||||
org.dspace.app.webui.components.RecentCommunitySubmissions,\
|
||||
@@ -1312,7 +1315,7 @@ webui.feed.item.author = dc.contributor.author
|
||||
# Add all the communities / collections, separated by commas (no spaces) that should
|
||||
# have the iTunes podcast metadata added to their RSS feed.
|
||||
# Default: Disabled, No collections or communities have iTunes Podcast enhanced metadata in their feed.
|
||||
# webui.feed.podcast.collections =123456789/2,123456789/3
|
||||
# webui.feed.podcast.collections =123456789/2,123456789/3
|
||||
# webui.feed.podcast.communities =123456789/1
|
||||
|
||||
# Which MIMETypes of Bitstreams would you like to have podcastable in your item?
|
||||
@@ -1320,8 +1323,8 @@ webui.feed.item.author = dc.contributor.author
|
||||
#webui.feed.podcast.mimetypes=audio/x-mpeg
|
||||
|
||||
# For the iTunes Podcast Feed, if you would like to specify an external media file,
|
||||
# not on your DSpace server to be enclosed within the entry for each item,
|
||||
# specify which metadata field will hold the URI to the external media file.
|
||||
# not on your DSpace server to be enclosed within the entry for each item,
|
||||
# specify which metadata field will hold the URI to the external media file.
|
||||
# This is useful if you store the metadata in DSpace, and a separate streaming server to host the media.
|
||||
# Default: dc.source.uri
|
||||
#webui.feed.podcast.sourceuri = dc.source.uri
|
||||
@@ -1411,7 +1414,7 @@ sitemap.engineurls = http://www.google.com/webmasters/sitemaps/ping?sitemap=
|
||||
sherpa.romeo.url = http://www.sherpa.ac.uk/romeo/api29.php
|
||||
|
||||
# to disable the sherpa/romeo integration
|
||||
# uncomment the follow line
|
||||
# uncomment the follow line
|
||||
# webui.submission.sherparomeo-policy-enabled = false
|
||||
|
||||
# please register for a free api access key to get many benefits
|
||||
@@ -1536,9 +1539,9 @@ google-metadata.enable = true
|
||||
# These configs are only used by the JSP User Interface #
|
||||
#---------------------------------------------------------------#
|
||||
##### JSPUI Layout #####
|
||||
# set this value if you want to use a diffent main template.
|
||||
# set this value if you want to use a diffent main template.
|
||||
# The value must match the name of a subfolder of dspace-jspui/src/main/webapp/layout
|
||||
# jspui.template.name =
|
||||
# jspui.template.name =
|
||||
|
||||
##### Show community or collection logo in list #####
|
||||
# jspui.home-page.logos = true
|
||||
@@ -1586,10 +1589,10 @@ report.dir = ${dspace.dir}/reports/
|
||||
# (any or no qualifier)
|
||||
# dc.identifier.uri(link) = DC identifier.uri, render as a link
|
||||
# dc.date.issued(date) = DC date.issued, render as a date
|
||||
# dc.subject(nobreakline) = DC subject.keyword, rendered as separated values
|
||||
# dc.subject(nobreakline) = DC subject.keyword, rendered as separated values
|
||||
# (see also webui.itemdisplay.nobreakline.separator option)
|
||||
# dc.language(inputform) = If the dc.language is in a controlled vocabulary, then the displayed value will be shown based on the stored value from the value-pairs-name in input forms.
|
||||
# The input-forms will be loaded based on the session locale. If the displayed value is not found, then the value will be shown as is.
|
||||
# The input-forms will be loaded based on the session locale. If the displayed value is not found, then the value will be shown as is.
|
||||
# "link/date" options can be combined with "nobreakline" option using a space among them i.e "dc.identifier.uri(link nobreakline)"
|
||||
#
|
||||
# If an item has no value for a particular field, it won't be displayed.
|
||||
@@ -1638,7 +1641,7 @@ report.dir = ${dspace.dir}/reports/
|
||||
webui.itemdisplay.label.restricted.bitstreams = true
|
||||
|
||||
# If nobreakline option is applied for a field in itemdisplay then the following option defines the separator string.
|
||||
# If a non-breaking space is needed before or after the separator, this can be included using
|
||||
# If a non-breaking space is needed before or after the separator, this can be included using
|
||||
# (i.e. webui.itemdisplay.separator = ; )
|
||||
# If ommitted, the default separator is '; '
|
||||
webui.itemdisplay.nobreakline.separator = ;
|
||||
@@ -1675,9 +1678,9 @@ plugin.single.org.dspace.app.webui.util.StyleSelection = \
|
||||
# If you have enabled thumbnails (webui.browse.thumbnail.show), you must also
|
||||
# include a 'thumbnail' entry in your columns - this is where the thumbnail will be displayed
|
||||
#
|
||||
# If you want to mark each item include a 'mark_[value]' (without the brackets - replace the word 'value' with anything that
|
||||
# If you want to mark each item include a 'mark_[value]' (without the brackets - replace the word 'value' with anything that
|
||||
# has a meaning for your mark) entry in your columns - this is where the icon will be displayed.
|
||||
# Do not forget to add a Spring bean with id = "org.dspace.app.itemmarking.ItemMarkingExtractor.[value]"
|
||||
# Do not forget to add a Spring bean with id = "org.dspace.app.itemmarking.ItemMarkingExtractor.[value]"
|
||||
# in file 'config/spring/api/item-marking.xml'. This bean is responsible for drawing the appropriate mark for each item.
|
||||
# You can add more than one 'mark_[value]' options (with different value) in case you need to mark items more than one time for
|
||||
# different purposes. Remember to add the respective beans in file 'config/spring/api/item-marking.xml'.
|
||||
@@ -1819,7 +1822,7 @@ webui.suggest.enable = false
|
||||
|
||||
# Check if the user has a consistent ip address from the start of the login process
|
||||
# to the end of the login process. Disabling this check is not recommended unless
|
||||
# absolutely necessary as the ip check can be helpful for preventing session
|
||||
# absolutely necessary as the ip check can be helpful for preventing session
|
||||
# hijacking. Possible reasons to set this to false: many-to-many wireless networks
|
||||
# that prevent consistent ip addresses or complex proxying of requests.
|
||||
# The default value is set to true.
|
||||
|
Reference in New Issue
Block a user