KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > connector > ActivationSpecWrapperGBean


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
18 package org.apache.geronimo.connector;
19
20 import javax.resource.spi.endpoint.MessageEndpointFactory JavaDoc;
21
22 import org.apache.geronimo.gbean.GBeanInfo;
23 import org.apache.geronimo.gbean.GBeanInfoBuilder;
24 import org.apache.geronimo.gbean.DynamicGBean;
25 import org.apache.geronimo.gbean.DynamicGBeanDelegate;
26 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
27 import org.apache.geronimo.transaction.manager.ResourceManager;
28
29 /**
30  *
31  * @version $Revision: 486195 $
32  */

33 public class ActivationSpecWrapperGBean extends ActivationSpecWrapper implements DynamicGBean {
34
35     private final DynamicGBeanDelegate delegate;
36
37     public ActivationSpecWrapperGBean() {
38         delegate = null;
39     }
40
41     public ActivationSpecWrapperGBean(final String JavaDoc activationSpecClass, final String JavaDoc containerId, final ResourceAdapterWrapper resourceAdapterWrapper, final ClassLoader JavaDoc cl) throws IllegalAccessException JavaDoc, InstantiationException JavaDoc, ClassNotFoundException JavaDoc {
42         super(activationSpecClass, containerId, resourceAdapterWrapper, cl);
43         delegate = new DynamicGBeanDelegate();
44         delegate.addAll(activationSpec);
45     }
46
47     //DynamicGBean implementation
48

49     /**
50      * Delegating DynamicGBean getAttribute method.
51      *
52      * @param name of attribute.
53      * @return attribute value.
54      * @throws Exception
55      */

56     public Object JavaDoc getAttribute(final String JavaDoc name) throws Exception JavaDoc {
57         return delegate.getAttribute(name);
58     }
59
60     /**
61      * Delegating DynamicGBean setAttribute method.
62      *
63      * @param name of attribute.
64      * @param value of attribute to be set.
65      * @throws Exception
66      */

67     public void setAttribute(final String JavaDoc name, final Object JavaDoc value) throws Exception JavaDoc {
68         delegate.setAttribute(name, value);
69     }
70
71     /**
72      * no-op DynamicGBean method
73      *
74      * @param name
75      * @param arguments
76      * @param types
77      * @return nothing, there are no operations.
78      * @throws Exception
79      */

80     public Object JavaDoc invoke(final String JavaDoc name, final Object JavaDoc[] arguments, final String JavaDoc[] types) throws Exception JavaDoc {
81         //we have no dynamic operations.
82
return null;
83     }
84
85     public static final GBeanInfo GBEAN_INFO;
86
87     static {
88         GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(ActivationSpecWrapperGBean.class, NameFactory.JCA_ACTIVATION_SPEC);
89         infoBuilder.addAttribute("activationSpecClass", String JavaDoc.class, true);
90         infoBuilder.addAttribute("containerId", String JavaDoc.class, true);
91         infoBuilder.addAttribute("classLoader", ClassLoader JavaDoc.class, false);
92
93         infoBuilder.addReference("ResourceAdapterWrapper", ResourceAdapterWrapper.class, NameFactory.RESOURCE_ADAPTER);
94
95         infoBuilder.addOperation("activate", new Class JavaDoc[]{MessageEndpointFactory JavaDoc.class});
96         infoBuilder.addOperation("deactivate", new Class JavaDoc[]{MessageEndpointFactory JavaDoc.class});
97
98         infoBuilder.addInterface(ResourceManager.class);
99
100         infoBuilder.setConstructor(new String JavaDoc[]{
101             "activationSpecClass",
102             "containerId",
103             "ResourceAdapterWrapper",
104             "classLoader"});
105
106         GBEAN_INFO = infoBuilder.getBeanInfo();
107     }
108
109     public static GBeanInfo getGBeanInfo() {
110         return GBEAN_INFO;
111     }
112
113 }
114
Popular Tags