KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > services > webpage > WebPageManager


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 JavaDoc;
21 import javax.servlet.http.HttpServletResponse JavaDoc;
22 import javax.servlet.http.HttpServlet JavaDoc;
23 import javax.servlet.ServletConfig JavaDoc;
24 import javax.servlet.ServletException JavaDoc;
25
26 // java.io
27
import java.io.IOException JavaDoc;
28
29 // java.util
30
import java.util.Collection JavaDoc;
31
32 /**
33  * <P>This is a commodity static accessor class around the
34  * <code>WebPageService</code> interface</P>
35  *
36  * @see org.apache.jetspeed.services.webpage.WebPageService
37  *
38  * @author <a HREF="mailto:taylor@apache.org">David Sean Taylor</a>
39  * @version $Id: WebPageManager.java,v 1.2 2004/02/23 03:46:26 jford Exp $
40  */

41
42 public class WebPageManager
43 {
44
45     // the singleton service reference
46
private static WebPageService service = null;
47    
48
49     /**
50      * Commodity method for getting a reference to the service
51      * singleton
52      */

53     private static WebPageService getService()
54     {
55         if (service == null)
56         {
57             // TODO: load from configuration
58
service = new JetspeedWebPageService();
59         }
60         return service;
61     }
62     
63     /**
64      * @see WebPageService#isInit
65      */

66     public static boolean isInit()
67     {
68        return getService().isInit();
69     }
70
71     /**
72      * @see WebPageService#get
73      */

74     public static void get(HttpServlet JavaDoc servlet,
75                            HttpServletRequest JavaDoc request,
76                            HttpServletResponse JavaDoc response)
77                            throws ServletException JavaDoc, IOException JavaDoc
78     {
79        getService().get(servlet, request, response);
80     }
81
82     /**
83      * @see WebPageService#post
84      */

85     public static void post(HttpServlet JavaDoc servlet,
86                             HttpServletRequest JavaDoc request,
87                             HttpServletResponse JavaDoc response)
88         throws ServletException JavaDoc, IOException JavaDoc
89     {
90        getService().post(servlet, request, response);
91     }
92
93
94     /**
95      * @see WebPageService#init
96      */

97     public static void init(ServletConfig JavaDoc config)
98             throws ServletException JavaDoc, IOException JavaDoc
99     {
100         getService().init(config);
101     }
102
103     /**
104      * @see WebPageService#destroy
105      */

106     public static void destroy()
107     {
108         getService().destroy();
109     }
110
111     /**
112      * @see WebPageService#getSessions
113      */

114     public static Collection JavaDoc getSessions()
115     {
116         return getService().getSessions();
117     }
118
119     /**
120      * @see WebPageService#getSession
121      */

122     public static SessionMap getSession(String JavaDoc id)
123     {
124         return getService().getSession(id);
125     }
126
127     /**
128      * @see WebPageService#getNetworkElements
129      */

130     public static Collection JavaDoc getSites()
131     {
132         return getService().getSites();
133     }
134
135     /**
136      * @see WebPageService#getErrorString
137      */

138     public static String JavaDoc getErrorString()
139     {
140         return getService().getErrorString();
141     }
142
143 }
144
Popular Tags