User: mnf999 Date: 02/02/06 12:59:27 Modified: src/main/org/jboss/ejb Container.java Log: The invocation branching is now based on int and a case switch (SPEEEEEEEED) Revision Changes Path 1.71 +326 -312 jboss/src/main/org/jboss/ejb/Container.java Index: Container.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/Container.java,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- Container.java 2002/02/06 18:27:49 1.70 +++ Container.java 2002/02/06 20:59:27 1.71 @@ -1,9 +1,9 @@ /* - * JBoss, the OpenSource J2EE webOS - * - * Distributable under LGPL license. - * See terms of license at gnu.org. - */ +* JBoss, the OpenSource J2EE webOS +* +* Distributable under LGPL license. +* See terms of license at gnu.org. +*/ package org.jboss.ejb; @@ -78,7 +78,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> * @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>. * @author <a href="[EMAIL PROTECTED]">Bill Burke</a> -* @version $Revision: 1.70 $ +* @version $Revision: 1.71 $ * * <p><b>Revisions:</b> * @@ -109,24 +109,24 @@ protected Application application; /** - * This is the local classloader of this container. Used for loading - * resources that must come from the local jar file for the container. - * NOT for loading classes! - */ + * This is the local classloader of this container. Used for loading + * resources that must come from the local jar file for the container. + * NOT for loading classes! + */ protected ClassLoader localClassLoader; /** - * This is the classloader of this container. All classes and resources that - * the bean uses will be loaded from here. By doing this we make the bean - * re-deployable - */ + * This is the classloader of this container. All classes and resources that + * the bean uses will be loaded from here. By doing this we make the bean + * re-deployable + */ protected ClassLoader classLoader; /** - * This is the new metadata. it includes information from both ejb-jar and - * jboss.xml the metadata for the application can be accessed trough - * metaData.getApplicationMetaData() - */ + * This is the new metadata. it includes information from both ejb-jar and + * jboss.xml the metadata for the application can be accessed trough + * metaData.getApplicationMetaData() + */ protected BeanMetaData metaData; /** This is the EnterpriseBean class */ @@ -161,7 +161,7 @@ /** ??? */ protected LocalContainerInvoker localContainerInvoker = - new BaseLocalContainerInvoker(); + new BaseLocalContainerInvoker(); /** This is a cache for method permissions */ private HashMap methodPermissionsCache = new HashMap(); @@ -172,11 +172,11 @@ /** ObjectName of the JSR-77 EJB representation **/ protected String mEJBObjectName; - + /** - * The name of the Remote invoker dedicated to this container, - * the type is set through deployment - */ + * The name of the Remote invoker dedicated to this container, + * the type is set through deployment + */ // marcf FIXME: FOR NOW ONLY JRMP (Debugging) but in the future make // configurable from xml // FIXME @@ -199,22 +199,22 @@ } /** - * Sets a transaction manager for this container. - * - * @see javax.transaction.TransactionManager - * - * @param tm - */ + * Sets a transaction manager for this container. + * + * @see javax.transaction.TransactionManager + * + * @param tm + */ public void setTransactionManager(TransactionManager tm) { this.tm = tm; } /** - * Returns this container's transaction manager. - * - * @return A concrete instance of javax.transaction.TransactionManager - */ + * Returns this container's transaction manager. + * + * @return A concrete instance of javax.transaction.TransactionManager + */ public TransactionManager getTransactionManager() { return tm; @@ -270,11 +270,11 @@ } /** - * Sets the application deployment unit for this container. All the bean - * containers within the same application unit share the same instance. - * - * @param app application for this container - */ + * Sets the application deployment unit for this container. All the bean + * containers within the same application unit share the same instance. + * + * @param app application for this container + */ public void setApplication(Application app) { if (app == null) @@ -284,84 +284,84 @@ } /** - * Returns the application for this container. - * - * @return - */ + * Returns the application for this container. + * + * @return + */ public Application getApplication() { return application; } /** - * Sets the local class loader for this container. - * Used for loading resources from the local jar file for this container. - * NOT for loading classes! - * - * @param cl - */ + * Sets the local class loader for this container. + * Used for loading resources from the local jar file for this container. + * NOT for loading classes! + * + * @param cl + */ public void setLocalClassLoader(ClassLoader cl) { this.localClassLoader = cl; } /** - * Returns the local classloader for this container. - * - * @return - */ + * Returns the local classloader for this container. + * + * @return + */ public ClassLoader getLocalClassLoader() { return localClassLoader; } /** - * Sets the class loader for this container. All the classes and resources - * used by the bean in this container will use this classloader. - * - * @param cl - */ + * Sets the class loader for this container. All the classes and resources + * used by the bean in this container will use this classloader. + * + * @param cl + */ public void setClassLoader(ClassLoader cl) { this.classLoader = cl; } /** - * Returns the classloader for this container. - * - * @return - */ + * Returns the classloader for this container. + * + * @return + */ public ClassLoader getClassLoader() { return classLoader; } /** - * Sets the meta data for this container. The meta data consists of the - * properties found in the XML descriptors. - * - * @param metaData - */ + * Sets the meta data for this container. The meta data consists of the + * properties found in the XML descriptors. + * + * @param metaData + */ public void setBeanMetaData(BeanMetaData metaData) { this.metaData = metaData; } /** - * Returns the metadata of this container. - * - * @return metaData; - */ + * Returns the metadata of this container. + * + * @return metaData; + */ public BeanMetaData getBeanMetaData() { return metaData; } /** - * Returns the permissions for a method. (a set of roles) - * - * @return assemblyDescriptor; - */ + * Returns the permissions for a method. (a set of roles) + * + * @return assemblyDescriptor; + */ public Set getMethodPermissions( Method m, boolean home ) { Set permissions; @@ -377,26 +377,26 @@ } /** - * Returns the bean class instance of this container. - * - * @return instance of the Enterprise bean class. - */ + * Returns the bean class instance of this container. + * + * @return instance of the Enterprise bean class. + */ public Class getBeanClass() { return beanClass; } /** - * Returns a new instance of the bean class or a subclass of the bean class. - * This factory style method is speciffically used by a container to supply - * an implementation of the abstract accessors in EJB2.0, but could be - * usefull in other situations. This method should ALWAYS be used instead - * of getBeanClass().newInstance(); - * - * @return the new instance - * - * @see java.lang.Class#newInstance - */ + * Returns a new instance of the bean class or a subclass of the bean class. + * This factory style method is speciffically used by a container to supply + * an implementation of the abstract accessors in EJB2.0, but could be + * usefull in other situations. This method should ALWAYS be used instead + * of getBeanClass().newInstance(); + * + * @return the new instance + * + * @see java.lang.Class#newInstance + */ public Object createBeanClassInstance() throws Exception { return getBeanClass().newInstance(); } @@ -422,7 +422,7 @@ localHomeInterface = classLoader.loadClass(metaData.getLocalHome()); if (metaData.getLocal() != null) localInterface = classLoader.loadClass(metaData.getLocal()); - + localContainerInvoker.setContainer( this ); localContainerInvoker.create(); if (localHomeInterface != null) @@ -432,17 +432,17 @@ } /** - * A default implementation of starting the container service. - * The container registers it's dynamic MBean interface in the JMX base. - * FIXME marcf: give some more thought as to where to start and stop MBean registration. - * stop could be a flag in the JMX server that essentially doesn't proxy invocations but the - * MBean would still be registered in the MBeanServer under the right name until undeploy - * - * The concrete container classes should override this method to introduce - * implementation specific start behaviour. - * - * @throws Exception An exception that occured during start - */ + * A default implementation of starting the container service. + * The container registers it's dynamic MBean interface in the JMX base. + * FIXME marcf: give some more thought as to where to start and stop MBean registration. + * stop could be a flag in the JMX server that essentially doesn't proxy invocations but the + * MBean would still be registered in the MBeanServer under the right name until undeploy + * + * The concrete container classes should override this method to introduce + * implementation specific start behaviour. + * + * @throws Exception An exception that occured during start + */ public void start() throws Exception { localContainerInvoker.start(); @@ -452,10 +452,10 @@ } /** - * A default implementation of stopping the container service (no-op). The - * concrete container classes should override this method to introduce - * implementation specific stop behaviour. - */ + * A default implementation of stopping the container service (no-op). The + * concrete container classes should override this method to introduce + * implementation specific stop behaviour. + */ public void stop() { localContainerInvoker.stop(); @@ -471,10 +471,10 @@ } /** - * A default implementation of destroying the container service (no-op). - * The concrete container classes should override this method to introduce - * implementation specific destroy behaviour. - */ + * A default implementation of destroying the container service (no-op). + * The concrete container classes should override this method to introduce + * implementation specific destroy behaviour. + */ public void destroy() { localContainerInvoker.destroy(); @@ -482,31 +482,31 @@ } /** - * This method is called by the ContainerInvoker when a method call comes - * in on the Home object. The Container forwards this call to the - * interceptor chain for further processing. - * - * @param mi the object holding all info about this invocation - * @return the result of the home invocation - * - * @throws Exception - */ + * This method is called by the ContainerInvoker when a method call comes + * in on the Home object. The Container forwards this call to the + * interceptor chain for further processing. + * + * @param mi the object holding all info about this invocation + * @return the result of the home invocation + * + * @throws Exception + */ public abstract Object invokeHome(Invocation mi) throws Exception; /** - * This method is called by the ContainerInvoker when a method call comes - * in on an EJBObject. The Container forwards this call to the interceptor - * chain for further processing. - * - * @param id the id of the object being invoked. May be null - * if stateless - * @param method the method being invoked - * @param args the parameters - * @return the result of the invocation - * - * @throws Exception - */ + * This method is called by the ContainerInvoker when a method call comes + * in on an EJBObject. The Container forwards this call to the interceptor + * chain for further processing. + * + * @param id the id of the object being invoked. May be null + * if stateless + * @param method the method being invoked + * @param args the parameters + * @return the result of the invocation + * + * @throws Exception + */ public abstract Object invoke(Invocation mi) throws Exception; @@ -540,158 +540,172 @@ } /** - * Handle a operation invocation. - */ + * Handle a operation invocation. + */ public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException { - + if( params != null && params.length == 1 && (params[0] instanceof Invocation) == false ) throw new MBeanException(new IllegalArgumentException("Expected zero or single Invocation argument")); - + Object value = null; Invocation mi = null; if( params != null && params.length == 1 ) mi = (Invocation) params[0]; - + ClassLoader callerClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(this.classLoader); - // Check against home, remote, localHome, local, getHome, getRemote, getLocalHome, getLocal - if( actionName.equals("remote") ) + + + switch (mi.getType()) { - - if (mi instanceof MarshalledInvocation) - - { - ((MarshalledInvocation) mi).setMethodMap(marshalledInvocationMapping); - - if (log.isDebugEnabled()) - // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - log.debug("METHOD REMOTE INVOKE "+mi.getContainer()+"||"+mi.getMethod().getName()+"||"); - } - // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - else if (!mi.getMethod().getDeclaringClass().isAssignableFrom(remoteInterface)) - { + // Check against home, remote, localHome, local, getHome, getRemote, getLocalHome, getLocal + case Invocation.REMOTE: - if (log.isDebugEnabled()) + if (mi instanceof MarshalledInvocation) + { - // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED + ((MarshalledInvocation) mi).setMethodMap(marshalledInvocationMapping); + + if (log.isDebugEnabled()) + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED log.debug("METHOD REMOTE INVOKE "+mi.getContainer()+"||"+mi.getMethod().getName()+"||"); + + } + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED + else if (!mi.getMethod().getDeclaringClass().isAssignableFrom(remoteInterface)) + { + + if (log.isDebugEnabled()) + { + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED + log.debug("METHOD REMOTE INVOKE "+mi.getContainer()+"||"+mi.getMethod().getName()+"||"); + + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED + log.debug("WARNING: YOU ARE RUNNING NON-OPTIMIZED"); + } + + // TEMP FIXME HACK This makes user transactions on the server work until + // local invocations stop going through Marshalled Invocation + Transaction hack = mi.getTransaction(); + + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED + //Serialize deserialize + mi = (Invocation) new MarshalledObject(new MarshalledInvocation(mi.payload)).get(); + + // TEMP FIXME HACK This makes user transactions on the server work until + // local invocations stop going through Marshalled Invocation + mi.setTransaction(hack); // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - log.debug("WARNING: YOU ARE RUNNING NON-OPTIMIZED"); + ((MarshalledInvocation) mi).setMethodMap(marshalledInvocationMapping); + + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED + return new MarshalledObject(invoke(mi)); } - - // TEMP FIXME HACK This makes user transactions on the server work until - // local invocations stop going through Marshalled Invocation - Transaction hack = mi.getTransaction(); - - // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - //Serialize deserialize - mi = (Invocation) new MarshalledObject(new MarshalledInvocation(mi.payload)).get(); - - // TEMP FIXME HACK This makes user transactions on the server work until - // local invocations stop going through Marshalled Invocation - mi.setTransaction(hack); - - // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - ((MarshalledInvocation) mi).setMethodMap(marshalledInvocationMapping); - + + value= invoke(mi); + + break; + + + case Invocation.LOCAL: + + throw new MBeanException(new UnsupportedOperationException("local is not supported yet")); + + case Invocation.HOME: + + if (mi instanceof MarshalledInvocation) + { + + ((MarshalledInvocation) mi).setMethodMap(marshalledInvocationMapping); + + if (log.isDebugEnabled()) + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED + log.debug("METHOD HOME INVOKE "+mi.getContainer()+"||"+mi.getMethod().getName()+"||"+mi.getArguments().toString()); + + } // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - return new MarshalledObject(invoke(mi)); - } - - value = invoke(mi); - } - - else if( actionName.equals("local") ) - { - throw new MBeanException(new UnsupportedOperationException("local is not supported yet")); - } - else if( actionName.equals("home") ) - { - - if (mi instanceof MarshalledInvocation) - { - - ((MarshalledInvocation) mi).setMethodMap(marshalledInvocationMapping); - - if (log.isDebugEnabled()) - // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - log.debug("METHOD HOME INVOKE "+mi.getContainer()+"||"+mi.getMethod().getName()+"||"+mi.getArguments().toString()); - - } - // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - else if (!mi.getMethod().getDeclaringClass().isAssignableFrom(remoteInterface)) - { - - if (log.isDebugEnabled()) + else if (!mi.getMethod().getDeclaringClass().isAssignableFrom(remoteInterface)) { + + if (log.isDebugEnabled()) + { + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED + log.debug("METHOD HOME INVOKE "+mi.getContainer()+"||"+mi.getMethod().getName()+"||"+mi.getArguments().toString()); + + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED + log.debug("WARNING: YOU ARE RUNNING NON-OPTIMIZED"); + } + + // TEMP FIXME HACK This makes user transactions on the server work until + // local invocations stop going through Marshalled Invocation + Transaction hack = mi.getTransaction(); + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - log.debug("METHOD HOME INVOKE "+mi.getContainer()+"||"+mi.getMethod().getName()+"||"+mi.getArguments().toString()); - + //Serialize deserialize + mi = (MarshalledInvocation) new MarshalledObject(new MarshalledInvocation(mi.payload)).get(); + + // TEMP FIXME HACK This makes user transactions on the server work until + // local invocations stop going through Marshalled Invocation + mi.setTransaction(hack); + + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED + ((MarshalledInvocation) mi).setMethodMap(marshalledInvocationMapping); + // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - log.debug("WARNING: YOU ARE RUNNING NON-OPTIMIZED"); + return new MarshalledObject(invokeHome(mi)); + } - - // TEMP FIXME HACK This makes user transactions on the server work until - // local invocations stop going through Marshalled Invocation - Transaction hack = mi.getTransaction(); - - // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - //Serialize deserialize - mi = (MarshalledInvocation) new MarshalledObject(new MarshalledInvocation(mi.payload)).get(); - - // TEMP FIXME HACK This makes user transactions on the server work until - // local invocations stop going through Marshalled Invocation - mi.setTransaction(hack); - - // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - ((MarshalledInvocation) mi).setMethodMap(marshalledInvocationMapping); - - // FIXME FIXME FIXME FIXME REMOVE WHEN CL ARE INTEGRATED - return new MarshalledObject(invokeHome(mi)); - - } - - value = invokeHome(mi); - } - else if( actionName.equals("localHome") ) - { - throw new MBeanException(new UnsupportedOperationException("localHome is not supported yet")); - } - else if( actionName.equals("getHome") ) - { - String className = this.getBeanMetaData().getHome(); - if( className != null ) - { - Class clazz = this.classLoader.loadClass(className); - value = clazz; - } - } - else if( actionName.equals("getRemote") ) - { - String className = this.getBeanMetaData().getRemote(); - if( className != null ) - { - Class clazz = this.classLoader.loadClass(className); - value = clazz; - } - } - else if( actionName.equals("getLocalHome") ) - { - value = this.localHomeInterface; - } - else if( actionName.equals("getLocal") ) - { - value = this.localInterface; - } - else - { - throw new MBeanException(new IllegalArgumentException("Unknown action: "+actionName)); + + value = invokeHome(mi); + + break; + + case Invocation.LOCALHOME: + + throw new MBeanException(new UnsupportedOperationException("localHome is not supported yet")); + + case Invocation.GETHOME: + + String className = this.getBeanMetaData().getHome(); + if( className != null ) + { + Class clazz = this.classLoader.loadClass(className); + value = clazz; + } + + break; + + case Invocation.GETREMOTE: + + String className2 = this.getBeanMetaData().getRemote(); + if( className2 != null ) + { + Class clazz = this.classLoader.loadClass(className2); + value = clazz; + } + + break; + + case Invocation.GETLOCALHOME: + + value = this.localHomeInterface; + + break; + + case Invocation.GETLOCAL: + + value = this.localInterface; + + break; + + ///throw new MBeanException(new IllegalArgumentException("Unknown action: ")); + } } catch (Exception e) @@ -703,23 +717,23 @@ { Thread.currentThread().setContextClassLoader(callerClassLoader); } - + return value; } - + /** - * Build the container MBean information on attributes, contstructors, - * operations, and notifications. Currently there are no attributes, no - * constructors, no notifications, and the following ops: - * <ul> - * <li>'home' -> invokeHome(Invocation);</li> - * <li>'remote' -> invoke(Invocation);</li> - * <li>'localHome' -> not implemented;</li> - * <li>'local' -> not implemented;</li> - * <li>'getHome' -> return EBJHome interface;</li> - * <li>'getRemote' -> return EJBObject interface</li> - * </ul> - */ + * Build the container MBean information on attributes, contstructors, + * operations, and notifications. Currently there are no attributes, no + * constructors, no notifications, and the following ops: + * <ul> + * <li>'home' -> invokeHome(Invocation);</li> + * <li>'remote' -> invoke(Invocation);</li> + * <li>'localHome' -> not implemented;</li> + * <li>'local' -> not implemented;</li> + * <li>'getHome' -> return EBJHome interface;</li> + * <li>'getRemote' -> return EJBObject interface</li> + * </ul> + */ public MBeanInfo getMBeanInfo() { MBeanParameterInfo miInfo = new MBeanParameterInfo("method", Invocation.class.getName(), "Invocation data"); @@ -742,22 +756,22 @@ return new MBeanInfo(getClass().getName(), "EJB Container MBean", null, ctorInfo, opInfo, notifyInfo); } - + // End DynamicMBean interface - + // Protected ----------------------------------------------------- - + abstract Interceptor createContainerInterceptor(); - + public abstract void addInterceptor(Interceptor in); - + // Private ------------------------------------------------------- - + /** - * This method sets up the naming environment of the bean. - * We create the java:comp/env namespace with properties, EJB-References, - * and DataSource ressources. - */ + * This method sets up the naming environment of the bean. + * We create the java:comp/env namespace with properties, EJB-References, + * and DataSource ressources. + */ private void setupEnvironment() throws DeploymentException { @@ -773,7 +787,7 @@ // Since the BCL is already associated with this thread we can start using the java: namespace directly Context ctx = (Context) new InitialContext().lookup("java:comp"); Context envCtx = ctx.createSubcontext("env"); - + // Bind environment properties { Iterator enum = beanMetaData.getEnvironmentEntries(); @@ -793,17 +807,17 @@ } } } - + // Bind EJB references { Iterator enum = beanMetaData.getEjbReferences(); while(enum.hasNext()) { - + EjbRefMetaData ref = (EjbRefMetaData)enum.next(); if (debug) log.debug("Binding an EJBReference "+ref.getName()); - + if (ref.getLink() != null) { // Internal link @@ -813,7 +827,7 @@ if (refContainer == null) throw new DeploymentException ("Bean "+ref.getLink()+" not found within this application."); bind(envCtx, ref.getName(), new LinkRef(refContainer.getBeanMetaData().getJndiName())); - + // bind(envCtx, ref.getName(), new Reference(ref.getHome(), new StringRefAddr("Container",ref.getLink()), getClass().getName()+".EjbReferenceFactory", null)); // bind(envCtx, ref.getName(), new LinkRef(ref.getLink())); } @@ -830,7 +844,7 @@ } } } - + // Bind Local EJB references { Iterator enum = beanMetaData.getEjbLocalReferences(); @@ -838,11 +852,11 @@ String uniqueKey = Long.toString( (new java.util.Date()).getTime() ); while(enum.hasNext()) { - + EjbLocalRefMetaData ref = (EjbLocalRefMetaData)enum.next(); if (debug) log.debug("Binding an EJBLocalReference "+ref.getName()); - + if (ref.getLink() != null) { // Internal link @@ -858,7 +872,7 @@ Reference jndiRef = new Reference(ref.getLocalHome(), refAddr, LocalHomeObjectFactory.class.getName(), null ); bind(envCtx, ref.getName(), jndiRef ); - + } else { @@ -866,30 +880,30 @@ } } } - + // Bind resource references { Iterator enum = beanMetaData.getResourceReferences(); - + // let's play guess the cast game ;) New metadata should fix this. ApplicationMetaData application = beanMetaData.getApplicationMetaData(); - + while(enum.hasNext()) { ResourceRefMetaData ref = (ResourceRefMetaData)enum.next(); - + String resourceName = ref.getResourceName(); String finalName = application.getResourceByName(resourceName); /* If there was no resource-manager specified then an immeadiate jndi-name or res-url name should have been given */ if (finalName == null) finalName = ref.getJndiName(); - + if (finalName == null) { // the application assembler did not provide a resource manager // if the type is javax.sql.Datasoure use the default one - + if (ref.getType().equals("javax.sql.DataSource")) { // Go through JNDI and look for DataSource - use the first one @@ -905,7 +919,7 @@ log.debug("failed to lookup DefaultDS; ignoring", e); } } - + // Default failed? Warn user and move on // POTENTIALLY DANGEROUS: should this be a critical error? if (finalName == null) @@ -914,7 +928,7 @@ continue; } } - + if (ref.getType().equals("java.net.URL")) { // URL bindings @@ -937,7 +951,7 @@ } } } - + // Bind resource env references { Iterator enum = beanMetaData.getResourceEnvReferences(); @@ -952,11 +966,11 @@ bind(envCtx, encName, new LinkRef(jndiName)); } } - + /* Create a java:comp/env/security/security-domain link to the container or application security-domain if one exists so that access to the security manager can be made without knowing the global jndi name. - */ + */ String securityDomain = metaData.getContainerConfiguration().getSecurityDomain(); if( securityDomain == null ) securityDomain = metaData.getApplicationMetaData().getSecurityDomain(); @@ -967,7 +981,7 @@ bind(envCtx, "security/security-domain", new LinkRef(securityDomain)); bind(envCtx, "security/subject", new LinkRef(securityDomain+"/subject")); } - + if (debug) log.debug("End java:comp/env for EJB: "+beanMetaData.getEjbName()); } catch (NamingException e) @@ -977,20 +991,20 @@ throw new DeploymentException("Could not set up environment", e); } } - - + + /** - * Bind a value to a name in a JNDI-context, and create any missing - * subcontexts. - * - * @param ctx - * @param name - * @param val - * - * @throws NamingException - */ + * Bind a value to a name in a JNDI-context, and create any missing + * subcontexts. + * + * @param ctx + * @param name + * @param val + * + * @throws NamingException + */ private void bind(Context ctx, String name, Object val) - throws NamingException + throws NamingException { // Bind val to name in ctx, and make sure that all // intermediate contexts exist
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
