Package org.apache.geronimo.connector

Source Code of org.apache.geronimo.connector.ActivationSpecWrapperGBean

/**
*  Licensed to the Apache Software Foundation (ASF) under one or more
*  contributor license agreements.  See the NOTICE file distributed with
*  this work for additional information regarding copyright ownership.
*  The ASF licenses this file to You under the Apache License, Version 2.0
*  (the "License"); you may not use this file except in compliance with
*  the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/

package org.apache.geronimo.connector;

import javax.resource.spi.endpoint.MessageEndpointFactory;

import org.apache.geronimo.gbean.DynamicGBean;
import org.apache.geronimo.gbean.DynamicGBeanDelegate;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;

/**
*
* @version $Revision: 928119 $
*/
public class ActivationSpecWrapperGBean extends ActivationSpecWrapper implements DynamicGBean {

    private final DynamicGBeanDelegate delegate;

    public ActivationSpecWrapperGBean() {
        delegate = null;
    }

    public ActivationSpecWrapperGBean(final String activationSpecClass, final String containerId, final ResourceAdapterWrapper resourceAdapterWrapper, final ClassLoader cl) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
        super(activationSpecClass, containerId, resourceAdapterWrapper, cl);
        delegate = new DynamicGBeanDelegate();
        delegate.addAll(activationSpec);
    }

    //DynamicGBean implementation

    /**
     * Delegating DynamicGBean getAttribute method.
     *
     * @param name of attribute.
     * @return attribute value.
     * @throws Exception
     */
    public Object getAttribute(final String name) throws Exception {
        return delegate.getAttribute(name);
    }

    /**
     * Delegating DynamicGBean setAttribute method.
     *
     * @param name  of attribute.
     * @param value of attribute to be set.
     * @throws Exception
     */
    public void setAttribute(final String name, final Object value) throws Exception {
        delegate.setAttribute(name, value);
    }

    /**
     * no-op DynamicGBean method
     *
     * @param name
     * @param arguments
     * @param types
     * @return nothing, there are no operations.
     * @throws Exception
     */
    public Object invoke(final String name, final Object[] arguments, final String[] types) throws Exception {
        //we have no dynamic operations.
        return null;
    }

    public static final GBeanInfo GBEAN_INFO;

    static {
        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(ActivationSpecWrapperGBean.class, NameFactory.JCA_ACTIVATION_SPEC);
        infoBuilder.addAttribute("activationSpecClass", String.class, true);
        infoBuilder.addAttribute("containerId", String.class, true);
        infoBuilder.addAttribute("classLoader", ClassLoader.class, false);

        infoBuilder.addReference("ResourceAdapterWrapper", ResourceAdapterWrapper.class, NameFactory.RESOURCE_ADAPTER);

        infoBuilder.setConstructor(new String[]{
            "activationSpecClass",
            "containerId",
            "ResourceAdapterWrapper",
            "classLoader"});

        GBEAN_INFO = infoBuilder.getBeanInfo();
    }

    public static GBeanInfo getGBeanInfo() {
        return GBEAN_INFO;
    }

}
TOP

Related Classes of org.apache.geronimo.connector.ActivationSpecWrapperGBean

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.