You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2007/01/12 08:09:14 UTC
svn commit: r495500 - in
/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic:
Assembler.java AssemblerTool.java
Author: dblevins
Date: Thu Jan 11 23:09:12 2007
New Revision: 495500
URL: http://svn.apache.org/viewvc?view=rev&rev=495500
Log:
Assembler is now nicely refactored... back to the ConfigFactory
Modified:
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AssemblerTool.java
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?view=diff&rev=495500&r1=495499&r2=495500
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java Thu Jan 11 23:09:12 2007
@@ -25,6 +25,7 @@
import org.apache.openejb.core.ConnectorReference;
import org.apache.openejb.core.CoreDeploymentInfo;
import org.apache.openejb.core.TemporaryClassLoader;
+import org.apache.openejb.core.CoreContainerSystem;
import org.apache.openejb.javaagent.Agent;
import org.apache.openejb.loader.SystemInstance;
import org.apache.openejb.persistence.GlobalJndiDataSourceResolver;
@@ -43,6 +44,7 @@
import javax.naming.Context;
import javax.naming.NamingException;
+import javax.naming.InitialContext;
import javax.persistence.EntityManagerFactory;
import javax.resource.spi.ConnectionManager;
import javax.resource.spi.ManagedConnectionFactory;
@@ -68,6 +70,9 @@
private org.apache.openejb.core.CoreContainerSystem containerSystem;
private TransactionManager transactionManager;
private org.apache.openejb.spi.SecurityService securityService;
+ private final PersistenceClassLoaderHandler persistenceClassLoaderHandler;
+ private final JndiBuilder jndiBuilder;
+ private final CoreContainerSystem coreContainerSystem;
public org.apache.openejb.spi.ContainerSystem getContainerSystem() {
return containerSystem;
@@ -94,6 +99,13 @@
public Assembler() {
+ persistenceClassLoaderHandler = new PersistenceClassLoaderHandlerImpl();
+
+ installNaming();
+
+ coreContainerSystem = containerSystem = new CoreContainerSystem();
+
+ jndiBuilder = new JndiBuilder(containerSystem.getJNDIContext());
}
public void init(Properties props) throws OpenEJBException {
@@ -108,8 +120,6 @@
configFactory.init(props);
config = configFactory.getOpenEjbConfiguration();
/*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
-
- installNaming();
}
public static void installNaming() {
@@ -145,7 +155,7 @@
public void build() throws OpenEJBException {
setContext(new HashMap<String, Object>());
try {
- containerSystem = buildContainerSystem(config);
+ buildContainerSystem(config);
} catch (OpenEJBException ae) {
/* OpenEJBExceptions contain useful information and are debbugable.
* Let the exception pass through to the top and be logged.
@@ -200,7 +210,6 @@
*/
public org.apache.openejb.core.CoreContainerSystem buildContainerSystem(OpenEjbConfiguration configInfo) throws Exception {
- containerSystem = new org.apache.openejb.core.CoreContainerSystem();
ContainerSystemInfo containerSystemInfo = configInfo.containerSystem;
@@ -214,6 +223,10 @@
*/
createProxyFactory(configInfo.facilities.intraVmServer);
+ for (JndiContextInfo contextInfo : configInfo.facilities.remoteJndiContexts) {
+ createExternalContext(contextInfo);
+ }
+
createTransactionManager(configInfo.facilities.transactionService);
createSecurityService(configInfo.facilities.securityService);
@@ -226,124 +239,153 @@
createConnector(connectorInfo);
}
- PersistenceClassLoaderHandler persistenceClassLoaderHandler = new PersistenceClassLoaderHandler() {
- public void addTransformer(ClassLoader classLoader, ClassFileTransformer classFileTransformer) {
- Instrumentation instrumentation = Agent.getInstrumentation();
- if (instrumentation != null) {
- instrumentation.addTransformer(classFileTransformer);
- }
- }
-
- public ClassLoader getNewTempClassLoader(ClassLoader classLoader) {
- return new TemporaryClassLoader(classLoader);
- }
- };
-
- AssemblerTool.RoleMapping roleMapping = new AssemblerTool.RoleMapping(configInfo.facilities.securityService.roleMappings);
+// AssemblerTool.RoleMapping roleMapping = new AssemblerTool.RoleMapping(configInfo.facilities.securityService.roleMappings);
// Containers
for (ContainerInfo serviceInfo : containerSystemInfo.containers) {
createContainer(serviceInfo);
}
- JndiBuilder jndiBuilder = new JndiBuilder(containerSystem.getJNDIContext());
for (AppInfo appInfo : containerSystemInfo.applications) {
- List<URL> jars = new ArrayList<URL>();
- for (EjbJarInfo info : appInfo.ejbJars) {
- jars.add(toUrl(info.jarPath));
- }
- for (ClientInfo info : appInfo.clients) {
- jars.add(toUrl(info.codebase));
- }
- for (String jarPath : appInfo.libs) {
- jars.add(toUrl(jarPath));
- }
-
- // Generate the cmp2 concrete subclasses
- Cmp2Builder cmp2Builder = new Cmp2Builder(appInfo);
- File generatedJar = cmp2Builder.getJarFile();
- if (generatedJar != null) {
- jars.add(generatedJar.toURL());
- }
+ createApplication(appInfo, createAppClassLoader(appInfo));
+ }
- // Create the class loader
- ClassLoader classLoader = new URLClassLoader(jars.toArray(new URL[]{}), OpenEJB.class.getClassLoader());
+ return containerSystem;
+ }
- // JPA - Persistence Units MUST be processed first since they will add ClassFileTransformers
- // to the class loader which must be added before any classes are loaded
- HashMap<String, Map<String, EntityManagerFactory>> allFactories = new HashMap<String, Map<String, EntityManagerFactory>>();
- for (EjbJarInfo ejbJar : appInfo.ejbJars) {
- try {
- URL url = new File(ejbJar.jarPath).toURL();
- ResourceFinder resourceFinder = new ResourceFinder("", classLoader, url);
-
- PersistenceDeployer persistenceDeployer = new PersistenceDeployer(new GlobalJndiDataSourceResolver(null), persistenceClassLoaderHandler);
- Map<String, EntityManagerFactory> factories = persistenceDeployer.deploy(resourceFinder.findAll("META-INF/persistence.xml"), classLoader);
- allFactories.put(ejbJar.jarPath, factories);
- } catch (PersistenceDeployerException e1) {
- throw new OpenEJBException(e1);
- } catch (IOException e) {
- throw new OpenEJBException(e);
- }
+ public void createEjbJar(EjbJarInfo ejbJar) throws NamingException, IOException, OpenEJBException {
+ AppInfo appInfo = new AppInfo();
+ appInfo.ejbJars.add(ejbJar);
+ createApplication(appInfo);
+ }
+
+ public void createEjbJar(EjbJarInfo ejbJar, ClassLoader classLoader) throws NamingException, IOException, OpenEJBException {
+ AppInfo appInfo = new AppInfo();
+ appInfo.ejbJars.add(ejbJar);
+ createApplication(appInfo, classLoader);
+ }
+
+ public void createClient(ClientInfo clientInfo) throws NamingException, IOException, OpenEJBException {
+ AppInfo appInfo = new AppInfo();
+ appInfo.clients.add(clientInfo);
+ createApplication(appInfo);
+ }
+
+ public void createClient(ClientInfo clientInfo, ClassLoader classLoader) throws NamingException, IOException, OpenEJBException {
+ AppInfo appInfo = new AppInfo();
+ appInfo.clients.add(clientInfo);
+ createApplication(appInfo, classLoader);
+ }
+
+ public void createApplication(AppInfo appInfo) throws OpenEJBException, IOException, NamingException {
+ createApplication(appInfo, createAppClassLoader(appInfo));
+ }
+
+ public void createApplication(AppInfo appInfo, ClassLoader classLoader) throws OpenEJBException, IOException, NamingException {
+
+ // JPA - Persistence Units MUST be processed first since they will add ClassFileTransformers
+ // to the class loader which must be added before any classes are loaded
+ HashMap<String, Map<String, EntityManagerFactory>> allFactories = new HashMap<String, Map<String, EntityManagerFactory>>();
+ for (EjbJarInfo ejbJar : appInfo.ejbJars) {
+ try {
+ URL url = new File(ejbJar.jarPath).toURL();
+ ResourceFinder resourceFinder = new ResourceFinder("", classLoader, url);
+
+ PersistenceDeployer persistenceDeployer = new PersistenceDeployer(new GlobalJndiDataSourceResolver(null), persistenceClassLoaderHandler);
+ Map<String, EntityManagerFactory> factories = persistenceDeployer.deploy(resourceFinder.findAll("META-INF/persistence.xml"), classLoader);
+ allFactories.put(ejbJar.jarPath, factories);
+ } catch (PersistenceDeployerException e1) {
+ throw new OpenEJBException(e1);
+ } catch (IOException e) {
+ throw new OpenEJBException(e);
}
+ }
- // EJB
- EjbJarBuilder ejbJarBuilder = new EjbJarBuilder(props, classLoader);
- for (EjbJarInfo ejbJar : appInfo.ejbJars) {
- HashMap<String, DeploymentInfo> deployments = ejbJarBuilder.build(ejbJar, allFactories);
-
- for (DeploymentInfo deploymentInfo : deployments.values()) {
- applyMethodPermissions((org.apache.openejb.core.CoreDeploymentInfo) deploymentInfo, ejbJar.methodPermissions, roleMapping);
- applyTransactionAttributes((org.apache.openejb.core.CoreDeploymentInfo) deploymentInfo, ejbJar.methodTransactions);
- containerSystem.addDeployment(deploymentInfo);
- jndiBuilder.bind(deploymentInfo);
- }
+ // EJB
+ EjbJarBuilder ejbJarBuilder = new EjbJarBuilder(props, classLoader);
+ for (EjbJarInfo ejbJar : appInfo.ejbJars) {
+ HashMap<String, DeploymentInfo> deployments = ejbJarBuilder.build(ejbJar, allFactories);
+ RoleMapping roleMapping = new RoleMapping(new ArrayList());
+ for (DeploymentInfo deploymentInfo : deployments.values()) {
+ applyMethodPermissions((CoreDeploymentInfo) deploymentInfo, ejbJar.methodPermissions, roleMapping);
+ applyTransactionAttributes((CoreDeploymentInfo) deploymentInfo, ejbJar.methodTransactions);
+ containerSystem.addDeployment(deploymentInfo);
+ jndiBuilder.bind(deploymentInfo);
+ }
- for (EnterpriseBeanInfo beanInfo : ejbJar.enterpriseBeans) {
- CoreDeploymentInfo deployment = (CoreDeploymentInfo) deployments.get(beanInfo.ejbDeploymentId);
- applySecurityRoleReference(deployment, beanInfo, roleMapping);
- }
+ for (EnterpriseBeanInfo beanInfo : ejbJar.enterpriseBeans) {
+ CoreDeploymentInfo deployment = (CoreDeploymentInfo) deployments.get(beanInfo.ejbDeploymentId);
+ applySecurityRoleReference(deployment, beanInfo, roleMapping);
}
+ }
- // App Client
- for (ClientInfo clientInfo : appInfo.clients) {
- JndiEncBuilder jndiEncBuilder = new JndiEncBuilder(clientInfo.jndiEnc);
- Context context = (Context) jndiEncBuilder.build().lookup("env");
- containerSystem.getJNDIContext().bind("java:openejb/client/" + clientInfo.moduleId + "/comp/env", context);
- if (clientInfo.codebase != null) {
- containerSystem.getJNDIContext().bind("java:openejb/client/" + clientInfo.moduleId + "/comp/path", clientInfo.codebase);
- }
- if (clientInfo.mainClass != null) {
- containerSystem.getJNDIContext().bind("java:openejb/client/" + clientInfo.moduleId + "/comp/mainClass", clientInfo.mainClass);
- }
- ArrayList<Injection> injections = new ArrayList<Injection>();
- JndiEncInfo jndiEnc = clientInfo.jndiEnc;
- for (EjbReferenceInfo info : jndiEnc.ejbReferences) {
- for (InjectionInfo target : info.targets) {
- try {
- Class targetClass = classLoader.loadClass(target.className);
- Injection injection = new Injection(info.referenceName, target.propertyName, targetClass);
- injections.add(injection);
- } catch (ClassNotFoundException e) {
- logger.error("Injection Target invalid: class=" + target.className + ", name=" + target.propertyName + ". Exception: " + e.getMessage(), e);
- }
+ // App Client
+ for (ClientInfo clientInfo : appInfo.clients) {
+ JndiEncBuilder jndiEncBuilder = new JndiEncBuilder(clientInfo.jndiEnc);
+ Context context = (Context) jndiEncBuilder.build().lookup("env");
+ containerSystem.getJNDIContext().bind("java:openejb/client/" + clientInfo.moduleId + "/comp/env", context);
+ if (clientInfo.codebase != null) {
+ containerSystem.getJNDIContext().bind("java:openejb/client/" + clientInfo.moduleId + "/comp/path", clientInfo.codebase);
+ }
+ if (clientInfo.mainClass != null) {
+ containerSystem.getJNDIContext().bind("java:openejb/client/" + clientInfo.moduleId + "/comp/mainClass", clientInfo.mainClass);
+ }
+ ArrayList<Injection> injections = new ArrayList<Injection>();
+ JndiEncInfo jndiEnc = clientInfo.jndiEnc;
+ for (EjbReferenceInfo info : jndiEnc.ejbReferences) {
+ for (InjectionInfo target : info.targets) {
+ try {
+ Class targetClass = classLoader.loadClass(target.className);
+ Injection injection = new Injection(info.referenceName, target.propertyName, targetClass);
+ injections.add(injection);
+ } catch (ClassNotFoundException e) {
+ logger.error("Injection Target invalid: class=" + target.className + ", name=" + target.propertyName + ". Exception: " + e.getMessage(), e);
}
}
- containerSystem.getJNDIContext().bind("java:openejb/client/" + clientInfo.moduleId + "/comp/injections", injections);
}
+ containerSystem.getJNDIContext().bind("java:openejb/client/" + clientInfo.moduleId + "/comp/injections", injections);
}
+ }
- /*[4]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
- for (JndiContextInfo contextInfo : configInfo.facilities.remoteJndiContexts) {
- javax.naming.InitialContext cntx = assembleRemoteJndiContext(contextInfo);
- containerSystem.getJNDIContext().bind("java:openejb/remote_jndi_contexts/" + contextInfo.id, cntx);
+ public ClassLoader createAppClassLoader(AppInfo appInfo) throws OpenEJBException, IOException {
+ List<URL> jars = new ArrayList<URL>();
+ for (EjbJarInfo info : appInfo.ejbJars) {
+ jars.add(toUrl(info.jarPath));
+ }
+ for (ClientInfo info : appInfo.clients) {
+ jars.add(toUrl(info.codebase));
+ }
+ for (String jarPath : appInfo.libs) {
+ jars.add(toUrl(jarPath));
}
- return containerSystem;
+ // Generate the cmp2 concrete subclasses
+ Cmp2Builder cmp2Builder = new Cmp2Builder(appInfo);
+ File generatedJar = cmp2Builder.getJarFile();
+ if (generatedJar != null) {
+ jars.add(generatedJar.toURL());
+ }
+
+ // Create the class loader
+ ClassLoader classLoader = new URLClassLoader(jars.toArray(new URL[]{}), OpenEJB.class.getClassLoader());
+ return classLoader;
+ }
+
+ public void createExternalContext(JndiContextInfo contextInfo) throws OpenEJBException, NamingException {
+ InitialContext result;
+ try {
+ InitialContext ic = new InitialContext(contextInfo.properties);
+ result = ic;
+ } catch (NamingException ne) {
+
+ throw new OpenEJBException("The remote JNDI EJB references for remote-jndi-contexts = " + contextInfo.id + "+ could not be resolved.", ne);
+ }
+ InitialContext cntx = result;
+ containerSystem.getJNDIContext().bind("java:openejb/remote_jndi_contexts/" + contextInfo.id, cntx);
}
- private void createContainer(ContainerInfo serviceInfo) throws OpenEJBException, NamingException {
+ public void createContainer(ContainerInfo serviceInfo) throws OpenEJBException, NamingException {
ObjectRecipe serviceRecipe = new ObjectRecipe(serviceInfo.className, serviceInfo.constructorArgs.toArray(new String[0]), null);
serviceRecipe.setAllProperties(serviceInfo.properties);
@@ -368,7 +410,7 @@
containerSystem.addContainer(serviceInfo.id, (Container) service);
}
- private void createProxyFactory(IntraVmServerInfo serviceInfo) throws OpenEJBException, NamingException {
+ public void createProxyFactory(IntraVmServerInfo serviceInfo) throws OpenEJBException, NamingException {
ObjectRecipe serviceRecipe = new ObjectRecipe(serviceInfo.className, serviceInfo.constructorArgs.toArray(new String[0]), null);
serviceRecipe.setAllProperties(serviceInfo.properties);
@@ -392,7 +434,7 @@
props.put(serviceInfo.id, service);
}
- private void createConnector(ConnectorInfo conInfo) throws OpenEJBException, NamingException {
+ public void createConnector(ConnectorInfo conInfo) throws OpenEJBException, NamingException {
ManagedConnectionFactoryInfo serviceInfo = conInfo.managedConnectionFactory;
ObjectRecipe serviceRecipe = new ObjectRecipe(serviceInfo.className, serviceInfo.constructorArgs.toArray(new String[0]), null);
@@ -415,7 +457,7 @@
containerSystem.getJNDIContext().bind("java:openejb/" + serviceInfo.serviceType + "/" + conInfo.connectorId, reference);
}
- private ConnectionManager createConnectionManager(ConnectionManagerInfo serviceInfo) throws OpenEJBException, java.lang.reflect.InvocationTargetException, IllegalAccessException, NoSuchMethodException, NamingException {
+ public void createConnectionManager(ConnectionManagerInfo serviceInfo) throws OpenEJBException, java.lang.reflect.InvocationTargetException, IllegalAccessException, NoSuchMethodException, NamingException {
ObjectRecipe serviceRecipe = new ObjectRecipe(serviceInfo.className, serviceInfo.constructorArgs.toArray(new String[0]), null);
serviceRecipe.setAllProperties(serviceInfo.properties);
@@ -437,10 +479,9 @@
props.put(serviceInfo.serviceType, service);
props.put(serviceInfo.id, service);
- return (ConnectionManager) service;
}
- private void createSecurityService(ServiceInfo serviceInfo) throws Exception {
+ public void createSecurityService(ServiceInfo serviceInfo) throws Exception {
ObjectRecipe serviceRecipe = new ObjectRecipe(serviceInfo.className, serviceInfo.constructorArgs.toArray(new String[0]), null);
serviceRecipe.setAllProperties(serviceInfo.properties);
@@ -463,7 +504,7 @@
this.securityService = (SecurityService) service;
}
- private void createTransactionManager(TransactionServiceInfo serviceInfo) throws NamingException, OpenEJBException {
+ public void createTransactionManager(TransactionServiceInfo serviceInfo) throws NamingException, OpenEJBException {
ObjectRecipe serviceRecipe = new ObjectRecipe(serviceInfo.className, serviceInfo.constructorArgs.toArray(new String[0]), null);
serviceRecipe.setAllProperties(serviceInfo.properties);
@@ -494,4 +535,16 @@
}
+ private static class PersistenceClassLoaderHandlerImpl implements PersistenceClassLoaderHandler {
+ public void addTransformer(ClassLoader classLoader, ClassFileTransformer classFileTransformer) {
+ Instrumentation instrumentation = Agent.getInstrumentation();
+ if (instrumentation != null) {
+ instrumentation.addTransformer(classFileTransformer);
+ }
+ }
+
+ public ClassLoader getNewTempClassLoader(ClassLoader classLoader) {
+ return new TemporaryClassLoader(classLoader);
+ }
+ }
}
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AssemblerTool.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AssemblerTool.java?view=diff&rev=495500&r1=495499&r2=495500
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AssemblerTool.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/AssemblerTool.java Thu Jan 11 23:09:12 2007
@@ -21,11 +21,7 @@
import org.apache.openejb.util.Messages;
import org.apache.openejb.util.SafeToolkit;
import org.apache.openejb.util.proxy.ProxyFactory;
-import org.apache.openejb.util.proxy.ProxyManager;
-import javax.naming.InitialContext;
-import javax.resource.spi.ConnectionManager;
-import javax.resource.spi.ManagedConnectionFactory;
import javax.transaction.TransactionManager;
import java.lang.reflect.Method;
import java.util.HashMap;
@@ -38,56 +34,25 @@
public class AssemblerTool {
- public static final Class PROXY_FACTORY = org.apache.openejb.util.proxy.ProxyFactory.class;
- public static final Class SECURITY_SERVICE = org.apache.openejb.spi.SecurityService.class;
- public static final Class TRANSACTION_MANAGER = TransactionManager.class;
- public static final Class CONNECTION_MANAGER = javax.resource.spi.ConnectionManager.class;
- public static final Class CONNECTOR = javax.resource.spi.ManagedConnectionFactory.class;
- public static final Class CONTAINER = org.apache.openejb.Container.class;
-
public static final Map<String, Class> serviceInterfaces = new HashMap<String, Class>();
static {
- serviceInterfaces.put("ProxyFactory", PROXY_FACTORY);
- serviceInterfaces.put("SecurityService", SECURITY_SERVICE);
- serviceInterfaces.put("TransactionManager", TRANSACTION_MANAGER);
- serviceInterfaces.put("ConnectionManager", CONNECTION_MANAGER);
- serviceInterfaces.put("Connector", CONNECTOR);
- serviceInterfaces.put("Container", CONTAINER);
+ serviceInterfaces.put("ProxyFactory", ProxyFactory.class);
+ serviceInterfaces.put("SecurityService", org.apache.openejb.spi.SecurityService.class);
+ serviceInterfaces.put("TransactionManager", TransactionManager.class);
+ serviceInterfaces.put("ConnectionManager", javax.resource.spi.ConnectionManager.class);
+ serviceInterfaces.put("Connector", javax.resource.spi.ManagedConnectionFactory.class);
+ serviceInterfaces.put("Container", org.apache.openejb.Container.class);
}
protected static final Messages messages = new Messages("org.apache.openejb.util.resources");
protected static final SafeToolkit toolkit = SafeToolkit.getToolkit("AssemblerTool");
protected Properties props;
- protected Properties services;
static {
System.setProperty("noBanner", "true");
}
- /*
- TODO: The Exception Handling here isn't up-to-date and doesn't
- use a message number. Message numbers allow the message text to
- be internationalized.
- */
- public InitialContext assembleRemoteJndiContext(JndiContextInfo context)
- throws org.apache.openejb.OpenEJBException {
- try {
- InitialContext ic = new InitialContext(context.properties);
- return ic;
- } catch (javax.naming.NamingException ne) {
-
- throw new org.apache.openejb.OpenEJBException("The remote JNDI EJB references for remote-jndi-contexts = " + context.id + "+ could not be resolved.", ne);
- }
- }
-
- public void applyProperties(Object target, Properties props) throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException, java.lang.NoSuchMethodException {
- if (props != null /*&& props.size()>0*/) {
- Method method = target.getClass().getMethod("init", Properties.class);
- method.invoke(target, props);
- }
- }
-
public static void applyTransactionAttributes(CoreDeploymentInfo deploymentInfo, List<MethodTransactionInfo> mtis) throws OpenEJBException {
/*TODO: Add better exception handling. This method doesn't throws any exceptions!!
there is a lot of complex code here, I'm sure something could go wrong the user
@@ -298,7 +263,7 @@
protected static void checkImplementation(Class intrfce, Class factory, String serviceType, String serviceName) throws OpenEJBException {
if (!intrfce.isAssignableFrom(factory)) {
- handleException("init.0100", serviceType, serviceName, factory.getName(), intrfce.getName());
+ throw new OpenEJBException(messages.format("init.0100", serviceType, serviceName, factory.getName(), intrfce.getName()));
}
}
@@ -326,16 +291,5 @@
} else
return cl.loadClass(className);
- }
-
- /*------------------------------------------------------*/
- /* Methods for easy exception handling */
- /*------------------------------------------------------*/
- public static void handleException(String errorCode, Object... args) throws OpenEJBException {
- throw new OpenEJBException(messages.format(errorCode, args));
- }
-
- public static void handleException(String errorCode) throws OpenEJBException {
- throw new OpenEJBException(messages.format(errorCode));
}
}