KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibm > webdav > protocol > http > VersionControlMethod


1 /*
2  * (C) Copyright Simulacra Media Ltd, 2004. All rights reserved.
3  *
4  * The program is provided "AS IS" without any warranty express or
5  * implied, including the warranty of non-infringement and the implied
6  * warranties of merchantibility and fitness for a particular purpose.
7  * Simulacra Media Ltd will not be liable for any damages suffered by you as a result
8  * of using the Program. In no event will Simulacra Media Ltd be liable for any
9  * special, indirect or consequential damages or lost profits even if
10  * Simulacra Media Ltd has been advised of the possibility of their occurrence.
11  * Simulacra Media Ltd will not be liable for any third party claims against you.
12  *
13  */

14 package com.ibm.webdav.protocol.http;
15
16 import java.util.logging.*;
17
18 import javax.servlet.http.*;
19
20 import com.ibm.webdav.*;
21
22 /**
23  * Executes the WebDAV Delta-V VersionControl method.
24  *
25  * @author Michael Bell
26  * @version $Revision: 1.1 $
27  * @since November 13, 2003
28  */

29 public class VersionControlMethod extends WebDAVMethod {
30     private static Logger m_logger = Logger.getLogger(VersionControlMethod.class.getName());
31
32     public static final String JavaDoc METHOD_NAME = "VERSION-CONTROL";
33
34     /**
35      * @param request
36      * @param response
37      * @throws WebDAVException
38      */

39     public VersionControlMethod(
40         HttpServletRequest request,
41         HttpServletResponse response)
42         throws WebDAVException {
43         super(request, response);
44         methodName = METHOD_NAME;
45     }
46
47     /* (non-Javadoc)
48      * @see com.ibm.webdav.protocol.http.WebDAVMethod#execute()
49      */

50     public WebDAVStatus execute() throws WebDAVException {
51         setStatusCode(WebDAVStatus.SC_CREATED); // the default status code
52
try {
53
54             context.setMethodName(METHOD_NAME);
55             resource.versionControl();
56
57             setResponseHeaders();
58             
59
60         } catch (WebDAVException exc) {
61             m_logger.log(Level.INFO, exc.getMessage() + " - " + request.getQueryString());
62             setStatusCode(exc.getStatusCode());
63             
64         } catch (Exception JavaDoc exc) {
65             m_logger.log(Level.WARNING, exc.getMessage(), exc);
66             setStatusCode(WebDAVStatus.SC_INTERNAL_SERVER_ERROR);
67         }
68         return context.getStatusCode();
69     }
70
71 }
72
Popular Tags