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    /** @deprecated since 10.10, unused */
034    @Deprecated
035    String getRootPath();
036
037    /** @deprecated since 10.10, unused */
038    @Deprecated
039    String getRootUrl();
040
041    CoreSession getSession();
042
043    CoreSession getSession(boolean synchronize);
044
045    String getBackendDisplayName();
046
047    void saveChanges();
048
049    boolean isLocked(DocumentRef ref);
050
051    boolean canUnlock(DocumentRef ref);
052
053    String lock(DocumentRef ref);
054
055    boolean unlock(DocumentRef ref);
056
057    String getCheckoutUser(DocumentRef ref);
058
059    Path parseLocation(String location);
060
061    DocumentModel resolveLocation(String location);
062
063    void removeItem(String location);
064
065    void removeItem(DocumentRef ref);
066
067    /** @deprecated since 10.10, unused, use {@link #moveItem} instead */
068    @Deprecated
069    void renameItem(DocumentModel source, String destinationName);
070
071    /** @deprecated since 10.10, unused */
072    @Deprecated
073    DocumentModel moveItem(DocumentModel source, PathRef targetParentRef);
074
075    DocumentModel moveItem(DocumentModel source, DocumentRef targetParentRef, String name);
076
077    DocumentModel updateDocument(DocumentModel doc, String name, Blob content);
078
079    DocumentModel copyItem(DocumentModel source, PathRef targetParentRef);
080
081    DocumentModel createFolder(String parentPath, String name);
082
083    DocumentModel createFile(String parentPath, String name, Blob content);
084
085    /** @deprecated since 10.10, unused */
086    @Deprecated
087    DocumentModel createFile(String parentPath, String name);
088
089    List<DocumentModel> getChildren(DocumentRef ref);
090
091    /** @deprecated since 10.10, unused */
092    @Deprecated
093    boolean isRename(String source, String destination);
094
095    boolean exists(String location);
096
097    boolean hasPermission(DocumentRef docRef, String permission);
098
099    String getDisplayName(DocumentModel doc);
100
101    LinkedList<String> getVirtualFolderNames();
102
103    Backend getBackend(String path);
104
105    boolean isVirtual();
106
107    /** @deprecated since 10.10, unused */
108    @Deprecated
109    boolean isRoot();
110
111    String getVirtualPath(String path);
112
113    DocumentModel getDocument(String location);
114
115}