View Javadoc

1   /*
2    * Copyright 2000-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.services.webpage;
18  
19  // javax.servlet
20  import javax.servlet.http.HttpServletRequest;
21  import javax.servlet.http.HttpServletResponse;
22  import javax.servlet.ServletConfig;
23  import javax.servlet.http.HttpServlet;
24  import javax.servlet.ServletException;
25  
26  // java.io
27  import java.io.IOException;
28  
29  // java.util
30  import java.util.Collection;
31  
32  
33  /***
34   * The WebPage Service service interface definition.
35   * All implementations of an WebPage Service must implement this interface.
36   *
37   * Interface defines methods to control the WebPage service, 
38   * to manage 0..n sessions amongst 0..n sites.
39   *
40   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
41   * @version $Id: WebPageService.java,v 1.2 2004/02/23 03:46:26 jford Exp $
42   */
43  
44  interface WebPageService 
45  {
46  
47      /*** The name of this service */
48      public final static String SERVICE_NAME      = "WebPageService";
49  
50      /***
51       * The primary method invoked when the a proxied GET is executed.
52       *
53       * @param servlet the Servlet.          
54       * @param req Servlet request.
55       * @param res Servlet response.
56       * @exception IOException a servlet exception.
57       * @exception ServletException a servlet exception.
58       */
59      
60      public void get(HttpServlet servlet,
61                      HttpServletRequest request, 
62                      HttpServletResponse response)
63          throws ServletException, IOException;
64  
65  
66      /***
67       * The primary method invoked when the a proxied POST is executed.
68       *
69       * @param servlet the Servlet.     
70       * @param req Servlet request.
71       * @param res Servlet response.
72       * @exception IOException a servlet exception.
73       * @exception ServletException a servlet exception.
74       */
75      public void post(HttpServlet servlet,
76                       HttpServletRequest request, 
77                       HttpServletResponse response)
78          throws ServletException, IOException;
79  
80      /***
81       * One time initialization of the WebPage service
82       *
83       * @param config the servlet configuration.     
84       * @exception IOException a servlet exception.
85       * @exception ServletException a servlet exception.
86       */
87      public boolean init(ServletConfig config)
88              throws ServletException, IOException;
89  
90      /***
91       * One time de-initialization of the proxy service
92       *
93       */
94      public void destroy();
95  
96  
97      /***
98       * Returns true if the service was initialized successfully.
99       *
100      * @return true if the service was initialized successfully.
101      */
102     public boolean isInit();
103 
104     /***
105      * Returns a snapshot of all the active and inactive sessions.
106      *
107      * @return the collection of sessions.
108      */
109     public Collection getSessions();
110 
111     /***
112      * Returns a Session, give a string id key identifying that session.
113      *
114      * @param id The ID of the session.
115      * @return The corresponding sessions.
116      */
117     public SessionMap getSession(String id);
118 
119     /***
120      * Returns a snapshot collection of all the sites managed by this Proxy service.
121      *
122      * @return the collection of managed sites.
123      */
124     public Collection getSites();
125 
126 
127     /***
128      * Returns the error string from failed initialized.
129      *
130      * @return the error string from last error.
131      */
132     public String getErrorString();
133 }
134