1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.webdav;
24  
25  import com.liferay.lock.model.Lock;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.service.LayoutLocalServiceUtil;
28  
29  import javax.servlet.http.HttpServletResponse;
30  
31  /**
32   * <a href="BaseWebDAVStorageImpl.java.html"><b><i>View Source</i></b></a>
33   *
34   * @author Brian Wing Shun Chan
35   *
36   */
37  public abstract class BaseWebDAVStorageImpl implements WebDAVStorage {
38  
39      public int copyCollectionResource(
40              WebDAVRequest webDavRequest, Resource resource, String destination,
41              boolean overwrite, long depth)
42          throws WebDAVException {
43  
44          return HttpServletResponse.SC_FORBIDDEN;
45      }
46  
47      public int copySimpleResource(
48              WebDAVRequest webDavRequest, Resource resource, String destination,
49              boolean overwrite)
50          throws WebDAVException {
51  
52          return HttpServletResponse.SC_FORBIDDEN;
53      }
54  
55      public int deleteResource(WebDAVRequest webDavRequest)
56          throws WebDAVException {
57  
58          return HttpServletResponse.SC_FORBIDDEN;
59      }
60  
61      public String getRootPath() {
62          return _rootPath;
63      }
64  
65      public String getToken() {
66          return _token;
67      }
68  
69      public boolean isAvailable(WebDAVRequest webDavRequest)
70          throws WebDAVException {
71  
72          if (getResource(webDavRequest) == null) {
73              return false;
74          }
75          else {
76              return true;
77          }
78      }
79  
80      public boolean isSupportsClassTwo() {
81          return false;
82      }
83  
84      public Status lockResource(
85              WebDAVRequest webDavRequest, String owner, long timeout)
86          throws WebDAVException {
87  
88          return null;
89      }
90  
91      public Status makeCollection(WebDAVRequest webDavRequest)
92          throws WebDAVException {
93  
94          return new Status(HttpServletResponse.SC_FORBIDDEN);
95      }
96  
97      public int moveCollectionResource(
98              WebDAVRequest webDavRequest, Resource resource, String destination,
99              boolean overwrite)
100         throws WebDAVException {
101 
102         return HttpServletResponse.SC_FORBIDDEN;
103     }
104 
105     public int moveSimpleResource(
106             WebDAVRequest webDavRequest, Resource resource, String destination,
107             boolean overwrite)
108         throws WebDAVException {
109 
110         return HttpServletResponse.SC_FORBIDDEN;
111     }
112 
113     public int putResource(WebDAVRequest webDavRequest) throws WebDAVException {
114         return HttpServletResponse.SC_FORBIDDEN;
115     }
116 
117     public Lock refreshResourceLock(
118             WebDAVRequest webDavRequest, String uuid, long timeout)
119         throws WebDAVException {
120 
121         return null;
122     }
123 
124     public void setRootPath(String rootPath) {
125         _rootPath = rootPath;
126     }
127 
128     public void setToken(String token) {
129         _token = token;
130     }
131 
132     public boolean unlockResource(WebDAVRequest webDavRequest, String token)
133         throws WebDAVException {
134 
135         return false;
136     }
137 
138     protected long getPlid(long groupId) throws SystemException {
139         return LayoutLocalServiceUtil.getDefaultPlid(groupId);
140     }
141 
142     private String _rootPath;
143     private String _token;
144 
145 }