Package org.fcrepo.server.storage.translation

Examples of org.fcrepo.server.storage.translation.DOSerializer


        deser.deserialize(in, obj, "UTF-8", DESERIALIZE_INSTANCE);

        // some sanity checks
        setObjectDefaults(obj);

        DOSerializer serializer = new AtomDOSerializer();
        serializer.serialize(obj, out, "UTF-8", SERIALIZE_EXPORT_ARCHIVE);
    }
View Full Code Here


        ds1.DSCreateDT = new Date();
        obj.addDatastreamVersion(ds1, true);

        OutputStream out = new ByteArrayOutputStream();

        DOSerializer serializer = new AtomDOSerializer();
        serializer.serialize(obj, out, "UTF-8", SERIALIZE_EXPORT_ARCHIVE);
        // TODO
        //validateWithISOSchematron(out.toString());
    }
View Full Code Here

        obj.addDatastreamVersion(ds1, true);

        File f = File.createTempFile("atom", ".zip");
        OutputStream out = new FileOutputStream(f);

        DOSerializer serializer = new AtomDOSerializer(Constants.ATOM_ZIP1_1);
        serializer.serialize(obj, out, "UTF-8", SERIALIZE_EXPORT_ARCHIVE);
        out.close();

        ZipInputStream zip = new ZipInputStream(new FileInputStream(f));
        ZipEntry entry;
        int count = 0;
View Full Code Here

        DatastreamXMLMetadata ds1 = createXDatastream("DS1");
        ds1.DSCreateDT = new Date();
        original.addDatastreamVersion(ds1, true);

        // serialize the object as Atom
        DOSerializer serA = new AtomDOSerializer();
        File f = File.createTempFile("test", null);
        OutputStream out = new FileOutputStream(f);
        serA.serialize(original,
                       out,
                       "utf-8",
                       DOTranslationUtility.SERIALIZE_EXPORT_ARCHIVE);

        // deserialize the object
        DigitalObject candidate = new BasicDigitalObject();
        DODeserializer deserA = new AtomDODeserializer();
        InputStream in = new FileInputStream(f);
        deserA.deserialize(in,
                           candidate,
                           "utf-8",
                           DOTranslationUtility.DESERIALIZE_INSTANCE);

        // check the deserialization
        assertEquals(original.getLastModDate(), candidate.getLastModDate());
        DatastreamXMLMetadata candidateDS =
                (DatastreamXMLMetadata) candidate.datastreams("DS1").iterator()
                        .next();
        assertEquals(ds1.DatastreamID, candidateDS.DatastreamID);
        assertEquals(ds1.DSCreateDT, candidateDS.DSCreateDT);

        // FIXME dsSize tests omitted for now b/c of handling of closing tags
        //assertEquals(ds1.DSSize, candidateDS.DSSize);

        // also make sure we can serialize the object as foxml
        DOSerializer serF = new FOXML1_1DOSerializer();
        serF.serialize(candidate,
                       out,
                       "utf-8",
                       DOTranslationUtility.SERIALIZE_EXPORT_ARCHIVE);
    }
View Full Code Here

TOP

Related Classes of org.fcrepo.server.storage.translation.DOSerializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.