[jboss-cvs] JBossAS SVN: r85161 - in projects/ejb3/trunk/nointerface: src/main/java/org/jboss/ejb3/nointerface and 13 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 3 08:00:42 EST 2009


Author: jaikiran
Date: 2009-03-03 08:00:41 -0500 (Tue, 03 Mar 2009)
New Revision: 85161

Added:
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/factory/
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/factory/StatefulNoInterfaceViewFactory.java
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/NoInterfaceViewInvocationHandler.java
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/StatefulNoInterfaceViewInvocationHandler.java
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/StatelessNoInterfaceViewInvocationHandler.java
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/NoInterfaceViewJNDIBinder.java
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/StatefulNoInterfaceJNDIBinder.java
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/StatelessNoInterfaceJNDIBinder.java
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/objectfactory/
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/objectfactory/NoInterfaceViewProxyFactoryRefAddrTypes.java
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/objectfactory/StatefulNoInterfaceViewObjectFactory.java
   projects/ejb3/trunk/nointerface/src/main/resources/META-INF/
   projects/ejb3/trunk/nointerface/src/main/resources/META-INF/jboss-beans.xml
   projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/SimpleSFSBean.java
   projects/ejb3/trunk/nointerface/src/test/resources/jndi.properties
Removed:
   projects/ejb3/trunk/nointerface/src/main/resources/jndi.properties
Modified:
   projects/ejb3/trunk/nointerface/pom.xml
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/deployers/EJB3NoInterfaceDeployer.java
   projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/NoInterfaceViewMCBean.java
   projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/AbstractNoInterfaceTestCase.java
   projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/unit/NoInterfaceEJBViewCreatorTestCase.java
   projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml
Log:
EJBTHREE-1727 More implementation for the no-interface view, including binding the appropriate object factory to the jndi for SFSB and also session creation for SFSB

Modified: projects/ejb3/trunk/nointerface/pom.xml
===================================================================
--- projects/ejb3/trunk/nointerface/pom.xml	2009-03-03 12:12:44 UTC (rev 85160)
+++ projects/ejb3/trunk/nointerface/pom.xml	2009-03-03 13:00:41 UTC (rev 85161)
@@ -27,26 +27,46 @@
       <version.javassist>3.7.1.GA</version.javassist>
       <version.org.jboss.ejb3_jboss-ejb3-test>1.0.0</version.org.jboss.ejb3_jboss-ejb3-test>
       <version.org.jboss.ejb3_jboss-ejb3-deployers>1.0.1-SNAPSHOT</version.org.jboss.ejb3_jboss-ejb3-deployers>
+      <version.org.jboss.bootstrap_jboss-bootstrap>1.0.0-Beta-1</version.org.jboss.bootstrap_jboss-bootstrap>
 
   </properties>
 
  <build>
-
-     <testResources>
+  <!--  we use the target/test-classes as our root of all the
+  deployments for our test cases. We cannot have other resources in that
+  folder which can cause deployment exceptions. So we create a new target/test-resources folder
+  where all resources (except) jndi.properties will be copied to during mvn -->
+  <testResources>
+    <!--  Copy everything except jndi.properties to target/test-resources -->
     <testResource>
       <!-- Relative to tests-classes -->
       <targetPath>../test-resources</targetPath>
       <directory>${basedir}/src/test/resources</directory>
+      <excludes>
+       <exclude>jndi.properties</exclude>
+      </excludes>
     </testResource>
+    <!-- Copy jndi.properties to target/tests-classes, so that its available
+    first in the list of classpath.
+     -->
+    <testResource>
+      <!-- Relative to tests-classes -->
+      <directory>${basedir}/src/test/resources</directory>
+      <includes>
+       <include>jndi.properties</include>
+      </includes>
+    </testResource>
+
    </testResources>
+
    <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
+        <!-- Add our specific target/test-resources to the test classpath -->
           <additionalClasspathElements>
                 <additionalClasspathElement>${basedir}/target/test-resources</additionalClasspathElement>
-
           </additionalClasspathElements>
         </configuration>
       </plugin>
@@ -54,11 +74,9 @@
 
   </build>
 
-
-
+ <!-- Dependencies -->
   <dependencies>
 
-
     <!-- JUnit support -->
     <dependency>
       <groupId>junit</groupId>
@@ -78,11 +96,11 @@
     <dependency>
       <groupId>org.jboss.bootstrap</groupId>
       <artifactId>jboss-bootstrap</artifactId>
-      <version>1.0.0-Beta-1</version>
+      <version>${version.org.jboss.bootstrap_jboss-bootstrap}</version>
       <scope>test</scope>
     </dependency>
 
-
+  <!-- Javassist  -->
     <dependency>
       <groupId>javassist</groupId>
       <artifactId>javassist</artifactId>

