001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Gagnavarslan ehf
016 */
017package org.nuxeo.ecm.webdav.backend;
018
019import org.nuxeo.common.utils.Path;
020import org.nuxeo.ecm.core.api.Blob;
021import org.nuxeo.ecm.core.api.CoreSession;
022import org.nuxeo.ecm.core.api.DocumentModel;
023import org.nuxeo.ecm.core.api.DocumentRef;
024import org.nuxeo.ecm.core.api.PathRef;
025
026import java.util.LinkedList;
027import java.util.List;
028
029public interface Backend {
030
031    String getRootPath();
032
033    String getRootUrl();
034
035    CoreSession getSession();
036
037    CoreSession getSession(boolean synchronize);
038
039    String getBackendDisplayName();
040
041    void saveChanges();
042
043    boolean isLocked(DocumentRef ref);
044
045    boolean canUnlock(DocumentRef ref);
046
047    String lock(DocumentRef ref);
048
049    boolean unlock(DocumentRef ref);
050
051    String getCheckoutUser(DocumentRef ref);
052
053    Path parseLocation(String location);
054
055    DocumentModel resolveLocation(String location);
056
057    void removeItem(String location);
058
059    void removeItem(DocumentRef ref);
060
061    void renameItem(DocumentModel source, String destinationName);
062
063    DocumentModel moveItem(DocumentModel source, PathRef targetParentRef);
064
065    DocumentModel moveItem(DocumentModel source, DocumentRef targetParentRef, String name);
066
067    DocumentModel updateDocument(DocumentModel doc, String name, Blob content);
068
069    DocumentModel copyItem(DocumentModel source, PathRef targetParentRef);
070
071    DocumentModel createFolder(String parentPath, String name);
072
073    DocumentModel createFile(String parentPath, String name, Blob content);
074
075    DocumentModel createFile(String parentPath, String name);
076
077    List<DocumentModel> getChildren(DocumentRef ref);
078
079    boolean isRename(String source, String destination);
080
081    boolean exists(String location);
082
083    boolean hasPermission(DocumentRef docRef, String permission);
084
085    String getDisplayName(DocumentModel doc);
086
087    LinkedList<String> getVirtualFolderNames();
088
089    Backend getBackend(String path);
090
091    boolean isVirtual();
092
093    boolean isRoot();
094
095    String getVirtualPath(String path);
096
097    DocumentModel getDocument(String location);
098
099}