}
if (Constants.FEDORA_HOME == null) {
throw new IOException("FEDORA_HOME is not set. Try using -Dfedora.home=path/to/fedorahome");
}
in = new FileInputStream(new File(args[0]));
Server server;
server = Server.getInstance(new File(Constants.FEDORA_HOME));
DOTranslator trans =
(DOTranslator) server
.getModule("org.fcrepo.server.storage.translation.DOTranslator");
if (trans == null) {
throw new IOException("DOTranslator module not found via getModule");
}
DigitalObject obj = new BasicDigitalObject();
System.out.println("Deserializing...");
trans.deserialize(in,
obj,
args[1],
args[2],
DOTranslationUtility.DESERIALIZE_INSTANCE);
System.out.println("Done.");
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
System.out.println("Re-serializing...");
trans.serialize(obj,
outStream,
args[1],
args[2],
DOTranslationUtility.SERIALIZE_STORAGE_INTERNAL);
System.out.println("Done. Here it is:");
System.out.println(outStream.toString(args[2]));
server.shutdown(null); //fixup for xacml
} catch (Exception e) {
System.out.println("Error: " + e.getClass().getName() + " "
+ e.getMessage() + "\n");
e.printStackTrace();
}