Modified: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/deployers/EJB3NoInterfaceDeployer.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/deployers/EJB3NoInterfaceDeployer.java	2009-03-03 12:12:44 UTC (rev 85160)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/deployers/EJB3NoInterfaceDeployer.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -125,7 +125,9 @@
          }
          Class<?> beanClass = Class.forName(sessionBeanMetaData.getEjbClass(), false, unit.getClassLoader());
 
-         // Doesn't work - returns null (in ejb3-test environment). So until then temporarily use a hack
+         // The container name is set in the metadata only after the creation of the container
+         // However, this deployer does not have an dependency on the creation of a container,
+         // so getting the container name from the bean metadata won't work. Need to do a different/better way
          //String containerMCBeanName = sessionBeanMetaData.getContainerName();
          JavaEEModule module = new SimpleJavaEEModule(unit.getSimpleName());
          String ejbName = sessionBeanMetaData.getEjbName();

Added: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/factory/StatefulNoInterfaceViewFactory.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/factory/StatefulNoInterfaceViewFactory.java	                        (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/factory/StatefulNoInterfaceViewFactory.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.factory;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+
+import org.jboss.ejb3.nointerface.NoInterfaceEJBViewCreator;
+import org.jboss.ejb3.nointerface.invocationhandler.StatefulNoInterfaceViewInvocationHandler;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.ejb3.proxy.container.StatefulSessionInvokableContext;
+import org.jboss.logging.Logger;
+
+/**
+ * StatefulNoInterfaceViewFactory
+ *
+ * Responsible for (not necessarily in the following order)
+ * - Creating a session from the stateful container
+ * - Creating the no-interface view for a stateful session bean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class StatefulNoInterfaceViewFactory
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(StatefulNoInterfaceViewFactory.class);
+
+   /**
+    * The bean class
+    */
+   protected Class<?> beanClass;
+
+   /**
+    * The container corresponding to the bean for which
+    * the no-interface view is to be created by this factory
+    */
+   protected InvokableContext container;
+
+   /**
+    * Constructor
+    * @param beanClass
+    * @param container
+    */
+   public StatefulNoInterfaceViewFactory(Class<?> beanClass, InvokableContext container)
+   {
+      this.beanClass = beanClass;
+      this.container = container;
+   }
+
+   /**
+    * Creates the no-interface view and other necessary steps including (session creation)
+    * for the bean
+    *
+    * @return
+    * @throws Exception
+    */
+   public Object createNoInterfaceView() throws Exception
+   {
+      logger.debug("Creating no-interface view for " + this.beanClass);
+
+      StatefulSessionInvokableContext statefulContainer = (StatefulSessionInvokableContext) container;
+      Serializable session = statefulContainer.createSession();
+      logger.debug("Created session " + session + " for " + this.beanClass);
+
+      // create an invocation handler and associate it with the newly created session
+      InvocationHandler invocationHandler = this.createInvocationHandlerForSession(statefulContainer, session);
+
+      // Now create the view for this bean class and the newly created invocation handler
+      NoInterfaceEJBViewCreator noInterfaceViewCreator = new NoInterfaceEJBViewCreator();
+      Object noInterfaceView = noInterfaceViewCreator.createView(invocationHandler, beanClass);
+
+      if (logger.isTraceEnabled())
+      {
+         logger.trace("Created no-interface view " + noInterfaceView + " for bean " + beanClass);
+      }
+      return noInterfaceView;
+   }
+
+   /**
+    * Creates an {@link StatefulNoInterfaceViewInvocationHandler} and associates it with
+    * the <code>session</code>
+    *
+    * @param container
+    * @param session
+    * @return
+    */
+   protected InvocationHandler createInvocationHandlerForSession(InvokableContext container, Serializable session)
+   {
+      StatefulNoInterfaceViewInvocationHandler invocationHandler = new StatefulNoInterfaceViewInvocationHandler(
+            container);
+      invocationHandler.setSessionId(session);
+      return invocationHandler;
+   }
+
+}

