01: /**
02: *
03: */package org.enhydra.dm.api.handler;
04:
05: import java.io.IOException;
06:
07: import javax.servlet.ServletConfig;
08: import javax.servlet.ServletException;
09: import javax.servlet.http.HttpServletRequest;
10: import javax.servlet.http.HttpServletResponse;
11:
12: import org.enhydra.dm.api.DocumentManager;
13: import org.enhydra.dm.api.DocumentStore;
14: import org.enhydra.dm.api.loggers.Log;
15: import org.enhydra.dm.api.util.DesEncription;
16:
17: /**
18: * @author Slobodan Vujasinovic
19: */
20: public interface MethodHandler {
21:
22: /**
23: * Interim status code (102) indicating that the server has accepted the request but
24: * has not yet completed it.
25: */
26: public static final int SC_PROCESSING = 102;
27:
28: /**
29: * Status code (207) providing status for multiple independent operations.
30: */
31: public static final int SC_MULTISTATUS = 207;
32:
33: /**
34: * Status code (422) indicating that the server understands the content type of the
35: * request entity, and the syntax of the request entity is correct, but the contained
36: * instructions could not be processed.
37: */
38: public static final int SC_UNPROCESSABLE_ENTITY = 422;
39:
40: /**
41: * Status code (423) indicating that the source or destination resource of a method is
42: * locked.
43: */
44: public static final int SC_LOCKED = 423;
45:
46: /**
47: * Status code (424) indicating that the method could not be performed because an
48: * action upon which this action depends failed.
49: */
50: public static final int SC_FAILED_DEPENDENCY = 424;
51:
52: /**
53: * Status code (507) indicating that the method could not be performed on a resource
54: * because the server is unable to store the representation needed to successfully
55: * complete the request.
56: */
57: public static final int SC_INSUFFICIENT_STORAGE = 507;
58:
59: /**
60: * Called by the WebDavServlet servlet to indicate that the handler is being placed
61: * into service. Semantics are identical to the <code>Servlet</code>
62: * <code>init</code>
63: * method; the method is called exactly once after instantiation.
64: *
65: * @param config a <code>ServletConfig</code> object containing the Davenport
66: * servlet's configuration and initialization parameters.
67: * @throws ServletException If an error occurs during initialization.
68: */
69: public void init(ServletConfig config,
70: DocumentManager documentManager,
71: DocumentStore documentStore, DesEncription desEncription,
72: Log logger) throws ServletException;
73:
74: /**
75: * Called by the WebDavServlet servlet to indicate that the handler is being taken out
76: * of service. Semantics are identical to the <code>Servlet</code> <code>destroy</code>
77: * method. This method gives the handler an opportunity to clean up any resources that
78: * are being held. After this method has been called, the <code>service</code> method
79: * will not be invoked again.
80: */
81: public void destroy();
82:
83: /**
84: * Called by the WebDavServlet servlet to allow the handler to service a request. The
85: * WebDavServlet servlet will select an appropriate handler for a given HTTP method, and
86: * dispatch the request accordingly.
87: *
88: * @param request The request that is being serviced.
89: * @param response The servlet response object.
90: * @throws IOException If an input or output exception occurs.
91: * @throws ServletException If an exception occurs that interferes with normal
92: * operation.
93: */
94: public void service(HttpServletRequest request,
95: HttpServletResponse response) throws IOException,
96: ServletException;
97:
98: }
|