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 * Nuxeo - initial API and implementation 018 * 019 * $Id: IODocumentManager.java 30413 2008-02-21 18:38:54Z sfermigier $ 020 */ 021 022package org.nuxeo.ecm.core.io; 023 024import java.io.IOException; 025import java.io.InputStream; 026import java.io.OutputStream; 027import java.io.Serializable; 028import java.util.Collection; 029 030import org.nuxeo.ecm.core.api.DocumentRef; 031 032/** 033 * Defines functional interface that deals directly with documents import using provided DocumentReader or InputStream 034 * as a source and DocumentWriter that knows how the documents will be saved into the repository. 035 * 036 * @author <a href="mailto:[email protected]">Dragos Mihalache</a> 037 */ 038public interface IODocumentManager extends Serializable { 039 040 DocumentTranslationMap importDocuments(InputStream in, String repo, DocumentRef root) throws IOException; 041 042 DocumentTranslationMap importDocuments(InputStream in, DocumentWriter customDocWriter); 043 044 /** 045 * @param customDocReader reader from the input stream 046 * @param customDocWriter 047 */ 048 DocumentTranslationMap importDocuments(DocumentReader customDocReader, DocumentWriter customDocWriter); 049 050 DocumentTranslationMap exportDocuments(OutputStream out, String repo, Collection<DocumentRef> sources, 051 boolean recurse, String format); 052 053 /** 054 * Used in pair with importDocuments(... customDocWriter) 055 */ 056 DocumentTranslationMap exportDocuments(OutputStream out, DocumentReader customDocReader, String format); 057}