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: */package org.apache.geronimo.openejb;
018:
019: import java.util.Map;
020: import java.util.Set;
021:
022: import org.apache.geronimo.gbean.GBeanInfo;
023: import org.apache.geronimo.gbean.GBeanInfoBuilder;
024: import org.apache.geronimo.gbean.GBeanLifecycle;
025: import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
026: import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
027: import org.apache.geronimo.security.jacc.RunAsSource;
028: import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
029: import org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator;
030: import org.apache.geronimo.kernel.Kernel;
031:
032: public class EjbDeploymentGBean extends EjbDeployment implements
033: GBeanLifecycle {
034: public EjbDeploymentGBean(String objectName, String deploymentId,
035: String ejbName, String homeInterfaceName,
036: String remoteInterfaceName, String localHomeInterfaceName,
037: String localInterfaceName,
038: String serviceEndpointInterfaceName, String beanClassName,
039: ClassLoader classLoader, boolean securityEnabled,
040: String defaultRole, String runAsRole,
041: RunAsSource runAsSource, Map componentContext,
042: Set unshareableResources,
043: Set applicationManagedSecurityResources,
044: TrackedConnectionAssociator trackedConnectionAssociator,
045: GeronimoTransactionManager transactionManager,
046: OpenEjbSystem openEjbSystem, Kernel kernel)
047: throws Exception {
048: super (objectName, deploymentId, ejbName, homeInterfaceName,
049: remoteInterfaceName, localHomeInterfaceName,
050: localInterfaceName, serviceEndpointInterfaceName,
051: beanClassName, classLoader, securityEnabled,
052: defaultRole, runAsRole, runAsSource,
053: EnterpriseNamingContext.createEnterpriseNamingContext(
054: componentContext, transactionManager, kernel,
055: classLoader), unshareableResources,
056: applicationManagedSecurityResources,
057: trackedConnectionAssociator, openEjbSystem);
058: }
059:
060: public void doStart() throws Exception {
061: start();
062: }
063:
064: public void doStop() throws Exception {
065: stop();
066: }
067:
068: public void doFail() {
069: stop();
070: }
071:
072: // do not use this gbean info, instead use StatelessDeploymentGBean, StatefulDeploymentGBean, EntityDeploymentGBean, or MessageDrivenDeploymentGBean
073: public static final GBeanInfo GBEAN_INFO;
074:
075: static {
076: GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(
077: EjbDeploymentGBean.class, EjbDeploymentGBean.class,
078: NameFactory.STATELESS_SESSION_BEAN);
079:
080: infoFactory.addAttribute("objectName", String.class, false);
081: infoFactory.addAttribute("deploymentId", String.class, true);
082: infoFactory.addAttribute("ejbName", String.class, true);
083:
084: infoFactory.addAttribute("homeInterfaceName", String.class,
085: true);
086: infoFactory.addAttribute("remoteInterfaceName", String.class,
087: true);
088: infoFactory.addAttribute("localHomeInterfaceName",
089: String.class, true);
090: infoFactory.addAttribute("localInterfaceName", String.class,
091: true);
092: infoFactory.addAttribute("serviceEndpointInterfaceName",
093: String.class, true);
094: infoFactory.addAttribute("beanClassName", String.class, true);
095: infoFactory.addAttribute("classLoader", ClassLoader.class,
096: false);
097:
098: infoFactory
099: .addAttribute("securityEnabled", boolean.class, true);
100: infoFactory.addAttribute("defaultRole", String.class, true);
101: infoFactory.addAttribute("runAsRole", String.class, true);
102: infoFactory.addReference("RunAsSource", RunAsSource.class,
103: NameFactory.JACC_MANAGER);
104:
105: infoFactory
106: .addAttribute("componentContextMap", Map.class, true);
107:
108: infoFactory.addAttribute("unshareableResources", Set.class,
109: true);
110: infoFactory.addAttribute("applicationManagedSecurityResources",
111: Set.class, true);
112: infoFactory.addReference("TrackedConnectionAssociator",
113: TrackedConnectionAssociator.class);
114: infoFactory.addReference("TransactionManager",
115: GeronimoTransactionManager.class);
116:
117: infoFactory.addReference("OpenEjbSystem", OpenEjbSystem.class);
118:
119: infoFactory.addAttribute("kernel", Kernel.class, false);
120:
121: infoFactory.setConstructor(new String[] { "objectName",
122: "deploymentId", "ejbName",
123:
124: "homeInterfaceName", "remoteInterfaceName",
125: "localHomeInterfaceName", "localInterfaceName",
126: "serviceEndpointInterfaceName", "beanClassName",
127: "classLoader",
128:
129: "securityEnabled", "defaultRole", "runAsRole",
130: "RunAsSource",
131:
132: "componentContextMap",
133:
134: "unshareableResources",
135: "applicationManagedSecurityResources",
136: "TrackedConnectionAssociator", "TransactionManager",
137:
138: "OpenEjbSystem",
139:
140: "kernel", });
141:
142: GBEAN_INFO = infoFactory.getBeanInfo();
143: }
144: }
|