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 * Nuxeo - initial API and implementation 011 * 012 */ 013 014package org.nuxeo.ecm.core.api.blobholder; 015 016import java.io.IOException; 017 018import org.nuxeo.ecm.core.api.Blob; 019import org.nuxeo.ecm.core.api.DocumentModel; 020import org.nuxeo.ecm.core.api.PropertyException; 021import org.nuxeo.ecm.core.api.externalblob.ExternalBlobAdapter; 022 023/** 024 * Service interface for creating the right {@link BlobHolder} adapter depending on the {@link DocumentModel} type. 025 * <p> 026 * Also provides APIs for external blob adapters, handling blobs that are not stored in the repository (stored in the 027 * file system for instance). 028 * 029 * @author tiry 030 * @author Anahide Tchertchian 031 */ 032public interface BlobHolderAdapterService { 033 034 BlobHolder getBlobHolderAdapter(DocumentModel doc); 035 036 /** 037 * Returns an external blob from given uri. 038 * 039 * @see ExternalBlobAdapter 040 * @param uri the uri describing what adapter handles the file and the needed info to retrieve it. 041 * @return the resolved blob. 042 * @throws PropertyException if the blob cannot be retrieved (if adapter cannot retrieve it or if file is not found 043 * for instance) 044 */ 045 Blob getExternalBlobForUri(String uri) throws PropertyException, IOException; 046 047 /** 048 * Returns the external blob adapter registered for given prefix. 049 * 050 * @see ExternalBlobAdapter 051 */ 052 ExternalBlobAdapter getExternalBlobAdapterForPrefix(String prefix); 053 054 /** 055 * Returns the external blob adapter parsed from given URI. 056 * 057 * @see ExternalBlobAdapter 058 */ 059 ExternalBlobAdapter getExternalBlobAdapterForUri(String uri); 060 061}