001/* 002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 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 * 016 * Contributors: 017 * Thierry Delprat 018 * Florent Guillaume 019 */ 020package org.nuxeo.ecm.core.api.blobholder; 021 022import java.io.Serializable; 023import java.util.Calendar; 024import java.util.List; 025import java.util.Map; 026 027import org.nuxeo.ecm.core.api.Blob; 028 029/** 030 * Interface for an object that holds a {@link Blob}. 031 */ 032public interface BlobHolder { 033 034 /** 035 * Returns the Blob held inside the object. 036 */ 037 Blob getBlob(); 038 039 /** 040 * Sets a blob in the object. 041 * <p> 042 * The underlying document must be saved by the caller. 043 */ 044 void setBlob(Blob blob); 045 046 /** 047 * Returns a filesystem-like path to represent the held blob. 048 */ 049 String getFilePath(); 050 051 /** 052 * Returns the held blob modification date. 053 */ 054 Calendar getModificationDate(); 055 056 /** 057 * Returns a hash for the held blob. 058 */ 059 String getHash(); 060 061 /** 062 * Returns a list of blobs, if holder implementation supports multiple blobs. 063 */ 064 List<Blob> getBlobs(); 065 066 /** 067 * Returns a named property. 068 */ 069 Serializable getProperty(String name); 070 071 /** 072 * Returns all properties as a Map. 073 */ 074 Map<String, Serializable> getProperties(); 075 076}