Added: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/NoInterfaceViewInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/NoInterfaceViewInvocationHandler.java	                        (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/NoInterfaceViewInvocationHandler.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.invocationhandler;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+
+/**
+ * NoInterfaceViewInvocationHandler
+ *
+ * An {@link InvocationHandler} which corresponds to the
+ * no-interface view of a {@link EJBContainer}. All calls on the no-interface
+ * view are routed through this {@link InvocationHandler} to the container.
+ *
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public abstract class NoInterfaceViewInvocationHandler implements InvocationHandler
+{
+
+   /**
+    * The container to which this invocation handler corresponds to.
+    * All calls to this invocation handler will be forwarded to this
+    * container.
+    *
+    */
+   protected InvokableContext container;
+
+   /**
+    * Constructor
+    * @param container
+    */
+   public NoInterfaceViewInvocationHandler(InvokableContext container)
+   {
+      assert container != null : "Container is null for no-interface view invocation handler";
+      this.container = container;
+   }
+
+   /**
+    * Each type of {@link NoInterfaceViewInvocationHandler} are responsible for
+    * handling the invocation through the no-interface view appropriately.
+    *
+    * @see StatelessNoInterfaceViewInvocationHandler#doInvoke(Object, Method, Object[])
+    * @see StatefulNoInterfaceViewInvocationHandler#doInvoke(Object, Method, Object[])
+    *
+    * @param proxy The proxy/no-interface view through which the call was triggered
+    * @param method The invoked method
+    * @param args The arguments to the method
+    */
+   public abstract Object doInvoke(Object proxy, Method method, Object[] args) throws Throwable;
+
+   /**
+    * The entry point when a client calls any methods on the no-interface view of a bean,
+    * returned through JNDI.
+    *
+    * This method will do the common steps (common for SLSB and SFSB) before passing on the
+    * call to {@link #doInvoke(Object, Method, Object[])}
+    *
+    * @param proxy The proxy/no-interface view through which the call was triggered
+    * @param method The invoked method
+    * @param args The arguments to the method
+    */
+   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+   {
+      // TODO: Some methods like toString() can be handled locally.
+      // But as of now let's just pass it on to the container.
+      return doInvoke(proxy, method, args);
+   }
+
+   /**
+    * Returns the container associated with this invocation handler
+    *
+    * @return
+    */
+   public InvokableContext getContainer()
+   {
+      return this.container;
+   }
+
+}

Added: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/StatefulNoInterfaceViewInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/StatefulNoInterfaceViewInvocationHandler.java	                        (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/StatefulNoInterfaceViewInvocationHandler.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.invocationhandler;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+
+import org.jboss.ejb3.common.lang.SerializableMethod;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.logging.Logger;
+
+/**
+ * StatefulNoInterfaceViewInvocationHandler
+ *
+ * Responsible for handling invocations to a stateful bean through the no-interface
+ * view of the bean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class StatefulNoInterfaceViewInvocationHandler extends NoInterfaceViewInvocationHandler
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(StatefulNoInterfaceViewInvocationHandler.class);
+
+   /**
+    * A stateful bean is invoked within a session. This represents the
+    * session id.
+    */
+   private Serializable sessionId;
+
+   /**
+    * Constructor
+    *
+    * @param container
+    */
+   public StatefulNoInterfaceViewInvocationHandler(InvokableContext container)
+   {
+      super(container);
+   }
+
+   /**
+    * Associates a session with this invocation handler
+    *
+    * @param session
+    */
+   public void setSessionId(Serializable session)
+   {
+      this.sessionId = session;
+   }
+
+   /**
+    * Returns the session id corresponds to this invocation handler
+    * @return
+    */
+   public Serializable getSessionId()
+   {
+      return this.sessionId;
+   }
+
+   /**
+    * This is where the invocation to the container takes place.
+    */
+   @Override
+   public Object doInvoke(Object proxy, Method method, Object[] args) throws Throwable
+   {
+
+      assert this.container != null : "Container not yet available to the no-interface view invocation handler";
+
+      SerializableMethod serializableMethod = new SerializableMethod(method);
+      if (logger.isTraceEnabled())
+      {
+         logger.trace("Invoking container method " + serializableMethod + " for session " + this.getSessionId());
+      }
+
+      return this.container.invoke(this.getSessionId(), serializableMethod, args);
+
+   }
+
+}

Added: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/StatelessNoInterfaceViewInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/StatelessNoInterfaceViewInvocationHandler.java	                        (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/invocationhandler/StatelessNoInterfaceViewInvocationHandler.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.invocationhandler;
+
+import java.lang.reflect.Method;
+
+import org.apache.log4j.Logger;
+import org.jboss.ejb3.common.lang.SerializableMethod;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+
+/**
+ * StatelessNoInterfaceViewInvocationHandler
+ *
+ * Responsible for handling invocations to a stateless session bean
+ * through the no-interface view of the bean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class StatelessNoInterfaceViewInvocationHandler extends NoInterfaceViewInvocationHandler
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(StatelessNoInterfaceViewInvocationHandler.class);
+
+   /**
+    * Constructor
+    *
+    * @param container
+    */
+   public StatelessNoInterfaceViewInvocationHandler(InvokableContext container)
+   {
+      super(container);
+   }
+
+   /**
+    * This is where the invocation on the container is done
+    */
+   @Override
+   public Object doInvoke(Object proxy, Method method, Object[] args) throws Throwable
+   {
+      assert this.container != null : "Container not yet available to the no-interface view invocation handler";
+
+      SerializableMethod serializableMethod = new SerializableMethod(method);
+
+      return this.container.invoke(null, serializableMethod, args);
+   }
+}

