001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Thierry Delprat
011 *     Florent Guillaume
012 */
013package org.nuxeo.ecm.core.api.blobholder;
014
015import java.io.Serializable;
016import java.util.Calendar;
017import java.util.List;
018import java.util.Map;
019
020import org.nuxeo.ecm.core.api.Blob;
021
022/**
023 * Interface for an object that holds a {@link Blob}.
024 */
025public interface BlobHolder {
026
027    /**
028     * Returns the Blob held inside the object.
029     */
030    Blob getBlob();
031
032    /**
033     * Sets a blob in the object.
034     * <p>
035     * The underlying document must be saved by the caller.
036     */
037    void setBlob(Blob blob);
038
039    /**
040     * Returns a filesystem-like path to represent the held blob.
041     */
042    String getFilePath();
043
044    /**
045     * Returns the held blob modification date.
046     */
047    Calendar getModificationDate();
048
049    /**
050     * Returns a hash for the held blob.
051     */
052    String getHash();
053
054    /**
055     * Returns a list of blobs, if holder implementation supports multiple blobs.
056     */
057    List<Blob> getBlobs();
058
059    /**
060     * Returns a named property.
061     */
062    Serializable getProperty(String name);
063
064    /**
065     * Returns all properties as a Map.
066     */
067    Map<String, Serializable> getProperties();
068
069}