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     */
017    package org.apache.geronimo.openejb;
018    
019    import java.util.Collection;
020    
021    import org.apache.geronimo.gbean.GBeanInfo;
022    import org.apache.geronimo.gbean.GBeanInfoBuilder;
023    import org.apache.geronimo.gbean.GBeanLifecycle;
024    import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
025    import org.apache.geronimo.management.J2EEServer;
026    import org.apache.geronimo.management.J2EEApplication;
027    import org.apache.geronimo.management.EJB;
028    import org.apache.openejb.assembler.classic.EjbJarInfo;
029    
030    /**
031     * @version $Revision$ $Date$
032     */
033    public final class EjbModuleImplGBean extends EjbModuleImpl implements GBeanLifecycle {
034        public EjbModuleImplGBean(String objectName, J2EEServer server, J2EEApplication application, String deploymentDescriptor, Collection<? extends EJB> ejbs, ClassLoader classLoader, OpenEjbSystem openEjbSystem, EjbJarInfo ejbJarInfo) {
035            super(objectName, server, application, deploymentDescriptor, ejbs, classLoader, openEjbSystem, ejbJarInfo);
036        }
037    
038        public void doStart() throws Exception {
039            start();
040        }
041    
042        public void doStop() throws Exception {
043            stop();
044        }
045    
046        public void doFail() {
047            stop();
048        }
049    
050        public static final GBeanInfo GBEAN_INFO;
051    
052        static {
053            GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(EjbModuleImplGBean.class, NameFactory.EJB_MODULE);
054            infoBuilder.addReference("J2EEServer", J2EEServer.class);
055            infoBuilder.addReference("J2EEApplication", J2EEApplication.class);
056    
057            infoBuilder.addAttribute("deploymentDescriptor", String.class, true);
058    
059            infoBuilder.addReference("EJBCollection", EJB.class);
060    
061            infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
062    
063            infoBuilder.addReference("OpenEjbSystem", OpenEjbSystem.class);
064            infoBuilder.addAttribute("ejbJarInfo", EjbJarInfo.class, true);
065    
066            infoBuilder.setConstructor(new String[]{
067                    "objectName",
068                    "J2EEServer",
069                    "J2EEApplication",
070                    "deploymentDescriptor",
071                    "EJBCollection",
072                    "classLoader",
073                    "OpenEjbSystem",
074                    "ejbJarInfo"
075            });
076    
077            GBEAN_INFO = infoBuilder.getBeanInfo();
078        }
079    
080        public static GBeanInfo getGBeanInfo() {
081            return GBEAN_INFO;
082        }
083    }