So, along comes demo day, and confidently we fire up a browser to
demonstrate the latest and greatest functionality to the customer.
Confident? you may ask - and we were - we do have unit- and
integrationtests, and we did run through the functionality the day
before - just to make sure.
Alas - the demo ghost comes along, and right there, the impressive ui
and cool functionality should have dazzled the customer is replaced by a
stack trace from our (Java) webapp on top of Fedora garbled along by a
.NET CMS system which speaks non-sense to our customer.
Embarrassing? oh yes.
And how, you might ask, does this become a tale of impeccable timing
rather than just another the-demo-f****-up story? Because we were in
fact, precise to the millisecond.
Digging around stack traces and foxml files on disk, we eventually found
that the issue was that a digital object was created at:
2008-08-13T09:43:08.000Z (in foxml), which became 2008-08-13T09:43:08Z
in the tripple store.
Cursing and muttering under our breath (believing
2008-08-13T09:43:08.000Z was the best XSD datetime representation), and
eventually reading through the W3C recommendation
(http://www.w3.org/TR/xmlschema-2/#dateTime) only to find that the
canonical representation is actually without any trailing 0's in the
fractional part of the seconds.
So, aside the point that our parsing of the date string was overly
optimistic (and not in accordance with the W3C recommendation), we are
not quite sure whether it is good practice not to use the canonical
representation in the foxml files. Therefore, a patch is included ;)
Below is included:
1) Our code, which failed miserably
2) An itql query showing that the datetime string is in fact in
canonical form in the triplestore
3) The foxml file found on disk.
4) Attached: a patch to
src/java/fedora/server/storage/translation/FOXMLDOSerializer.java
from the branch:
https://fedora-commons.svn.sourceforge.net/svnroot/fedora-commons/fedora/tags/release-3.0
1) *Our code, which failed miserably*
private final ThreadLocal<DateFormat> dateFormat = new
ThreadLocal<DateFormat>() {
protected DateFormat initialValue() {
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
}
};
2) *An itql query showing that the datetime string is in fact in
canonical form in the triplestore*
select $s from <#ri> where <info:fedora/oiokataloget:2>
<info:fedora/fedora-system:def/model#createdDate> $s
"s"
2008-08-13T09:43:08Z
3) *The foxml file found on disk.*
<?xml version="1.0" encoding="UTF-8"?>
<foxml:digitalObject VERSION="1.1" PID="oiokataloget:2"
xmlns:foxml="info:fedora/fedora-system:def/foxml#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="info:fedora/fedora-system:def/foxml#
http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
<foxml:objectProperties>
<foxml:property NAME="info:fedora/fedora-system:def/model#state"
VALUE="Active"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#label"
VALUE="Active"/>
<foxml:property
NAME="info:fedora/fedora-system:def/model#createdDate"
VALUE="2008-08-13T09:43:08.000Z"/>
<foxml:property
NAME="info:fedora/fedora-system:def/view#lastModifiedDate"
VALUE="2008-08-13T09:43:08.000Z"/>
</foxml:objectProperties>
<foxml:datastream ID="AUDIT" STATE="A" CONTROL_GROUP="X"
VERSIONABLE="false">
<foxml:datastreamVersion ID="AUDIT.0" LABEL="Audit Trail for
this object" CREATED="2008-08-13T09:43:08.000Z" MIMETYPE="text/xml"
FORMAT_URI="info:fedora/fedora-system:format/xml.fedora.audit">
<foxml:xmlContent>
<audit:auditTrail
xmlns:audit="info:fedora/fedora-system:def/audit#">
<audit:record ID="AUDREC1">
<audit:process type="Fedora API-M"/>
<audit:action>ingest</audit:action>
<audit:componentID></audit:componentID>
<audit:responsibility>heinrich</audit:responsibility>
<audit:date>2008-08-13T09:43:08.000Z</audit:date>
<audit:justification>Ingested from
ResourceRepositoryUserInterfaceOperations</audit:justification>
</audit:record>
</audit:auditTrail>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X"
VERSIONABLE="true">
<foxml:datastreamVersion ID="DC.1" LABEL=""
CREATED="2008-08-13T09:43:17.140Z" MIMETYPE="text/xml" SIZE="168">
<foxml:xmlContent>
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>Heinrichs 1. resource</dc:title>
<dc:identifier>oiokataloget:2</dc:identifier>
</oai_dc:dc>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="POLICY" STATE="A" CONTROL_GROUP="X"
VERSIONABLE="true">
<foxml:datastreamVersion ID="policy_version" LABEL="Policy
rules" CREATED="2008-08-13T09:43:17.171Z" MIMETYPE="text/xml" SIZE="882">
<foxml:xmlContent>
<Policy xmlns="urn:oasis:names:tc:xacml:1.0:policy"
PolicyId="oiokataloget:2"
RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:first-applicable">
<Description>Generated by
ResRepXacmlBuilderImpl:ingestObjectForGroup</Description>
<Target><Subjects><AnySubject></AnySubject></Subjects><Resources><AnyResource></AnyResource></Resources><Actions><AnyAction></AnyAction></Actions></Target>
<Rule Effect="Permit" RuleId="1">
<Condition
FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of">
<SubjectAttributeDesignator AttributeId="groups"
DataType="http://www.w3.org/2001/XMLSchema#string"></SubjectAttributeDesignator>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-bag">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">heinrich1</AttributeValue>
</Apply>
</Condition>
</Rule>
</Policy>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X"
VERSIONABLE="true">
<foxml:datastreamVersion ID="RELS-EXT.0" LABEL="Relationships to
other objects" CREATED="2008-08-13T09:43:17.203Z"
MIMETYPE="application/xml+rdf" SIZE="673">
<foxml:xmlContent>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description
rdf:about="info:fedora/oiokataloget:2"><hasModel
xmlns="info:fedora/fedora-system:def/model#"
rdf:resource="oiokataloget:cmodelResource"></hasModel><owner-group
xmlns="oiokataloget:predicates/"
rdf:resource="ldap-group:heinrich1"></owner-group><published
xmlns="oiokataloget:predicates/">false</published><version
xmlns="oiokataloget:predicates/">0.3</version><oioResourceUUID
xmlns="oiokataloget:predicates/">oiokataloget:6beb47d8-0abd-443e-82b6-d9f128d7da4c</oioResourceUUID><isNewerVersionOf
xmlns="oiokataloget:predicates/"
rdf:resource=""></isNewerVersionOf></rdf:Description></rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream ID="oioresource" STATE="A" CONTROL_GROUP="X"
VERSIONABLE="true">
<foxml:datastreamVersion ID="no_version" LABEL="OIO resource
description" CREATED="2008-08-13T09:43:17.218Z" MIMETYPE="text/xml"
SIZE="368">
<foxml:xmlContent>
<oiok:OIOResourceDataStream
xmlns:oiok="oiokataloget:predicates/"><oiok:title>Heinrichs 1.
resource</oiok:title><oiok:ownerGroup>heinrich1</oiok:ownerGroup><oiok:description>En
kort
beskrivelse</oiok:description><oiok:contact>ldap-user:heinrich</oiok:contact><oiok:contact>ldap-group:heinrich</oiok:contact><oiok:version>0.3</oiok:version></oiok:OIOResourceDataStream>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
</foxml:digitalObject>
Regards,
--
Rolf Njor Jensen
Software Pilot, Trifork A/S
[EMAIL PROTECTED]
Index: src/java/fedora/server/storage/translation/FOXMLDOSerializer.java
===================================================================
--- src/java/fedora/server/storage/translation/FOXMLDOSerializer.java (revision 7646)
+++ src/java/fedora/server/storage/translation/FOXMLDOSerializer.java (working copy)
@@ -189,7 +189,7 @@
if (cdate != null) {
buf.append(" <" + FOXML.prefix + ":property NAME=\""
+ MODEL.CREATED_DATE.uri + "\"" + " VALUE=\""
- + DateUtility.convertDateToString(cdate) + "\"/>\n");
+ + DateUtility.convertDateToXSDString(cdate) + "\"/>\n");
}
if (mdate != null) {
buf.append(" <" + FOXML.prefix + ":property NAME=\""
@@ -194,7 +194,7 @@
if (mdate != null) {
buf.append(" <" + FOXML.prefix + ":property NAME=\""
+ VIEW.LAST_MODIFIED_DATE.uri + "\"" + " VALUE=\""
- + DateUtility.convertDateToString(mdate) + "\"/>\n");
+ + DateUtility.convertDateToXSDString(mdate) + "\"/>\n");
}
Iterator<String> iter = obj.getExtProperties().keySet().iterator();
@@ -444,7 +444,7 @@
dateAttr =
" CREATED=\""
+ DateUtility
- .convertDateToString(vdiss.dissCreateDT)
+ .convertDateToXSDString(vdiss.dissCreateDT)
+ "\"";
}
buf.append(" <" + FOXML.prefix
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Fedora-commons-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-developers