001/*
002 * Copyright 2015 DuraSpace, Inc.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.fcrepo.migration;
017
018/**
019 * An interface with methods that are meant to be invoked when processing
020 * a fedora 3 object such that every bit of information in that fedora 3
021 * object is exposed to the instance implementing this interface.
022 *
023 * Instances of this class are expected to be used for a single fedora
024 * object, and method calls should not require implementations to maintain
025 * state.
026 * @author mdurbin
027 */
028public interface StreamingFedoraObjectHandler {
029
030    /**
031     * begin object.
032     * @param object the object info
033     */
034    public void beginObject(ObjectInfo object);
035
036    /**
037     * Invoked to allow processing of properties by this StreamingFedoraObjectHandler.
038     * @param properties the properties for the object
039     */
040    public void processObjectProperties(ObjectProperties properties);
041
042    /**
043     * Invoked to allow processing of a datastream by this StreamingFedoraObjectHandler.
044     * @param dsVersion an encapsulation of the datastream version.  References to this object must
045     *                  not be used after completeObject() or abortObject() have completed as
046     *                  the resources exposed may no longer be available.
047     */
048    public void processDatastreamVersion(DatastreamVersion dsVersion);
049
050    /**
051     * A hook called after the object has been completely processed.  This may be useful for any cleanup or
052     * finalization routines.  Furthermore, once this method invocation is complete, any references
053     * provided to prior calls will no longer be in scope.
054     *
055     * @param object to be completed.
056     */
057    public void completeObject(ObjectInfo object);
058
059    /**
060     * Invoked if processing of the object failed for some reason.
061     *
062     * @param object to be aborted.
063     */
064    public void abortObject(ObjectInfo object);
065}