001/* 002 * (C) Copyright 2006-2007 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: JOOoConvertPluginImpl.java 18651 2007-05-13 20:28:53Z sfermigier $ 020 */ 021 022package org.nuxeo.ecm.platform.filemanager.api; 023 024import java.io.IOException; 025import java.security.NoSuchAlgorithmException; 026import java.security.Principal; 027import java.util.List; 028 029import org.nuxeo.ecm.core.api.Blob; 030import org.nuxeo.ecm.core.api.CoreSession; 031import org.nuxeo.ecm.core.api.DocumentLocation; 032import org.nuxeo.ecm.core.api.DocumentModel; 033import org.nuxeo.ecm.core.api.DocumentModelList; 034import org.nuxeo.ecm.core.api.VersioningOption; 035 036/** 037 * File Manager. 038 * <p> 039 * File Manager to handle file 040 * 041 * @author Andreas Kalogeropoulos 042 */ 043public interface FileManager { 044 045 /** 046 * Returns an initialized doc based on a given blob. 047 * 048 * @param input the blob containing the content and the mime type 049 * @param path the path were to create the document 050 * @param overwrite boolean how decide to overwrite or not 051 * @param fullName the fullname that contains the filename 052 * @return the created Document 053 */ 054 DocumentModel createDocumentFromBlob(CoreSession documentManager, Blob input, String path, boolean overwrite, 055 String fullName) throws IOException; 056 057 /** 058 * Just applies the same actions as creation but does not changes the doc type. 059 * 060 * @param input the blob containing the content and the mime type 061 * @param path the path to the file to update 062 * @param fullName the full name that contains the filename 063 * @return the updated Document 064 */ 065 DocumentModel updateDocumentFromBlob(CoreSession documentManager, Blob input, String path, String fullName); 066 067 /** 068 * Creates a Folder. 069 * 070 * @param fullname the full name of the folder 071 * @param path the path were to create the folder 072 * @return the Folder Created 073 */ 074 DocumentModel createFolder(CoreSession documentManager, String fullname, String path) throws 075 IOException; 076 077 /** 078 * Returns the list of document that are to be suggested to principalName as a candidate container for a new 079 * document of type docType on all registered repositories. 080 * 081 * @return the list of candidate containers 082 */ 083 DocumentModelList getCreationContainers(Principal principal, String docType); 084 085 /** 086 * Returns the list of document that are to be suggested to the principal of documentManager as a candidate 087 * container for a new document of type docType. 088 * 089 * @return the list of candidate containers 090 */ 091 DocumentModelList getCreationContainers(CoreSession documentManager, String docType); 092 093 List<DocumentLocation> findExistingDocumentWithFile(CoreSession documentManager, String path, String digest, 094 Principal principal); 095 096 boolean isUnicityEnabled(); 097 098 List<String> getFields(); 099 100 String getDigestAlgorithm(); 101 102 boolean isDigestComputingEnabled(); 103 104 /** 105 * Gets the versioning applied on an overwritten document before it is overwritten. 106 * 107 * @since 5.7 108 */ 109 VersioningOption getVersioningOption(); 110 111 /** 112 * Checks whether versioning should also be applied after a document is added. 113 * 114 * @since 5.7 115 */ 116 boolean doVersioningAfterAdd(); 117 118}