KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > jetty6 > cluster > wadi > WADIClusteredPreHandlerFactory


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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  */

17 package org.apache.geronimo.jetty6.cluster.wadi;
18
19 import org.apache.geronimo.clustering.wadi.WADISessionManager;
20 import org.apache.geronimo.gbean.GBeanInfo;
21 import org.apache.geronimo.gbean.GBeanInfoBuilder;
22 import org.apache.geronimo.gbean.GBeanLifecycle;
23 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
24 import org.apache.geronimo.jetty6.PreHandler;
25 import org.apache.geronimo.jetty6.PreHandlerFactory;
26 import org.apache.geronimo.jetty6.SessionHandlerFactory;
27 import org.codehaus.wadi.impl.ClusteredManager;
28
29
30 /**
31  *
32  * @version $Rev$ $Date$
33  */

34 public class WADIClusteredPreHandlerFactory implements PreHandlerFactory, GBeanLifecycle {
35
36     private final WADISessionManager sessionManager;
37     private ClusteredManager wadiManager;
38
39     public WADIClusteredPreHandlerFactory(WADISessionManager sessionManager) {
40         this.sessionManager = sessionManager;
41     }
42     
43     public void doStart() throws Exception JavaDoc {
44         wadiManager = sessionManager.getManager();
45     }
46     
47     public void doStop() throws Exception JavaDoc {
48     }
49     
50     public void doFail() {
51     }
52     
53     public PreHandler createHandler() {
54         return new WADIClusteredPreHandler(wadiManager);
55     }
56     
57     public static final GBeanInfo GBEAN_INFO;
58     public static final String JavaDoc GBEAN_REF_WADI_SESSION_MANAGER = "WADISessionManager";
59
60     static {
61         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("WADI Pre-Handler Factory",
62                 WADIClusteredPreHandlerFactory.class, NameFactory.GERONIMO_SERVICE);
63
64         infoFactory.addReference(GBEAN_REF_WADI_SESSION_MANAGER, WADISessionManager.class,
65                 NameFactory.GERONIMO_SERVICE);
66
67         infoFactory.addInterface(SessionHandlerFactory.class);
68
69         infoFactory.setConstructor(new String JavaDoc[]{GBEAN_REF_WADI_SESSION_MANAGER});
70
71         GBEAN_INFO = infoFactory.getBeanInfo();
72     }
73
74     public static GBeanInfo getGBeanInfo() {
75         return GBEAN_INFO;
76     }
77
78 }
79
Popular Tags