Package org.fcrepo.server.storage.types

Examples of org.fcrepo.server.storage.types.DigitalObject


    // Instance helpers
    //---

    private DigitalObject doDeserialize(String format)
            throws UnsupportedTranslationException {
        DigitalObject obj = new BasicDigitalObject();
        try {
            InputStream in = getInputStream(format + "\n" + TEST_PID + "\n");
            m_trans.deserialize(in, obj, format, "UTF-8", 0);
            return obj;
        } catch (UnsupportedTranslationException e) {
View Full Code Here


        }
    }

    private String[] doSerialize(String format)
            throws UnsupportedTranslationException {
        DigitalObject obj = new BasicDigitalObject();
        obj.setPid(TEST_PID);
        try {
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            m_trans.serialize(obj, out, format, "UTF-8", 0);
            String[] lines = new String(out.toByteArray(), "UTF-8").split("\n");
            for (int i = 0; i < lines.length; i++) {
View Full Code Here

        initRI(1);
        addAll(objects, true);
        Set<Triple> origTriples = getExpectedTriples(1, objects);

        // mod at level 0
        DigitalObject original = (DigitalObject) objects.toArray()[0];
        DigitalObject modified = ObjectBuilder.deepCopy(original);
        modified.setLabel("new label");
        initRI(0);
        modify(original, modified, true);

        assertTrue("Did not get expected orig triples after modify at level 0",
                   sameTriples(origTriples, getActualTriples(), true));
View Full Code Here

    /**
     * Modify an object's label once.
     */
    @Test
    public void testModObjOnceLabel() throws Exception {
        DigitalObject original = getTestObject("test:1", "test1");

        DigitalObject modified = ObjectBuilder.deepCopy(original);
        modified.setLabel("new label");

        doModifyTest(1, original, modified);
    }
View Full Code Here

    @Test
    public void testModObjMultiLabel() throws Exception {

        // prep by initting at lv 1 and adding original object
        initRI(1);
        DigitalObject previous = getTestObject("test:1", "test1");
        Set<DigitalObject> origSet = new HashSet<DigitalObject>();
        origSet.add(previous);
        addAll(origSet, true);

        // modify the label multiple times
        for (int i = 1; i <= 5; i++) {
            DigitalObject modified = ObjectBuilder.deepCopy(previous);
            modified.setLabel("new label " + i);
            doModifyTest(-1, previous, modified);
            previous = modified;
        }

    }
View Full Code Here

    @Test
    public void testModObjMultiLabelAsyncFlush() throws Exception {

        // prep by initting at lv 1 and adding original object
        initRI(1);
        DigitalObject original = getTestObject("test:1", "test1");
        DigitalObject previous = original;
        Set<DigitalObject> origSet = new HashSet<DigitalObject>();
        origSet.add(previous);
        addAll(origSet, true);

        // hold on to the original triples so we can compare later
        Set<Triple> origTriples = getExpectedTriples(1, origSet);

        // modify the label multiple times while flushing
        startFlushing(0);
        try {
            for (int i = 0; i <= 5; i++) {
                DigitalObject modified = ObjectBuilder.deepCopy(previous);
                modified.setLabel("new label " + i);
                modify(previous, modified, false);
                previous = modified;
            }
            // last change puts obj back into original state
            modify(previous, original, false);
View Full Code Here

     * @throws ObjectNotFoundException
     *         if it's not in the "repository".
     */
    public synchronized DigitalObject getObject(String pid)
            throws ObjectNotFoundException {
        DigitalObject obj = _objects.get(pid);
        if (obj == null) {
            throw new ObjectNotFoundException("No such object: " + pid);
        } else {
            return obj;
        }
View Full Code Here

     * {@inheritDoc}
     */
    public synchronized DOReader getReader(boolean cachedObjectRequired,
                                           Context context,
                                           String pid) throws ServerException {
        DigitalObject obj = getObject(pid);
        return new SimpleDOReader(null, this, null, null, null, obj);
    }
View Full Code Here

     */
    public synchronized ServiceDeploymentReader getServiceDeploymentReader(boolean cachedObjectRequired,
                                                                           Context context,
                                                                           String pid)
            throws ServerException {
        DigitalObject obj = getObject(pid);
        //TODO hasModel
        if (!obj.hasContentModel(
                                 Models.SERVICE_DEPLOYMENT_3_0)) {
            throw new GeneralException("Not a service deployment: " + pid);
        } else {
            return new SimpleServiceDeploymentReader(null,
                                                     this,
View Full Code Here

     */
    public synchronized ServiceDefinitionReader getServiceDefinitionReader(boolean cachedObjectRequired,
                                                                           Context context,
                                                                           String pid)
            throws ServerException {
        DigitalObject obj = getObject(pid);
        //TODO hasModel
        if (!obj.hasContentModel(
                                 Models.SERVICE_DEFINITION_3_0)) {
            throw new GeneralException("Not a service definition object: "
                    + pid);
        } else {
            return new SimpleServiceDefinitionReader(null,
View Full Code Here

TOP

Related Classes of org.fcrepo.server.storage.types.DigitalObject

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.