01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.jetty6.cluster.wadi;
17:
18: import org.apache.geronimo.clustering.wadi.WADISessionManager;
19: import org.apache.geronimo.gbean.GBeanInfo;
20: import org.apache.geronimo.gbean.GBeanInfoBuilder;
21: import org.apache.geronimo.gbean.GBeanLifecycle;
22: import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
23: import org.apache.geronimo.jetty6.PreHandler;
24: import org.apache.geronimo.jetty6.PreHandlerFactory;
25: import org.codehaus.wadi.core.manager.Manager;
26:
27: /**
28: *
29: * @version $Rev$ $Date$
30: */
31: public class WADIClusteredPreHandlerFactory implements
32: PreHandlerFactory, GBeanLifecycle {
33:
34: private final WADISessionManager sessionManager;
35: private Manager wadiManager;
36:
37: public WADIClusteredPreHandlerFactory(
38: WADISessionManager sessionManager) {
39: if (null == sessionManager) {
40: throw new IllegalArgumentException(
41: "sessionManager is required");
42: }
43: this .sessionManager = sessionManager;
44: }
45:
46: public void doStart() throws Exception {
47: wadiManager = sessionManager.getManager();
48: }
49:
50: public void doStop() throws Exception {
51: }
52:
53: public void doFail() {
54: }
55:
56: public PreHandler createHandler() {
57: return new WADIClusteredPreHandler(wadiManager);
58: }
59:
60: public static final GBeanInfo GBEAN_INFO;
61: public static final String GBEAN_REF_WADI_SESSION_MANAGER = "WADISessionManager";
62:
63: static {
64: GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(
65: "WADI Pre-Handler Factory",
66: WADIClusteredPreHandlerFactory.class,
67: NameFactory.GERONIMO_SERVICE);
68:
69: infoFactory.addReference(GBEAN_REF_WADI_SESSION_MANAGER,
70: WADISessionManager.class, NameFactory.GERONIMO_SERVICE);
71:
72: infoFactory.addInterface(PreHandlerFactory.class);
73:
74: infoFactory
75: .setConstructor(new String[] { GBEAN_REF_WADI_SESSION_MANAGER });
76:
77: GBEAN_INFO = infoFactory.getBeanInfo();
78: }
79:
80: public static GBeanInfo getGBeanInfo() {
81: return GBEAN_INFO;
82: }
83:
84: }
|