001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.connector;
017:
018: import javax.resource.spi.endpoint.MessageEndpointFactory;
019:
020: import org.apache.geronimo.gbean.DynamicGBean;
021: import org.apache.geronimo.gbean.DynamicGBeanDelegate;
022: import org.apache.geronimo.gbean.GBeanInfo;
023: import org.apache.geronimo.gbean.GBeanInfoBuilder;
024: import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
025:
026: /**
027: *
028: * @version $Revision: 550546 $
029: */
030: public class ActivationSpecWrapperGBean extends ActivationSpecWrapper
031: implements DynamicGBean {
032:
033: private final DynamicGBeanDelegate delegate;
034:
035: public ActivationSpecWrapperGBean() {
036: delegate = null;
037: }
038:
039: public ActivationSpecWrapperGBean(final String activationSpecClass,
040: final String containerId,
041: final ResourceAdapterWrapper resourceAdapterWrapper,
042: final ClassLoader cl) throws IllegalAccessException,
043: InstantiationException, ClassNotFoundException {
044: super (activationSpecClass, containerId, resourceAdapterWrapper,
045: cl);
046: delegate = new DynamicGBeanDelegate();
047: delegate.addAll(activationSpec);
048: }
049:
050: //DynamicGBean implementation
051:
052: /**
053: * Delegating DynamicGBean getAttribute method.
054: *
055: * @param name of attribute.
056: * @return attribute value.
057: * @throws Exception
058: */
059: public Object getAttribute(final String name) throws Exception {
060: return delegate.getAttribute(name);
061: }
062:
063: /**
064: * Delegating DynamicGBean setAttribute method.
065: *
066: * @param name of attribute.
067: * @param value of attribute to be set.
068: * @throws Exception
069: */
070: public void setAttribute(final String name, final Object value)
071: throws Exception {
072: delegate.setAttribute(name, value);
073: }
074:
075: /**
076: * no-op DynamicGBean method
077: *
078: * @param name
079: * @param arguments
080: * @param types
081: * @return nothing, there are no operations.
082: * @throws Exception
083: */
084: public Object invoke(final String name, final Object[] arguments,
085: final String[] types) throws Exception {
086: //we have no dynamic operations.
087: return null;
088: }
089:
090: public static final GBeanInfo GBEAN_INFO;
091:
092: static {
093: GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(
094: ActivationSpecWrapperGBean.class,
095: NameFactory.JCA_ACTIVATION_SPEC);
096: infoBuilder.addAttribute("activationSpecClass", String.class,
097: true);
098: infoBuilder.addAttribute("containerId", String.class, true);
099: infoBuilder.addAttribute("classLoader", ClassLoader.class,
100: false);
101:
102: infoBuilder.addReference("ResourceAdapterWrapper",
103: ResourceAdapterWrapper.class,
104: NameFactory.RESOURCE_ADAPTER);
105:
106: infoBuilder.addOperation("activate",
107: new Class[] { MessageEndpointFactory.class });
108: infoBuilder.addOperation("deactivate",
109: new Class[] { MessageEndpointFactory.class });
110:
111: infoBuilder.setConstructor(new String[] {
112: "activationSpecClass", "containerId",
113: "ResourceAdapterWrapper", "classLoader" });
114:
115: GBEAN_INFO = infoBuilder.getBeanInfo();
116: }
117:
118: public static GBeanInfo getGBeanInfo() {
119: return GBEAN_INFO;
120: }
121:
122: }
|