Added: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/NoInterfaceViewJNDIBinder.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/NoInterfaceViewJNDIBinder.java	                        (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/NoInterfaceViewJNDIBinder.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.jndi;
+
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * NoInterfaceViewJNDIBinder
+ * Responsible for binding objects related to no-interface view of a bean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public abstract class NoInterfaceViewJNDIBinder
+{
+
+   /**
+    * Create a JNDIBinder
+    * @param sessionBeanMetaData
+    * @return
+    */
+   public static NoInterfaceViewJNDIBinder getJNDIBinder(JBossSessionBeanMetaData sessionBeanMetaData)
+   {
+      return sessionBeanMetaData.isStateless()
+            ? new StatelessNoInterfaceJNDIBinder()
+            : new StatefulNoInterfaceJNDIBinder();
+   }
+
+   /**
+    * Each type of {@link NoInterfaceViewJNDIBinder} is responsible for binding
+    * the appropriate objects to jndi
+    *
+    * @see StatelessNoInterfaceJNDIBinder#bindNoInterfaceView(Class, InvokableContext, JBossSessionBeanMetaData)
+    * @see StatefulNoInterfaceJNDIBinder#bindNoInterfaceView(Class, InvokableContext, JBossSessionBeanMetaData)
+    *
+    * @param beanClass
+    * @param container
+    * @param sessionBeanMetadata
+    * @throws Exception
+    */
+   public abstract void bindNoInterfaceView(Class<?> beanClass, InvokableContext container,
+         JBossSessionBeanMetaData sessionBeanMetadata) throws Exception;
+}

Added: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/StatefulNoInterfaceJNDIBinder.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/StatefulNoInterfaceJNDIBinder.java	                        (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/StatefulNoInterfaceJNDIBinder.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.jndi;
+
+import javax.naming.InitialContext;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+
+import org.jboss.ejb3.NonSerializableFactory;
+import org.jboss.ejb3.nointerface.factory.StatefulNoInterfaceViewFactory;
+import org.jboss.ejb3.nointerface.objectfactory.NoInterfaceViewProxyFactoryRefAddrTypes;
+import org.jboss.ejb3.nointerface.objectfactory.StatefulNoInterfaceViewObjectFactory;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * StatefulNoInterfaceJNDIBinder
+ *
+ * Responsible for creating and binding the appropriate objects
+ * corresponding to the no-interface view of a stateful session bean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class StatefulNoInterfaceJNDIBinder extends NoInterfaceViewJNDIBinder
+{
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(StatefulNoInterfaceJNDIBinder.class);
+
+   /**
+    * 1) Creates a {@link StatefulNoInterfaceViewFactory} and binds it to JNDI (let's call
+    * this jndi-name "A")
+    *
+    * 2) Creates a {@link StatefulNoInterfaceViewObjectFactory} objectfactory and binds a {@link Reference}
+    * to this objectfactory into the JNDI (let's call it jndi-name "B").
+    *
+    * The objectfactory will have a reference to the jndi-name of the stateful factory (created in step#1).
+    * This will then be used by the object factory to lookup the stateful factory for creating the no-interface
+    * view when the client does a lookup.
+    *
+    *
+    */
+   @Override
+   public void bindNoInterfaceView(Class<?> beanClass, InvokableContext container,
+         JBossSessionBeanMetaData sessionBeanMetadata) throws Exception
+   {
+      logger.debug("Binding no-interface view statefulproxyfactory and the objectfactory for bean " + beanClass);
+
+      // This factory will be bound to JNDI and will be invoked (through an objectfactory) to create
+      // the no-interface view for a SFSB
+      StatefulNoInterfaceViewFactory statefulNoInterfaceViewFactory = new StatefulNoInterfaceViewFactory(beanClass,
+            container);
+
+      // TODO - Needs to be a proper jndi name for the factory
+      String statefulProxyFactoryJndiName = sessionBeanMetadata.getEjbName() + "/no-interface-stateful-proxyfactory";
+      // Bind the proxy factory to jndi
+      NonSerializableFactory.bind(new InitialContext(), statefulProxyFactoryJndiName, statefulNoInterfaceViewFactory);
+
+      // Create an Reference which will hold the jndi-name of the statefulproxyfactory which will
+      // be responsible for creating the no-interface view for the stateful bean upon lookup
+      Reference reference = new Reference(
+            NoInterfaceViewProxyFactoryRefAddrTypes.STATEFUL_NO_INTERFACE_VIEW_OBJECT_FACTORY_KEY,
+            StatefulNoInterfaceViewObjectFactory.class.getName(), null);
+      RefAddr refAddr = new StringRefAddr(
+            NoInterfaceViewProxyFactoryRefAddrTypes.STATEFUL_NO_INTERFACE_VIEW_PROXY_FACTORY_JNDI_LOCATION,
+            statefulProxyFactoryJndiName);
+      // add this refaddr to the reference which will be bound to jndi
+      reference.add(refAddr);
+
+      // TODO: Again, the jndi-names for the no-interface view are a mess now. They need to come from
+      // the metadata. Let's just go ahead temporarily
+      String noInterfaceJndiName = sessionBeanMetadata.getEjbName() + "/no-interface";
+      // TODO : This is not right - i guess there is some way to get hold of the initial context
+      // for a given deployment. Need to look more into this
+      new InitialContext().bind(noInterfaceJndiName, reference);
+
+      logger.info("Bound the no-interface view for bean " + beanClass + " to jndi at " + noInterfaceJndiName);
+
+   }
+
+}

Added: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/StatelessNoInterfaceJNDIBinder.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/StatelessNoInterfaceJNDIBinder.java	                        (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/jndi/StatelessNoInterfaceJNDIBinder.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.jndi;
+
+import javax.naming.InitialContext;
+
+import org.jboss.ejb3.NonSerializableFactory;
+import org.jboss.ejb3.nointerface.NoInterfaceEJBViewCreator;
+import org.jboss.ejb3.nointerface.invocationhandler.StatelessNoInterfaceViewInvocationHandler;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+
+/**
+ * StatelessNoInterfaceJNDIBinder
+ *
+ *  Responsible for binding the appropriate objects corresponding to the
+ *  no-interface view of a stateless session bean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class StatelessNoInterfaceJNDIBinder extends NoInterfaceViewJNDIBinder
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(StatelessNoInterfaceJNDIBinder.class);
+
+   /**
+    * Creates the no-interface view for the bean and binds it to the JNDI
+    * under the no-interface view jndi name obtained from <code>sessionBeanMetadata</code>.
+    *
+    * @see NoInterfaceEJBViewCreator#createView(java.lang.reflect.InvocationHandler, Class)
+    */
+   @Override
+   public void bindNoInterfaceView(Class<?> beanClass, InvokableContext container,
+         JBossSessionBeanMetaData sessionBeanMetadata) throws Exception
+   {
+      logger.debug("Creating no-interface view for bean " + beanClass);
+
+      // Create the view and bind to jndi
+      NoInterfaceEJBViewCreator noInterfaceViewCreator = new NoInterfaceEJBViewCreator();
+      Object noInterfaceView = noInterfaceViewCreator.createView(new StatelessNoInterfaceViewInvocationHandler(
+            container), beanClass);
+      // bind
+      // TODO: Again, the jndi-names for the no-interface view are a mess now. They need to come from
+      // the metadata. Let's just go ahead temporarily
+      String noInterfaceJndiName = sessionBeanMetadata.getEjbName() + "/no-interface";
+      NonSerializableFactory.bind(new InitialContext(), noInterfaceJndiName, noInterfaceView);
+
+      logger.info("Bound the no-interface view for bean " + beanClass + " to jndi at " + noInterfaceJndiName);
+
+   }
+
+}

Modified: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/NoInterfaceViewMCBean.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/NoInterfaceViewMCBean.java	2009-03-03 12:12:44 UTC (rev 85160)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/mc/NoInterfaceViewMCBean.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -21,14 +21,10 @@
  */
 package org.jboss.ejb3.nointerface.mc;
 
-import javax.naming.InitialContext;
-
 import org.jboss.beans.metadata.api.annotations.Inject;
 import org.jboss.beans.metadata.api.annotations.InstallMethod;
 import org.jboss.beans.metadata.api.annotations.UninstallMethod;
-import org.jboss.ejb3.NonSerializableFactory;
-import org.jboss.ejb3.nointerface.NoInterfaceEJBViewCreator;
-import org.jboss.ejb3.nointerface.NoInterfaceViewInvocationHandler;
+import org.jboss.ejb3.nointerface.jndi.NoInterfaceViewJNDIBinder;
 import org.jboss.ejb3.proxy.container.InvokableContext;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
@@ -67,6 +63,12 @@
    private JBossSessionBeanMetaData sessionBeanMetadata;
 
    /**
+    * The {@link NoInterfaceViewJNDIBinder} which will be used for binding
+    * the no-interface view/stateful factory for the corresponding bean
+    */
+   private NoInterfaceViewJNDIBinder jndiBinder;
+
+   /**
     * Constructor
     *
     * @param beanClass
@@ -76,6 +78,7 @@
    {
       this.beanClass = beanClass;
       this.sessionBeanMetadata = sessionBeanMetadata;
+      this.jndiBinder = NoInterfaceViewJNDIBinder.getJNDIBinder(sessionBeanMetadata);
    }
 
    /**
@@ -99,19 +102,7 @@
          logger.trace("Creating no-interface view for container " + this.container);
       }
 
-      // create the view
-      // Don't probably need to create an instance of view creator everytime. Maybe the
-      // view creator can provide "static" methods for creating view, since the creators
-      // don't really require to store any state.
-      NoInterfaceEJBViewCreator noInterfaceViewCreator = new NoInterfaceEJBViewCreator();
-
-      Object noInterfaceView = noInterfaceViewCreator.createView(new NoInterfaceViewInvocationHandler(this.container),
-            this.beanClass);
-
-      // TODO: This does not belong here and the jndi binding part is still in discussion.
-      // This is just a temporary piece of code which binds the no-interface view to the ejbName
-      NonSerializableFactory.rebind(new InitialContext(), this.sessionBeanMetadata.getEjbName(), noInterfaceView);
-
+      this.jndiBinder.bindNoInterfaceView(this.beanClass, this.container, this.sessionBeanMetadata);
    }
 
    @UninstallMethod
@@ -131,4 +122,5 @@
       this.container = container;
 
    }
+
 }

Added: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/objectfactory/NoInterfaceViewProxyFactoryRefAddrTypes.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/objectfactory/NoInterfaceViewProxyFactoryRefAddrTypes.java	                        (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/objectfactory/NoInterfaceViewProxyFactoryRefAddrTypes.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.objectfactory;
+
+/**
+ * NoInterfaceViewProxyFactoryRefAddrTypes
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface NoInterfaceViewProxyFactoryRefAddrTypes
+{
+
+   public static final String STATEFUL_NO_INTERFACE_VIEW_PROXY_FACTORY_JNDI_LOCATION = "Stateful Proxy factory for no-interface view";
+
+   public static final String STATEFUL_NO_INTERFACE_VIEW_OBJECT_FACTORY_KEY = "Object factory for no-interface view for stateful bean";
+}

Added: projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/objectfactory/StatefulNoInterfaceViewObjectFactory.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/objectfactory/StatefulNoInterfaceViewObjectFactory.java	                        (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/java/org/jboss/ejb3/nointerface/objectfactory/StatefulNoInterfaceViewObjectFactory.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.objectfactory;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.spi.ObjectFactory;
+
+import org.apache.log4j.Logger;
+import org.jboss.ejb3.nointerface.factory.StatefulNoInterfaceViewFactory;
+
+/**
+ * StatefulNoInterfaceViewObjectFactory
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class StatefulNoInterfaceViewObjectFactory implements ObjectFactory
+{
+
+   private static Logger logger = Logger.getLogger(StatefulNoInterfaceViewObjectFactory.class);
+
+   public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment)
+         throws Exception
+   {
+
+      if (logger.isTraceEnabled())
+      {
+         logger.trace("Creating object instance through object instance factory for name " + name);
+      }
+      logger.debug("Creating object instance through object instance factory for name " + name);
+      assert obj instanceof Reference : StatefulNoInterfaceViewObjectFactory.class
+            + " cannot create view from obj of type " + obj.getClass().getName();
+
+      Reference reference = (Reference) obj;
+      String jndiNameOfStatefulProxyFactory = this.getProxyFactoryJNDINameFromReference(reference);
+      assert jndiNameOfStatefulProxyFactory != null : "Stateful proxy factory for creating no-interface view, not found in reference";
+
+      // now lookup the factory
+      Object proxyFactory = nameCtx.lookup(jndiNameOfStatefulProxyFactory);
+
+      assert proxyFactory instanceof StatefulNoInterfaceViewFactory : "Unexpected type found at jndi name "
+            + jndiNameOfStatefulProxyFactory + " Expected type " + StatefulNoInterfaceViewFactory.class.getName();
+
+      StatefulNoInterfaceViewFactory statefulNoInterfaceViewFactory = (StatefulNoInterfaceViewFactory) proxyFactory;
+
+      return statefulNoInterfaceViewFactory.createNoInterfaceView();
+      // TODO: Should not throw an exception, return null instead. see objectfactory reference
+   }
+
+   protected String getProxyFactoryJNDINameFromReference(Reference ref)
+   {
+      Enumeration<RefAddr> refAddrs = ref.getAll();
+      while (refAddrs.hasMoreElements())
+      {
+         RefAddr refAddr = refAddrs.nextElement();
+         String type = refAddr.getType();
+         if (type
+               .equals(NoInterfaceViewProxyFactoryRefAddrTypes.STATEFUL_NO_INTERFACE_VIEW_PROXY_FACTORY_JNDI_LOCATION))
+         {
+            Object jndiNameOfStatefulProxyFactory = refAddr.getContent();
+            assert jndiNameOfStatefulProxyFactory instanceof String : "Unexpected type for "
+                  + NoInterfaceViewProxyFactoryRefAddrTypes.STATEFUL_NO_INTERFACE_VIEW_PROXY_FACTORY_JNDI_LOCATION;
+
+            return (String) jndiNameOfStatefulProxyFactory;
+         }
+      }
+      return null;
+   }
+
+}

Added: projects/ejb3/trunk/nointerface/src/main/resources/META-INF/jboss-beans.xml
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/resources/META-INF/jboss-beans.xml	                        (rev 0)
+++ projects/ejb3/trunk/nointerface/src/main/resources/META-INF/jboss-beans.xml	2009-03-03 13:00:41 UTC (rev 85161)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <!-- No-interface view deployer - works on JBossMetadata and creates a NoInterfaceMCBean -->
+  <bean name="Ejb3NoInterfaceViewDeployer" class="org.jboss.ejb3.nointerface.deployers.EJB3NoInterfaceDeployer"/>
+
+</deployment>
\ No newline at end of file

Deleted: projects/ejb3/trunk/nointerface/src/main/resources/jndi.properties
===================================================================
--- projects/ejb3/trunk/nointerface/src/main/resources/jndi.properties	2009-03-03 12:12:44 UTC (rev 85160)
+++ projects/ejb3/trunk/nointerface/src/main/resources/jndi.properties	2009-03-03 13:00:41 UTC (rev 85161)
@@ -1,2 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Modified: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/AbstractNoInterfaceTestCase.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/AbstractNoInterfaceTestCase.java	2009-03-03 12:12:44 UTC (rev 85160)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/common/AbstractNoInterfaceTestCase.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -166,6 +166,7 @@
     */
    public static void startServerConfiguration() throws Exception
    {
+
       deployDeployers();
 
       // Some of the deployers/mc beans come from the classpath jars (ex: For JTA support,
@@ -189,6 +190,7 @@
    {
       // now deploy the deployers
       deploy(new File(SERVER_PROFILE_DEPLOYERS_DIR_PATH).toURL());
+
    }
 
    /**
@@ -231,14 +233,14 @@
       mkdir(SERVER_PROFILE_TMP_NATIVE_DIR_PATH);
 
       Properties serverBootstrapProperties = new Properties();
-      serverBootstrapProperties.put(ServerConfig.HOME_DIR, serverHome.toString());
-      serverBootstrapProperties.put(ServerConfig.SERVER_HOME_DIR, serverProfileHome.toString());
+      serverBootstrapProperties.put(ServerConfig.HOME_DIR, serverHome.getPath());
+      serverBootstrapProperties.put(ServerConfig.SERVER_HOME_DIR, serverProfileHome.getPath());
 
       URL configDir = findDir(SERVER_PROFILE_CONFIG_DIR_PATH);
       serverBootstrapProperties.put(ServerConfig.SERVER_CONFIG_URL, configDir.toString());
       if (logger.isTraceEnabled())
       {
-         logger.trace("Config dir is " + configDir);
+         logger.trace("Config URL is " + configDir);
       }
 
       return serverBootstrapProperties;

Added: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/SimpleSFSBean.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/SimpleSFSBean.java	                        (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/SimpleSFSBean.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.nointerface.test.viewcreator;
+
+import javax.ejb.Stateful;
+
+/**
+ * SimpleSFSBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateful
+public class SimpleSFSBean
+{
+
+}

Modified: projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/unit/NoInterfaceEJBViewCreatorTestCase.java
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/unit/NoInterfaceEJBViewCreatorTestCase.java	2009-03-03 12:12:44 UTC (rev 85160)
+++ projects/ejb3/trunk/nointerface/src/test/java/org/jboss/ejb3/nointerface/test/viewcreator/unit/NoInterfaceEJBViewCreatorTestCase.java	2009-03-03 13:00:41 UTC (rev 85161)
@@ -21,15 +21,15 @@
  */
 package org.jboss.ejb3.nointerface.test.viewcreator.unit;
 
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import javax.naming.Binding;
 import javax.naming.Context;
 import javax.naming.InitialContext;
-import javax.naming.NamingEnumeration;
 
 import org.jboss.ejb3.nointerface.NoInterfaceEJBViewCreator;
 import org.jboss.ejb3.nointerface.test.common.AbstractNoInterfaceTestCase;
+import org.jboss.ejb3.nointerface.test.viewcreator.SimpleSFSBean;
 import org.jboss.ejb3.nointerface.test.viewcreator.SimpleSLSBWithoutInterface;
 import org.jboss.ejb3.test.common.MetaDataHelper;
 import org.jboss.logging.Logger;
@@ -54,6 +54,11 @@
     */
    private static Logger logger = Logger.getLogger(NoInterfaceEJBViewCreatorTestCase.class);
 
+   /**
+    * Starts the bootstrap and deploys the test classes
+    *
+    * @throws Exception
+    */
    @BeforeClass
    public static void beforeClass() throws Exception
    {
@@ -62,6 +67,10 @@
       deploy(getTestClassesURL());
    }
 
+   /**
+    * Shutdown
+    * @throws Exception
+    */
    @AfterClass
    public static void afterClass() throws Exception
    {
@@ -69,36 +78,60 @@
    }
 
    /**
-    * Test to ensure that all the public (non-static, non-final) methods on a bean
-    * are routed through the container
+    * Ensure that the no-interface view for an SLSB is bound to jndi
     *
     * @throws Exception
     */
    @Test
-   public void testNoInterfaceViewCreator() throws Exception
+   public void testSLSBNoInterfaceBinding() throws Exception
    {
 
       JBossSessionBeanMetaData sessionBeanMetadata = MetaDataHelper
             .getMetadataFromBeanImplClass(SimpleSLSBWithoutInterface.class);
-      String ejbName = sessionBeanMetadata.getEjbName();
-      logger.debug("Looking up " + ejbName);
+
+      // Right now, the no-interface view is bound to the ejb-name/no-interface
+      String noInterfaceJndiName = sessionBeanMetadata.getEjbName() + "/no-interface";
+      logger.debug("Looking up " + noInterfaceJndiName);
       Context ctx = new InitialContext();
-      NamingEnumeration<Binding> bindings = ctx.listBindings("");
-      boolean isNoInterfaceViewBound = false;
-      while (bindings.hasMoreElements())
-      {
-         Binding binding = bindings.nextElement();
-         if (binding.getName().equals(ejbName))
-         {
-            isNoInterfaceViewBound = true;
-            break;
-         }
 
-      }
-      assertTrue("No-interface view not bound at " + ejbName, isNoInterfaceViewBound);
+      // check the view
+      Object noInterfaceView = ctx.lookup(noInterfaceJndiName);
+      assertNotNull("No-interface view for SLSB returned null from JNDI", noInterfaceView);
+
+      assertTrue("No-interface view for SLSB is not an instance of  " + SimpleSLSBWithoutInterface.class.getName(),
+            (noInterfaceView instanceof SimpleSLSBWithoutInterface));
+
    }
 
+   /**
+    * Ensure that the no-interface view (and corresponding factory) for an SFSB are bound to jndi
+    *
+    * @throws Exception
+    */
+   @Test
+   public void testSFSBNoInterfaceBindings() throws Exception
+   {
+      JBossSessionBeanMetaData sessionBeanMetadata = MetaDataHelper.getMetadataFromBeanImplClass(SimpleSFSBean.class);
 
+      // Right now, the no-interface view is bound to the ejb-name/no-interface
+      String noInterfaceJndiName = sessionBeanMetadata.getEjbName() + "/no-interface";
+      String statefulProxyFactoryJndiName = sessionBeanMetadata.getEjbName() + "/no-interface-stateful-proxyfactory";
+      logger.debug("Looking up no-interface view for sfsb at " + noInterfaceJndiName);
+
+      Context ctx = new InitialContext();
+      // check the proxy factory
+      Object proxyFactory = ctx.lookup(statefulProxyFactoryJndiName);
+      assertNotNull("Stateful proxy factory for SFSB returned null from JNDI", proxyFactory);
+
+      // check the view
+      Object noInterfaceView = ctx.lookup(noInterfaceJndiName);
+      assertNotNull("No-interface view for SFSB returned null from JNDI", noInterfaceView);
+
+      assertTrue("No-interface view for SFSB is not an instance of  " + SimpleSFSBean.class.getName(),
+            (noInterfaceView instanceof SimpleSFSBean));
+
+   }
+
    // Other tests will be enabled once the component is more testable
 
    //   /**

Modified: projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml	2009-03-03 12:12:44 UTC (rev 85160)
+++ projects/ejb3/trunk/nointerface/src/test/resources/deployers/ejb3-deployers-jboss-beans.xml	2009-03-03 13:00:41 UTC (rev 85161)
@@ -5,8 +5,6 @@
    <bean name="EjbAnnotationMetaDataDeployer" class="org.jboss.ejb3.deployers.EjbAnnotationMetaDataDeployer"/>
  <bean name="MergedJBossMetaDataDeployer" class="org.jboss.ejb3.deployers.MergedJBossMetaDataDeployer"/>
 
-   <!-- No-interface view deployer - works on JBossMetadata and creates a NoInterfaceMCBean -->
-  <bean name="Ejb3NoInterfaceViewDeployer" class="org.jboss.ejb3.nointerface.deployers.EJB3NoInterfaceDeployer"/>
 
 <!-- To create the containers -->
    <bean name="EjbModuleDeployer" class="org.jboss.ejb3.nointerface.test.deployers.EjbModuleDeployer"/>

Copied: projects/ejb3/trunk/nointerface/src/test/resources/jndi.properties (from rev 84704, projects/ejb3/trunk/nointerface/src/main/resources/jndi.properties)
===================================================================
--- projects/ejb3/trunk/nointerface/src/test/resources/jndi.properties	                        (rev 0)
+++ projects/ejb3/trunk/nointerface/src/test/resources/jndi.properties	2009-03-03 13:00:41 UTC (rev 85161)
@@ -0,0 +1,2 @@
+java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces




More information about the jboss-cvs-commits mailing list