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 1.4 beta 1
========== ==========
(Larry Stone) (Larry Stone)
- SF Patch #1455904 - fix crosswalk validation in 1.4alpha1
- SF Patch #1453425 1.4alpha1, fix crosswalk + packager configurations - SF Patch #1453425 1.4alpha1, fix crosswalk + packager configurations
(Larry Stone) (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.dc = http://purl.org/dc/elements/1.1/
crosswalk.qdc.namespace.QDC.dcterms = http://purl.org/dc/terms/ crosswalk.qdc.namespace.QDC.dcterms = http://purl.org/dc/terms/
crosswalk.qdc.schemaLocation.QDC = \ 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.properties.QDC = crosswalks/QDC.properties
crosswalk.qdc.namespace.qdc.dc = http://purl.org/dc/elements/1.1/ crosswalk.qdc.namespace.qdc.dc = http://purl.org/dc/elements/1.1/
crosswalk.qdc.namespace.qdc.dcterms = http://purl.org/dc/terms/ crosswalk.qdc.namespace.qdc.dcterms = http://purl.org/dc/terms/
crosswalk.qdc.schemaLocation.qdc = \ 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.properties.qdc = crosswalks/QDC.properties
# METS ingester configuration: # METS ingester configuration:

View File

@@ -68,6 +68,10 @@ import org.jdom.Namespace;
*/ */
public interface DisseminationCrosswalk 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. * Get XML namespaces of the elements this crosswalk may return.
* Returns the XML namespaces (as JDOM objects) of the root element. * 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."; private final static String CONFIG_PREFIX = "crosswalk.mods.properties.";
/** /**
* Fill in the plugin alias table from DSpace configuration entries * Fill in the plugin alias table from DSpace configuration entries
* for configuration files for flavors of MODS crosswalk: * 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) public List disseminateList(DSpaceObject dso)
throws CrosswalkException, throws CrosswalkException,
IOException, SQLException, AuthorizeException 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) if (dso.getType() != Constants.ITEM)
throw new CrosswalkObjectNotSupported("MODSDisseminationCrosswalk can only crosswalk an Item."); throw new CrosswalkObjectNotSupported("MODSDisseminationCrosswalk can only crosswalk an Item.");
@@ -334,6 +350,8 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
try try
{ {
Element me = (Element)trip.xml.clone(); Element me = (Element)trip.xml.clone();
if (addSchema)
me.setAttribute("schemaLocation", schemaLocation, XSI_NS);
Iterator ni = trip.xpath.selectNodes(me).iterator(); Iterator ni = trip.xpath.selectNodes(me).iterator();
if (!ni.hasNext()) if (!ni.hasNext())
log.warn("XPath \""+trip.xpath.getXPath()+ log.warn("XPath \""+trip.xpath.getXPath()+
@@ -366,15 +384,6 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin
return result; 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) public boolean canDisseminate(DSpaceObject dso)
{ {
return true; return true;

View File

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

View File

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