KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > spring > POJOGBean


1 /**
2  *
3  * Copyright 2003-2004 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * 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
18 package org.apache.geronimo.spring;
19
20 import org.apache.commons.logging.Log;
21 import org.apache.commons.logging.LogFactory;
22 import org.apache.geronimo.gbean.GBeanInfo;
23 import org.apache.geronimo.gbean.GBeanInfoBuilder;
24 import org.apache.geronimo.gbean.GBeanLifecycle;
25 import org.apache.geronimo.kernel.Kernel;
26
27 /**
28  * A peer GBean for mediating between Geronimo Kernel and Spring managed POJO...
29  *
30  * @version $Rev: 149468 $
31  */

32 public class POJOGBean
33   implements GBeanLifecycle
34 {
35   protected static final Log _log = LogFactory.getLog(POJOGBean.class);
36
37   // injected into ctor
38
protected final Kernel _kernel;
39   protected final String JavaDoc _objectName;
40   protected final Object JavaDoc _peer;
41
42   //----------------------------------------
43
public static final GBeanInfo GBEAN_INFO;
44
45   static
46   {
47     GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder("Spring Managed POJO", POJOGBean.class);
48
49     infoBuilder.addAttribute("kernel" , Kernel.class , false);
50     infoBuilder.addAttribute("objectName" , String JavaDoc.class , false);
51     infoBuilder.addAttribute("peer" , Object JavaDoc.class , true);
52
53     infoBuilder.setConstructor(new String JavaDoc[]{
54                  "kernel",
55                  "objectName",
56                  "peer"
57                    });
58
59     GBEAN_INFO = infoBuilder.getBeanInfo();
60   }
61
62   public static GBeanInfo getGBeanInfo() {return GBEAN_INFO;}
63
64   //----------------------------------------
65

66   public
67     POJOGBean(Kernel kernel, String JavaDoc objectName, Object JavaDoc peer)
68   {
69     _kernel =kernel;
70     _objectName=objectName;
71     _peer =peer;
72   }
73
74   //----------------------------------------
75
// GBeanLifecycle
76
//----------------------------------------
77

78   public void doStart() throws Exception JavaDoc {}
79   public void doStop() throws Exception JavaDoc {}
80   public void doFail() {}
81 }
82
Popular Tags