1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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.portal.SystemException;
26  import com.liferay.portal.model.Lock;
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  public abstract class BaseWebDAVStorageImpl implements WebDAVStorage {
37  
38      @SuppressWarnings("unused")
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      @SuppressWarnings("unused")
48      public int copySimpleResource(
49              WebDAVRequest webDavRequest, Resource resource, String destination,
50              boolean overwrite)
51          throws WebDAVException {
52  
53          return HttpServletResponse.SC_FORBIDDEN;
54      }
55  
56      @SuppressWarnings("unused")
57      public int deleteResource(WebDAVRequest webDavRequest)
58          throws WebDAVException {
59  
60          return HttpServletResponse.SC_FORBIDDEN;
61      }
62  
63      public String getRootPath() {
64          return _rootPath;
65      }
66  
67      public String getToken() {
68          return WebDAVUtil.getStorageToken(getClass().getName());
69      }
70  
71      public boolean isAvailable(WebDAVRequest webDavRequest)
72          throws WebDAVException {
73  
74          if (getResource(webDavRequest) == null) {
75              return false;
76          }
77          else {
78              return true;
79          }
80      }
81  
82      public boolean isSupportsClassTwo() {
83          return false;
84      }
85  
86      @SuppressWarnings("unused")
87      public Status lockResource(
88              WebDAVRequest webDavRequest, String owner, long timeout)
89          throws WebDAVException {
90  
91          return null;
92      }
93  
94      @SuppressWarnings("unused")
95      public Status makeCollection(WebDAVRequest webDavRequest)
96          throws WebDAVException {
97  
98          return new Status(HttpServletResponse.SC_FORBIDDEN);
99      }
100 
101     @SuppressWarnings("unused")
102     public int moveCollectionResource(
103             WebDAVRequest webDavRequest, Resource resource, String destination,
104             boolean overwrite)
105         throws WebDAVException {
106 
107         return HttpServletResponse.SC_FORBIDDEN;
108     }
109 
110     @SuppressWarnings("unused")
111     public int moveSimpleResource(
112             WebDAVRequest webDavRequest, Resource resource, String destination,
113             boolean overwrite)
114         throws WebDAVException {
115 
116         return HttpServletResponse.SC_FORBIDDEN;
117     }
118 
119     @SuppressWarnings("unused")
120     public int putResource(WebDAVRequest webDavRequest) throws WebDAVException {
121         return HttpServletResponse.SC_FORBIDDEN;
122     }
123 
124     @SuppressWarnings("unused")
125     public Lock refreshResourceLock(
126             WebDAVRequest webDavRequest, String uuid, long timeout)
127         throws WebDAVException {
128 
129         return null;
130     }
131 
132     public void setRootPath(String rootPath) {
133         _rootPath = rootPath;
134     }
135 
136     @SuppressWarnings("unused")
137     public boolean unlockResource(WebDAVRequest webDavRequest, String token)
138         throws WebDAVException {
139 
140         return false;
141     }
142 
143     protected long getPlid(long groupId) throws SystemException {
144         return LayoutLocalServiceUtil.getDefaultPlid(groupId);
145     }
146 
147     private String _rootPath;
148 
149 }