One of the key requirements for achieving long term data persistence is the ability to move data between archiving systems or, in the language of the SNIA XAM (eXtensible Access Method) specification, moving XSets between XSystems.
The XAM v1.0 specification supports this requirement by providing support for exporting and importing Xsets. It specifies the methods used to export an XSet from an XSystem, the resultant XSet canonical data interchange format (package) and the methods used to import an Xset into an Xsystem.
This post assumes that you are somewhat familiar with XAM and how to program to that specification using Java. It focuses on the format and content of the XSet canonical format package which consists of two main parts: an XML document which describes the policies, properties and streams of one or more XSets followed by the binary representation of the stream(s).
The package format conforms to the 2005 W3C XML-binary Optimized Packaging (XOP) recommendation. To quote from the recommendation:
XOP define a general purpose serialization mechanism for the XML Infoset with binary content that is not only applicable to SOAP and MIME packaging, but to any XML Infoset and any packaging mechanism.
If you are unfamiliar with XOP, and most people are, an article by Andrey Butov in the December 2005 issue of Doctor Dobb’s Journal contained a good introduction.
More than one XSet can be contained in a package. However the current XAM SDK reference implementation only supports one XSet. The XML document (AKA the XSet manifest) is a valid and well-formed XML document whose root element is xsets. It can be parsed and manipulated using XSLT and other XML tools. Annex B of the XAM Architecture document contains an XML Schema Definition (XSD) for the XSet manifest.
In order to study the package format in more detail, I wrote a small Java application called StoreHelloWorld which creates a new XSet containing two XStreams. The first Xstream contains the source code for the ubiquitous HelloWorld.java program. The second XStream contains the binary object HelloWorld.class encoded to base64 and with a MIME type of application/base64. Normally you should not encode an XStream but displaying binary files in a blog is problematic and hence the workaround.
Here is the source code for StoreHelloWorld. import java.io.BufferedOutputStream; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.InputStream; import

























