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 * Returns an initialized doc based on a given blob. 059 * 060 * @param input the blob containing the content and the mime type 061 * @param path the path were to create the document 062 * @param overwrite boolean how decide to overwrite or not 063 * @param fullName the fullname that contains the filename 064 * @param noMimeTypeCheck true if the blob's mime-type doesn't have to be checked against fullName 065 * @return the created Document 066 * 067 * @since 8.10 068 */ 069 DocumentModel createDocumentFromBlob(CoreSession documentManager, Blob input, String path, boolean overwrite, 070 String fullName, boolean noMimeTypeCheck) throws IOException; 071 072 /** 073 * Just applies the same actions as creation but does not changes the doc type. 074 * 075 * @param input the blob containing the content and the mime type 076 * @param path the path to the file to update 077 * @param fullName the full name that contains the filename 078 * @return the updated Document 079 */ 080 DocumentModel updateDocumentFromBlob(CoreSession documentManager, Blob input, String path, String fullName); 081 082 /** 083 * Creates a Folder. 084 * 085 * @param fullname the full name of the folder 086 * @param path the path were to create the folder 087 * @return the Folder Created 088 */ 089 DocumentModel createFolder(CoreSession documentManager, String fullname, String path) throws 090 IOException; 091 092 /** 093 * Returns the list of document that are to be suggested to principalName as a candidate container for a new 094 * document of type docType on all registered repositories. 095 * 096 * @return the list of candidate containers 097 */ 098 DocumentModelList getCreationContainers(Principal principal, String docType); 099 100 /** 101 * Returns the list of document that are to be suggested to the principal of documentManager as a candidate 102 * container for a new document of type docType. 103 * 104 * @return the list of candidate containers 105 */ 106 DocumentModelList getCreationContainers(CoreSession documentManager, String docType); 107 108 List<DocumentLocation> findExistingDocumentWithFile(CoreSession documentManager, String path, String digest, 109 Principal principal); 110 111 boolean isUnicityEnabled(); 112 113 List<String> getFields(); 114 115 String getDigestAlgorithm(); 116 117 boolean isDigestComputingEnabled(); 118 119 /** 120 * Gets the versioning applied on an overwritten document before it is overwritten. 121 * 122 * @since 5.7 123 */ 124 VersioningOption getVersioningOption(); 125 126 /** 127 * Checks whether versioning should also be applied after a document is added. 128 * 129 * @since 5.7 130 */ 131 boolean doVersioningAfterAdd(); 132 133}