1 /**
2 *
3 * Copyright 2005 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.connector;
19
20 import javax.resource.spi.endpoint.MessageEndpointFactory;
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: 356022 $
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 activationSpecClass, final String containerId, final ResourceAdapterWrapper resourceAdapterWrapper, final ClassLoader cl) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
42 super(activationSpecClass, containerId, resourceAdapterWrapper, cl);
43 delegate = new DynamicGBeanDelegate();
44 delegate.addAll(activationSpec);
45 }
46
47
48
49 /**
50 * Delegating DynamicGBean getAttribute method.
51 *
52 * @param name of attribute.
53 * @return attribute value.
54 * @throws Exception
55 */
56 public Object getAttribute(final String name) throws Exception {
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 name, final Object value) throws Exception {
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 invoke(final String name, final Object[] arguments, final String[] types) throws Exception {
81
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.class, true);
90 infoBuilder.addAttribute("containerId", String.class, true);
91 infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
92
93 infoBuilder.addReference("ResourceAdapterWrapper", ResourceAdapterWrapper.class, NameFactory.RESOURCE_ADAPTER);
94
95 infoBuilder.addOperation("activate", new Class[]{MessageEndpointFactory.class});
96 infoBuilder.addOperation("deactivate", new Class[]{MessageEndpointFactory.class});
97
98 infoBuilder.addInterface(ResourceManager.class);
99
100 infoBuilder.setConstructor(new String[]{
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 }