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 * Gagnavarslan ehf 018 */ 019package org.nuxeo.ecm.webdav.backend; 020 021import org.nuxeo.common.utils.Path; 022import org.nuxeo.ecm.core.api.Blob; 023import org.nuxeo.ecm.core.api.CoreSession; 024import org.nuxeo.ecm.core.api.DocumentModel; 025import org.nuxeo.ecm.core.api.DocumentRef; 026import org.nuxeo.ecm.core.api.PathRef; 027 028import java.util.LinkedList; 029import java.util.List; 030 031public interface Backend { 032 033 String getRootPath(); 034 035 String getRootUrl(); 036 037 CoreSession getSession(); 038 039 CoreSession getSession(boolean synchronize); 040 041 String getBackendDisplayName(); 042 043 void saveChanges(); 044 045 boolean isLocked(DocumentRef ref); 046 047 boolean canUnlock(DocumentRef ref); 048 049 String lock(DocumentRef ref); 050 051 boolean unlock(DocumentRef ref); 052 053 String getCheckoutUser(DocumentRef ref); 054 055 Path parseLocation(String location); 056 057 DocumentModel resolveLocation(String location); 058 059 void removeItem(String location); 060 061 void removeItem(DocumentRef ref); 062 063 void renameItem(DocumentModel source, String destinationName); 064 065 DocumentModel moveItem(DocumentModel source, PathRef targetParentRef); 066 067 DocumentModel moveItem(DocumentModel source, DocumentRef targetParentRef, String name); 068 069 DocumentModel updateDocument(DocumentModel doc, String name, Blob content); 070 071 DocumentModel copyItem(DocumentModel source, PathRef targetParentRef); 072 073 DocumentModel createFolder(String parentPath, String name); 074 075 DocumentModel createFile(String parentPath, String name, Blob content); 076 077 DocumentModel createFile(String parentPath, String name); 078 079 List<DocumentModel> getChildren(DocumentRef ref); 080 081 boolean isRename(String source, String destination); 082 083 boolean exists(String location); 084 085 boolean hasPermission(DocumentRef docRef, String permission); 086 087 String getDisplayName(DocumentModel doc); 088 089 LinkedList<String> getVirtualFolderNames(); 090 091 Backend getBackend(String path); 092 093 boolean isVirtual(); 094 095 boolean isRoot(); 096 097 String getVirtualPath(String path); 098 099 DocumentModel getDocument(String location); 100 101}