A benefit of the SWORD / AtomPub relationship
Now that version 1.3 of SWORD (Simple Web-service Offering Repository Deposit) has been published, it is time to get cracking with implementing it. One of my roles in the project is to maintain the Java and the PHP SWORD libraries.
One of the nice new features in version 1.3 are error documents. These allow errors to be reported back to the user with more granularity and detail than earlier versions of the specification.
I was originally thinking that these would take me a while to implement, however it turns out to be very easy – 11 lines of code to be precise! (ignoring Java class and method signatures).
The reason for this is that error documents, like deposit entries are just extended atom entries. So seeing as we’ve already implemented AtomEntry and SWORDEntry (which extends AtomEntry), all I had to do was create a new class SWORDErrorDocument that extends SWORDEntry. This gives me (for free) an atom entry with the bells and whistles added by SWORD. All I then had to do was add a few lines of code to set the error reference and to change the top element to sword:error (from atom:entry). Easy-peasy!
In: Uncategorized · Tagged with: interoperability, repositories, sword


