SF Patch #1455904 - fix crosswalk validation in 1.4alpha1

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1463 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Scott Yeadon
2006-03-27 02:57:09 +00:00
parent b7062d2711
commit f07180c0fb
6 changed files with 56 additions and 21 deletions

View File

@@ -1,6 +1,7 @@
1.4 beta 1
==========
(Larry Stone)
- SF Patch #1455904 - fix crosswalk validation in 1.4alpha1
- SF Patch #1453425 1.4alpha1, fix crosswalk + packager configurations
(Larry Stone)

View File

@@ -598,13 +598,15 @@ crosswalk.submission.MODS.stylesheet= crosswalks/mods-submission.xsl
crosswalk.qdc.namespace.QDC.dc = http://purl.org/dc/elements/1.1/
crosswalk.qdc.namespace.QDC.dcterms = http://purl.org/dc/terms/
crosswalk.qdc.schemaLocation.QDC = \
http://purl.org/dc/terms/ http://dublincore.org/schemas/xmls/qdc/2003/04/02/qualifieddc.xsd
http://purl.org/dc/terms/ http://dublincore.org/schemas/xmls/qdc/2006/01/06/dcterms.xsd \
http://purl.org/dc/elements/1.1/ http://dublincore.org/schemas/xmls/qdc/2006/01/06/dc.xsd
crosswalk.qdc.properties.QDC = crosswalks/QDC.properties
crosswalk.qdc.namespace.qdc.dc = http://purl.org/dc/elements/1.1/
crosswalk.qdc.namespace.qdc.dcterms = http://purl.org/dc/terms/
crosswalk.qdc.schemaLocation.qdc = \
http://purl.org/dc/terms/ http://dublincore.org/schemas/xmls/qdc/2003/04/02/qualifieddc.xsd
http://purl.org/dc/terms/ http://dublincore.org/schemas/xmls/qdc/2006/01/06/dcterms.xsd \
http://purl.org/dc/elements/1.1/ http://dublincore.org/schemas/xmls/qdc/2006/01/06/dc.xsd
crosswalk.qdc.properties.qdc = crosswalks/QDC.properties
# METS ingester configuration:
@@ -641,4 +643,4 @@ plugin.named.org.dspace.content.packager.PackageDisseminator = \
plugin.named.org.dspace.content.packager.PackageIngester = \
org.dspace.content.packager.PDFPackager = Adobe PDF, PDF, \
org.dspace.content.packager.DSpaceMETSIngester = METS
org.dspace.content.packager.DSpaceMETSIngester = METS

View File

@@ -68,6 +68,10 @@ import org.jdom.Namespace;
*/
public interface DisseminationCrosswalk
{
/** XSI namespace, required for xsi:schemalocation attributes */
static final Namespace XSI_NS =
Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
/**
* Get XML namespaces of the elements this crosswalk may return.
* Returns the XML namespaces (as JDOM objects) of the root element.

View File

@@ -116,7 +116,6 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
private final static String CONFIG_PREFIX = "crosswalk.mods.properties.";
/**
* Fill in the plugin alias table from DSpace configuration entries
* for configuration files for flavors of MODS crosswalk:
@@ -305,11 +304,28 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
}
/**
* Returns object's metadata in MODS format, as XML structure node.
* Returns object's metadata in MODS format, as List of XML structure nodes.
*/
public List disseminateList(DSpaceObject dso)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
return disseminateListInternal(dso, true);
}
public Element disseminateElement(DSpaceObject dso)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
Element root = new Element("mods", MODS_NS);
root.setAttribute("schemaLocation", schemaLocation, XSI_NS);
root.addContent(disseminateListInternal(dso,false));
return root;
}
private List disseminateListInternal(DSpaceObject dso, boolean addSchema)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
if (dso.getType() != Constants.ITEM)
throw new CrosswalkObjectNotSupported("MODSDisseminationCrosswalk can only crosswalk an Item.");
@@ -334,6 +350,8 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
try
{
Element me = (Element)trip.xml.clone();
if (addSchema)
me.setAttribute("schemaLocation", schemaLocation, XSI_NS);
Iterator ni = trip.xpath.selectNodes(me).iterator();
if (!ni.hasNext())
log.warn("XPath \""+trip.xpath.getXPath()+
@@ -366,15 +384,6 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
return result;
}
public Element disseminateElement(DSpaceObject dso)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
Element root = new Element("mods", MODS_NS);
root.addContent(disseminateList(dso));
return root;
}
public boolean canDisseminate(DSpaceObject dso)
{
return true;

View File

@@ -328,6 +328,13 @@ public class QDCCrosswalk extends SelfNamedPlugin
public List disseminateList(DSpaceObject dso)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
return disseminateListInternal(dso, true);
}
private List disseminateListInternal(DSpaceObject dso, boolean addSchema)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
if (dso.getType() != Constants.ITEM)
throw new CrosswalkObjectNotSupported("QDCCrosswalk can only crosswalk an Item.");
@@ -356,6 +363,8 @@ public class QDCCrosswalk extends SelfNamedPlugin
{
Element qe = (Element)elt.clone();
qe.setText(dc[i].value);
if (addSchema && schemaLocation != null)
qe.setAttribute("schemaLocation", schemaLocation, XSI_NS);
if (dc[i].language != null)
qe.setAttribute("lang", dc[i].language, Namespace.XML_NAMESPACE);
result.add(qe);
@@ -368,8 +377,11 @@ public class QDCCrosswalk extends SelfNamedPlugin
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
init();
Element root = new Element("qualifieddc", DCTERMS_NS);
root.addContent(disseminateList(dso));
if (schemaLocation != null)
root.setAttribute("schemaLocation", schemaLocation, XSI_NS);
root.addContent(disseminateListInternal(dso, false));
return root;
}

View File

@@ -78,13 +78,10 @@ public class SimpleDCDisseminationCrosswalk extends SelfNamedPlugin
private static final Namespace DC_NS =
Namespace.getNamespace("dc", "http://purl.org/dc/elements/1.1/");
private static final Namespace XSI_NS =
Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
// simple DC schema for OAI
private static final String DC_XSD =
"http://www.openarchives.org/OAI/2.0/oai_dc.xsd";
"http://dublincore.org/schemas/xmls/simpledc20021212.xsd";
//"http://www.openarchives.org/OAI/2.0/oai_dc.xsd";
private static final String schemaLocation =
DC_NS.getURI()+" "+DC_XSD;
@@ -104,7 +101,8 @@ public class SimpleDCDisseminationCrosswalk extends SelfNamedPlugin
IOException, SQLException, AuthorizeException
{
Element root = new Element("simpledc", DC_NS);
root.addContent(disseminateList(dso));
root.setAttribute("schemaLocation", schemaLocation, XSI_NS);
root.addContent(disseminateListInternal(dso, false));
return root;
}
@@ -116,6 +114,13 @@ public class SimpleDCDisseminationCrosswalk extends SelfNamedPlugin
public List disseminateList(DSpaceObject dso)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
return disseminateListInternal(dso, true);
}
public List disseminateListInternal(DSpaceObject dso, boolean addSchema)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
if (dso.getType() != Constants.ITEM)
throw new CrosswalkObjectNotSupported("SimpleDCDisseminationCrosswalk can only crosswalk an Item.");
@@ -142,6 +147,8 @@ public class SimpleDCDisseminationCrosswalk extends SelfNamedPlugin
element = allDC[i].element;
Element field = new Element(element, DC_NS);
field.addContent(allDC[i].value);
if (addSchema)
field.setAttribute("schemaLocation", schemaLocation, XSI_NS);
dcl.add(field);
}
}