1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.webdav;
21  
22  import com.liferay.lock.model.Lock;
23  import com.liferay.portal.SystemException;
24  import com.liferay.portal.service.LayoutLocalServiceUtil;
25  
26  import javax.servlet.http.HttpServletResponse;
27  
28  /**
29   * <a href="BaseWebDAVStorageImpl.java.html"><b><i>View Source</i></b></a>
30   *
31   * @author Brian Wing Shun Chan
32   *
33   */
34  public abstract class BaseWebDAVStorageImpl implements WebDAVStorage {
35  
36      public int copyCollectionResource(
37              WebDAVRequest webDavRequest, Resource resource, String destination,
38              boolean overwrite, long depth)
39          throws WebDAVException {
40  
41          return HttpServletResponse.SC_FORBIDDEN;
42      }
43  
44      public int copySimpleResource(
45              WebDAVRequest webDavRequest, Resource resource, String destination,
46              boolean overwrite)
47          throws WebDAVException {
48  
49          return HttpServletResponse.SC_FORBIDDEN;
50      }
51  
52      public int deleteResource(WebDAVRequest webDavRequest)
53          throws WebDAVException {
54  
55          return HttpServletResponse.SC_FORBIDDEN;
56      }
57  
58      public String getRootPath() {
59          return _rootPath;
60      }
61  
62      public String getToken() {
63          return WebDAVUtil.getStorageToken(getClass().getName());
64      }
65  
66      public boolean isAvailable(WebDAVRequest webDavRequest)
67          throws WebDAVException {
68  
69          if (getResource(webDavRequest) == null) {
70              return false;
71          }
72          else {
73              return true;
74          }
75      }
76  
77      public boolean isSupportsClassTwo() {
78          return false;
79      }
80  
81      public Status lockResource(
82              WebDAVRequest webDavRequest, String owner, long timeout)
83          throws WebDAVException {
84  
85          return null;
86      }
87  
88      public Status makeCollection(WebDAVRequest webDavRequest)
89          throws WebDAVException {
90  
91          return new Status(HttpServletResponse.SC_FORBIDDEN);
92      }
93  
94      public int moveCollectionResource(
95              WebDAVRequest webDavRequest, Resource resource, String destination,
96              boolean overwrite)
97          throws WebDAVException {
98  
99          return HttpServletResponse.SC_FORBIDDEN;
100     }
101 
102     public int moveSimpleResource(
103             WebDAVRequest webDavRequest, Resource resource, String destination,
104             boolean overwrite)
105         throws WebDAVException {
106 
107         return HttpServletResponse.SC_FORBIDDEN;
108     }
109 
110     public int putResource(WebDAVRequest webDavRequest) throws WebDAVException {
111         return HttpServletResponse.SC_FORBIDDEN;
112     }
113 
114     public Lock refreshResourceLock(
115             WebDAVRequest webDavRequest, String uuid, long timeout)
116         throws WebDAVException {
117 
118         return null;
119     }
120 
121     public void setRootPath(String rootPath) {
122         _rootPath = rootPath;
123     }
124 
125     public boolean unlockResource(WebDAVRequest webDavRequest, String token)
126         throws WebDAVException {
127 
128         return false;
129     }
130 
131     protected long getPlid(long groupId) throws SystemException {
132         return LayoutLocalServiceUtil.getDefaultPlid(groupId);
133     }
134 
135     private String _rootPath;
136 
137 }