1 /**
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one or more
4 * contributor license agreements. See the NOTICE file distributed with
5 * this work for additional information regarding copyright ownership.
6 * The ASF licenses this file to You under the Apache License, Version 2.0
7 * (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.apache.geronimo.jetty.cluster;
19
20 import org.apache.geronimo.clustering.SessionManager;
21 import org.apache.geronimo.gbean.GBeanInfo;
22 import org.apache.geronimo.gbean.GBeanInfoBuilder;
23 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
24 import org.apache.geronimo.jetty.WebApplicationHandlerFactory;
25 import org.mortbay.jetty.servlet.WebApplicationHandler;
26
27 /**
28 *
29 * @version $Rev$ $Date$
30 */
31 public class ClusteredWebApplicationHandlerFactory implements WebApplicationHandlerFactory {
32 private final SessionManager sessionManager;
33
34 public ClusteredWebApplicationHandlerFactory(SessionManager sessionManager) {
35 this.sessionManager = sessionManager;
36 }
37
38 public WebApplicationHandler createHandler() {
39 ClusteredSessionManager clusteredSessionManager = new ClusteredSessionManager(sessionManager);
40 return new ClusteredWebApplicationHandler(clusteredSessionManager);
41 }
42
43 public static final GBeanInfo GBEAN_INFO;
44
45 public static final String GBEAN_REF_SESSION_MANAGER = "SessionManager";
46
47 static {
48 GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Clustered Web Application Handler Factory",
49 ClusteredWebApplicationHandlerFactory.class, NameFactory.GERONIMO_SERVICE);
50
51 infoFactory.addReference(GBEAN_REF_SESSION_MANAGER, SessionManager.class, NameFactory.GERONIMO_SERVICE);
52
53 infoFactory.addInterface(WebApplicationHandlerFactory.class);
54
55 infoFactory.setConstructor(new String[]{GBEAN_REF_SESSION_MANAGER});
56
57 GBEAN_INFO = infoFactory.getBeanInfo();
58 }
59
60 public static GBeanInfo getGBeanInfo() {
61 return GBEAN_INFO;
62 }
63 }