001 /** 002 * 003 * Licensed to the Apache Software Foundation (ASF) under one or more 004 * contributor license agreements. See the NOTICE file distributed with 005 * this work for additional information regarding copyright ownership. 006 * The ASF licenses this file to You under the Apache License, Version 2.0 007 * (the "License"); you may not use this file except in compliance with 008 * the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 package org.apache.geronimo.openejb; 019 020 import java.util.Map; 021 import java.util.Set; 022 023 import org.apache.geronimo.gbean.GBeanInfo; 024 import org.apache.geronimo.gbean.GBeanInfoBuilder; 025 import org.apache.geronimo.gbean.GBeanLifecycle; 026 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; 027 import org.apache.geronimo.naming.enc.EnterpriseNamingContext; 028 import org.apache.geronimo.security.jacc.RunAsSource; 029 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager; 030 import org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator; 031 import org.apache.geronimo.kernel.Kernel; 032 033 public class EjbDeploymentGBean extends EjbDeployment implements GBeanLifecycle { 034 public EjbDeploymentGBean(String objectName, 035 String deploymentId, 036 String ejbName, 037 String homeInterfaceName, 038 String remoteInterfaceName, 039 String localHomeInterfaceName, 040 String localInterfaceName, 041 String serviceEndpointInterfaceName, 042 String beanClassName, 043 ClassLoader classLoader, 044 boolean securityEnabled, 045 String defaultRole, 046 String runAsRole, 047 RunAsSource runAsSource, 048 Map componentContext, 049 Set unshareableResources, 050 Set applicationManagedSecurityResources, 051 TrackedConnectionAssociator trackedConnectionAssociator, 052 GeronimoTransactionManager transactionManager, 053 OpenEjbSystem openEjbSystem, 054 Kernel kernel) throws Exception { 055 super(objectName, 056 deploymentId, 057 ejbName, 058 homeInterfaceName, 059 remoteInterfaceName, 060 localHomeInterfaceName, 061 localInterfaceName, 062 serviceEndpointInterfaceName, 063 beanClassName, 064 classLoader, 065 securityEnabled, 066 defaultRole, 067 runAsRole, 068 runAsSource, 069 EnterpriseNamingContext.createEnterpriseNamingContext(componentContext, transactionManager, kernel, classLoader), 070 unshareableResources, 071 applicationManagedSecurityResources, 072 trackedConnectionAssociator, 073 openEjbSystem); 074 } 075 076 public void doStart() throws Exception { 077 start(); 078 } 079 080 public void doStop() throws Exception { 081 stop(); 082 } 083 084 public void doFail() { 085 stop(); 086 } 087 088 // do not use this gbean info, instead use StatelessDeploymentGBean, StatefulDeploymentGBean, EntityDeploymentGBean, or MessageDrivenDeploymentGBean 089 static final GBeanInfo GBEAN_INFO; 090 091 static { 092 GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(EjbDeploymentGBean.class, EjbDeploymentGBean.class, NameFactory.STATELESS_SESSION_BEAN); 093 094 infoFactory.addAttribute("objectName", String.class, false); 095 infoFactory.addAttribute("deploymentId", String.class, true); 096 infoFactory.addAttribute("ejbName", String.class, true); 097 098 infoFactory.addAttribute("homeInterfaceName", String.class, true); 099 infoFactory.addAttribute("remoteInterfaceName", String.class, true); 100 infoFactory.addAttribute("localHomeInterfaceName", String.class, true); 101 infoFactory.addAttribute("localInterfaceName", String.class, true); 102 infoFactory.addAttribute("serviceEndpointInterfaceName", String.class, true); 103 infoFactory.addAttribute("beanClassName", String.class, true); 104 infoFactory.addAttribute("classLoader", ClassLoader.class, false); 105 106 infoFactory.addAttribute("securityEnabled", boolean.class, true); 107 infoFactory.addAttribute("defaultRole", String.class, true); 108 infoFactory.addAttribute("runAsRole", String.class, true); 109 infoFactory.addReference("RunAsSource", RunAsSource.class, NameFactory.JACC_MANAGER); 110 111 infoFactory.addAttribute("componentContextMap", Map.class, true); 112 113 infoFactory.addAttribute("unshareableResources", Set.class, true); 114 infoFactory.addAttribute("applicationManagedSecurityResources", Set.class, true); 115 infoFactory.addReference("TrackedConnectionAssociator", TrackedConnectionAssociator.class); 116 infoFactory.addReference("TransactionManager", GeronimoTransactionManager.class); 117 118 infoFactory.addReference("OpenEjbSystem", OpenEjbSystem.class); 119 120 infoFactory.addAttribute("kernel", Kernel.class, false); 121 122 infoFactory.setConstructor(new String[]{ 123 "objectName", 124 "deploymentId", 125 "ejbName", 126 127 "homeInterfaceName", 128 "remoteInterfaceName", 129 "localHomeInterfaceName", 130 "localInterfaceName", 131 "serviceEndpointInterfaceName", 132 "beanClassName", 133 "classLoader", 134 135 "securityEnabled", 136 "defaultRole", 137 "runAsRole", 138 "RunAsSource", 139 140 "componentContextMap", 141 142 "unshareableResources", 143 "applicationManagedSecurityResources", 144 "TrackedConnectionAssociator", 145 "TransactionManager", 146 147 "OpenEjbSystem", 148 149 "kernel", 150 }); 151 152 GBEAN_INFO = infoFactory.getBeanInfo(); 153 } 154 }