openejb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r465148 - in /incubator/openejb/trunk/openejb3: container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ container/openejb-core/src/main/resources/META-INF/org.apache.openejb/ openejb-itests/src/main/java/org/apache/openej...
Date Wed, 18 Oct 2006 05:25:29 GMT
Author: dblevins
Date: Tue Oct 17 22:25:26 2006
New Revision: 465148

URL: http://svn.apache.org/viewvc?view=rev&rev=465148
Log:
OPENEJB-91 Remote business interfaces via EJBd Server
OPENEJB-96 Global JNDI Business Interface references
OPENEJB-158 iTest: StatelessRemoteBusinessIntfcTests
OPENEJB-184 iTest: StatefulRemoteBusinessIntfcTests

Added:
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulBusinessRemote.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulRemoteBusinessIntfcTests.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessBusinessRemote.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessRemoteBusinessIntfcTests.java
Modified:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulBusinessLocal.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulPojoBean.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulLocalBusinessIntfcTests.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulLocalTestSuite.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulTestSuite.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessBusinessLocal.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessPojoBean.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java
    incubator/openejb/trunk/openejb3/openejb-itests/src/main/resources/META-INF/ejb-jar.xml
    incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java
    incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIResponse.java
    incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ResponseCodes.java
    incubator/openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
Tue Oct 17 22:25:26 2006
@@ -149,7 +149,7 @@
         try {
             Class businessRemoteInterface = deployment.getBusinessRemoteInterface();
             if (businessRemoteInterface != null) {
-                String name = strategy.getName(deployment, businessRemoteInterface, JndiNameStrategy.Interface.BUSINESS_LOCAL);
+                String name = strategy.getName(deployment, businessRemoteInterface, JndiNameStrategy.Interface.BUSINESS_REMOTE);
                 DeploymentInfo.BusinessRemoteHome businessRemoteHome = deployment.getBusinessRemoteHome();
                 context.bind("openejb/ejb/" + name, new BusinessRemoteReference(businessRemoteHome));
             }

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml
Tue Oct 17 22:25:26 2006
@@ -465,6 +465,7 @@
               localHomeInterface="org.apache.openejb.test.stateful.BasicStatefulLocalHome"
               localInterface="org.apache.openejb.test.stateful.BasicStatefulLocalObject"
               businessLocalInterface="org.apache.openejb.test.stateful.BasicStatefulBusinessLocal"
+              businessRemoteInterface="org.apache.openejb.test.stateful.BasicStatefulBusinessRemote"
               beanClass="org.apache.openejb.test.stateful.BasicStatefulPojoBean"
               classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly">
@@ -594,6 +595,7 @@
               localHomeInterface="org.apache.openejb.test.stateless.BasicStatelessLocalHome"
               localInterface="org.apache.openejb.test.stateless.BasicStatelessLocalObject"
               businessLocalInterface="org.apache.openejb.test.stateless.BasicStatelessBusinessLocal"
+              businessRemoteInterface="org.apache.openejb.test.stateless.BasicStatelessBusinessRemote"
               beanClass="org.apache.openejb.test.stateless.BasicStatelessPojoBean"
               classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly">

Modified: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulBusinessLocal.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulBusinessLocal.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulBusinessLocal.java
(original)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulBusinessLocal.java
Tue Oct 17 22:25:26 2006
@@ -35,6 +35,8 @@
      */
     public String businessMethod(String text);
 
+    public Object echo(Object object);
+
     /**
      * Throws an ApplicationException when invoked
      *

Added: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulBusinessRemote.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulBusinessRemote.java?view=auto&rev=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulBusinessRemote.java
(added)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulBusinessRemote.java
Tue Oct 17 22:25:26 2006
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.test.stateful;
+
+import org.apache.openejb.test.ApplicationException;
+import org.apache.openejb.test.object.OperationsPolicy;
+
+import java.util.Properties;
+
+/**
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public interface BasicStatefulBusinessRemote {
+
+    /**
+     * Reverses the string passed in then returns it
+     *
+     * @return string
+     */
+    public String businessMethod(String text);
+
+    public Object echo(Object object);
+
+    /**
+     * Throws an ApplicationException when invoked
+     *
+     */
+    public void throwApplicationException() throws ApplicationException;
+
+    /**
+     * Throws a java.lang.NullPointerException when invoked
+     * This is a system exception and should result in the
+     * destruction of the instance and invalidation of the
+     * remote reference.
+     *
+     */
+    public void throwSystemException_NullPointer();
+
+    /**
+     * Returns a report of the bean's
+     * runtime permissions
+     *
+     * @return properties
+     */
+    public Properties getPermissionsReport();
+
+    /**
+     * Returns a report of the allowed opperations
+     * for one of the bean's methods.
+     *
+     * @param methodName The method for which to get the allowed opperations report
+     * @return operations policy
+     */
+    public OperationsPolicy getAllowedOperationsReport(String methodName);
+}

Modified: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulPojoBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulPojoBean.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulPojoBean.java
(original)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/BasicStatefulPojoBean.java
Tue Oct 17 22:25:26 2006
@@ -32,7 +32,7 @@
  * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
  * @author <a href="mailto:nour.mohammad@gmail.com">Mohammad Nour El-Din</a>
  */
-public class BasicStatefulPojoBean implements BasicStatefulBusinessLocal {
+public class BasicStatefulPojoBean implements BasicStatefulBusinessLocal, BasicStatefulBusinessRemote
{
 
     /**
      * Maps to BasicStatelessObject.businessMethod
@@ -45,6 +45,9 @@
         return b.reverse().toString();
     }
 
+    public Object echo(Object object) {
+        return object;
+    }
 
     /**
      * Throws an ApplicationException when invoked

Modified: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulLocalBusinessIntfcTests.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulLocalBusinessIntfcTests.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulLocalBusinessIntfcTests.java
(original)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulLocalBusinessIntfcTests.java
Tue Oct 17 22:25:26 2006
@@ -50,6 +50,14 @@
         } catch (Exception e){
             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
         }
+
+        try{
+            Integer expected = new Integer(42);
+            Object actual = businessLocal.echo(expected);
+            assertSame("pass by reference", expected, actual);
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
     }
 
     /**

Modified: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulLocalTestSuite.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulLocalTestSuite.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulLocalTestSuite.java
(original)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulLocalTestSuite.java
Tue Oct 17 22:25:26 2006
@@ -38,6 +38,7 @@
         suite.addTest(new StatefulPojoLocalJndiTests());
         suite.addTest(new StatefulHomeIntfcTests());
         suite.addTest(new StatefulLocalBusinessIntfcTests());
+        suite.addTest(new StatefulRemoteBusinessIntfcTests());
         suite.addTest(new StatefulEjbHomeTests());
         suite.addTest(new StatefulEjbObjectTests());
         suite.addTest(new StatefulRemoteIntfcTests());

Added: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulRemoteBusinessIntfcTests.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulRemoteBusinessIntfcTests.java?view=auto&rev=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulRemoteBusinessIntfcTests.java
(added)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulRemoteBusinessIntfcTests.java
Tue Oct 17 22:25:26 2006
@@ -0,0 +1,134 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.test.stateful;
+
+/**
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public class StatefulRemoteBusinessIntfcTests extends StatefulTestClient {
+    private BasicStatefulBusinessRemote businessRemote;
+
+    public StatefulRemoteBusinessIntfcTests(){
+        super("RemoteBusinessIntfc.");
+    }
+
+    protected void setUp() throws Exception{
+        super.setUp();
+    }
+
+    //=================================
+    // Test remote interface methods
+    //
+    public void test00_lookupBusinessInterface() throws Exception {
+        Object obj = initialContext.lookup("client/tests/stateful/BasicStatefulPojoHomeBusinessRemote");
+        assertNotNull(obj);
+        assertTrue("instance of BasicStatefulBusinessRemote", obj instanceof BasicStatefulBusinessRemote);
+        businessRemote = (BasicStatefulBusinessRemote) obj;
+    }
+
+    public void test01_businessMethod(){
+        try{
+            String expected = "Success";
+            String actual = businessRemote.businessMethod("sseccuS");
+            assertEquals(expected, actual);
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+
+        try{
+            Integer expected = new Integer(42);
+            Object actual = businessRemote.echo(expected);
+            assertEquals(expected, actual);
+            assertNotSame("pass by value", expected, actual);
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    /**
+     * Throw an application exception and make sure the exception
+     * reaches the bean nicely.
+     */
+    public void test02_throwApplicationException(){
+        try{
+            businessRemote.throwApplicationException();
+        } catch (org.apache.openejb.test.ApplicationException e){
+            //Good.  This is the correct behaviour
+            return;
+        } catch (Throwable e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+        fail("An ApplicationException should have been thrown.");
+    }
+
+    /**
+     * After an application exception we should still be able to
+     * use our bean
+     */
+    public void test03_invokeAfterApplicationException(){
+        try{
+            String expected = "Success";
+            String actual   = businessRemote.businessMethod("sseccuS");
+            assertEquals(expected, actual);
+        } catch (Throwable e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    // TODO: check which exception should be thrown
+    public void _test04_throwSystemException(){
+        try{
+            businessRemote.throwSystemException_NullPointer();
+        } catch (Exception e){
+            //Good, so far.
+            Throwable n = e.getCause();
+            assertNotNull("Nested exception should not be is null", n );
+            assertTrue("Nested exception should be an instance of NullPointerException, but
exception is "+n.getClass().getName(), (n instanceof NullPointerException));
+            return;
+        } catch (Throwable e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+        fail("A NullPointerException should have been thrown.");
+    }
+
+    /**
+     * After a system exception the intance should be garbage collected
+     * and the remote reference should be invalidated.
+     *
+     * This one seems to fail. we should double-check the spec on this.
+     */
+    //TODO: implement
+    public void TODO_test05_invokeAfterSystemException(){
+//        try{
+//        businessRemote.businessMethod("This refernce is invalid");
+//        fail("A java.rmi.NoSuchObjectException should have been thrown.");
+//        } catch (java.rmi.NoSuchObjectException e){
+//            // Good.
+//        } catch (Throwable e){
+//            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+//        }
+    }
+    //
+    // Test remote interface methods
+    //=================================
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+}

Modified: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulTestSuite.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulTestSuite.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulTestSuite.java
(original)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateful/StatefulTestSuite.java
Tue Oct 17 22:25:26 2006
@@ -35,8 +35,9 @@
         suite.addTest(new StatefulJndiTests());
         suite.addTest(new StatefulPojoRemoteJndiTests());
         suite.addTest(new StatefulHomeIntfcTests());
+        suite.addTest(new StatefulRemoteBusinessIntfcTests());
         suite.addTest(new StatefulEjbHomeTests());
-        suite.addTest(new StatefulEjbObjectTests());    
+        suite.addTest(new StatefulEjbObjectTests());
         suite.addTest(new StatefulRemoteIntfcTests());
         suite.addTest(new StatefulHomeHandleTests());
         suite.addTest(new StatefulHandleTests());

Modified: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessBusinessLocal.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessBusinessLocal.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessBusinessLocal.java
(original)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessBusinessLocal.java
Tue Oct 17 22:25:26 2006
@@ -35,6 +35,8 @@
      */
     public String businessMethod(String text);
 
+    public Object echo(Object object);
+
     /**
      * Throws an ApplicationException when invoked
      *

Added: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessBusinessRemote.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessBusinessRemote.java?view=auto&rev=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessBusinessRemote.java
(added)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessBusinessRemote.java
Tue Oct 17 22:25:26 2006
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.test.stateless;
+
+import org.apache.openejb.test.ApplicationException;
+import org.apache.openejb.test.object.OperationsPolicy;
+
+import java.util.Properties;
+
+/**
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public interface BasicStatelessBusinessRemote {
+
+    /**
+     * Reverses the string passed in then returns it
+     *
+     * @return string
+     */
+    public String businessMethod(String text);
+
+    public Object echo(Object object);
+
+    /**
+     * Throws an ApplicationException when invoked
+     *
+     */
+    public void throwApplicationException() throws ApplicationException;
+
+    /**
+     * Throws a java.lang.NullPointerException when invoked
+     * This is a system exception and should result in the
+     * destruction of the instance and invalidation of the
+     * remote reference.
+     *
+     */
+    public void throwSystemException_NullPointer();
+
+    /**
+     * Returns a report of the bean's
+     * runtime permissions
+     *
+     * @return properties
+     */
+    public Properties getPermissionsReport();
+
+    /**
+     * Returns a report of the allowed opperations
+     * for one of the bean's methods.
+     *
+     * @param methodName The method for which to get the allowed opperations report
+     * @return operations policy
+     */
+    public OperationsPolicy getAllowedOperationsReport(String methodName);
+}

Modified: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessPojoBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessPojoBean.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessPojoBean.java
(original)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/BasicStatelessPojoBean.java
Tue Oct 17 22:25:26 2006
@@ -24,7 +24,7 @@
 import java.util.Properties;
 import java.rmi.RemoteException;
 
-public class BasicStatelessPojoBean implements BasicStatelessBusinessLocal{
+public class BasicStatelessPojoBean implements BasicStatelessBusinessLocal, BasicStatelessBusinessRemote
{
 
     /**
      * Maps to BasicStatelessObject.businessMethod
@@ -37,6 +37,9 @@
         return b.reverse().toString();
     }
 
+    public Object echo(Object object) {
+        return object;
+    }
 
     /**
      * Throws an ApplicationException when invoked

Modified: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java
(original)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessLocalBusinessIntfcTests.java
Tue Oct 17 22:25:26 2006
@@ -50,6 +50,14 @@
         } catch (Exception e){
             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
         }
+
+        try{
+            Integer expected = new Integer(42);
+            Object actual = businessLocal.echo(expected);
+            assertSame("pass by reference", expected, actual);
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
     }
 
     /**

Modified: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java
(original)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessLocalTestSuite.java
Tue Oct 17 22:25:26 2006
@@ -39,6 +39,7 @@
         suite.addTest(new StatelessHomeIntfcTests());
         suite.addTest(new StatelessPojoLocalHomeIntfcTests());
         suite.addTest(new StatelessLocalBusinessIntfcTests());
+        suite.addTest(new StatelessRemoteBusinessIntfcTests());
         suite.addTest(new StatelessEjbHomeTests() );
         suite.addTest(new StatelessEjbObjectTests());
         suite.addTest(new StatelessRemoteIntfcTests());

Added: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessRemoteBusinessIntfcTests.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessRemoteBusinessIntfcTests.java?view=auto&rev=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessRemoteBusinessIntfcTests.java
(added)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessRemoteBusinessIntfcTests.java
Tue Oct 17 22:25:26 2006
@@ -0,0 +1,134 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.test.stateless;
+
+/**
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public class StatelessRemoteBusinessIntfcTests extends StatelessTestClient {
+    private BasicStatelessBusinessRemote businessRemote;
+
+    public StatelessRemoteBusinessIntfcTests(){
+        super("RemoteBusinessIntfc.");
+    }
+
+    protected void setUp() throws Exception{
+        super.setUp();
+    }
+
+    //=================================
+    // Test remote interface methods
+    //
+    public void test00_lookupBusinessInterface() throws Exception {
+        Object obj = initialContext.lookup("client/tests/stateless/BasicStatelessPojoHomeBusinessRemote");
+        assertNotNull(obj);
+        assertTrue("instance of BasicStatelessBusinessRemote", obj instanceof BasicStatelessBusinessRemote);
+        businessRemote = (BasicStatelessBusinessRemote) obj;
+    }
+
+    public void test01_businessMethod(){
+        try{
+            String expected = "Success";
+            String actual = businessRemote.businessMethod("sseccuS");
+            assertEquals(expected, actual);
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+
+        try{
+            Integer expected = new Integer(42);
+            Object actual = businessRemote.echo(expected);
+            assertEquals(expected, actual);
+            assertNotSame("pass by value", expected, actual);
+        } catch (Exception e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    /**
+     * Throw an application exception and make sure the exception
+     * reaches the bean nicely.
+     */
+    public void test02_throwApplicationException(){
+        try{
+            businessRemote.throwApplicationException();
+        } catch (org.apache.openejb.test.ApplicationException e){
+            //Good.  This is the correct behaviour
+            return;
+        } catch (Throwable e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+        fail("An ApplicationException should have been thrown.");
+    }
+
+    /**
+     * After an application exception we should still be able to
+     * use our bean
+     */
+    public void test03_invokeAfterApplicationException(){
+        try{
+            String expected = "Success";
+            String actual   = businessRemote.businessMethod("sseccuS");
+            assertEquals(expected, actual);
+        } catch (Throwable e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+    }
+
+    // TODO: check which exception should be thrown
+    public void _test04_throwSystemException(){
+        try{
+            businessRemote.throwSystemException_NullPointer();
+        } catch (Exception e){
+            //Good, so far.
+            Throwable n = e.getCause();
+            assertNotNull("Nested exception should not be is null", n );
+            assertTrue("Nested exception should be an instance of NullPointerException, but
exception is "+n.getClass().getName(), (n instanceof NullPointerException));
+            return;
+        } catch (Throwable e){
+            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+        }
+        fail("A NullPointerException should have been thrown.");
+    }
+
+    /**
+     * After a system exception the intance should be garbage collected
+     * and the remote reference should be invalidated.
+     *
+     * This one seems to fail. we should double-check the spec on this.
+     */
+    //TODO: implement
+    public void TODO_test05_invokeAfterSystemException(){
+//        try{
+//        businessRemote.businessMethod("This refernce is invalid");
+//        fail("A java.rmi.NoSuchObjectException should have been thrown.");
+//        } catch (java.rmi.NoSuchObjectException e){
+//            // Good.
+//        } catch (Throwable e){
+//            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
+//        }
+    }
+    //
+    // Test remote interface methods
+    //=================================
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+}

Modified: incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java
(original)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/java/org/apache/openejb/test/stateless/StatelessTestSuite.java
Tue Oct 17 22:25:26 2006
@@ -30,12 +30,14 @@
         super(name);
     }
 
+
     public static junit.framework.Test suite() {
         TestSuite suite = new TestSuite();
         suite.addTest(new StatelessJndiTests());
         suite.addTest(new StatelessPojoRemoteJndiTests());
         suite.addTest(new StatelessHomeIntfcTests());
         suite.addTest(new StatelessPojoHomeIntfcTests());
+        suite.addTest(new StatelessRemoteBusinessIntfcTests());
         suite.addTest(new StatelessEjbHomeTests() );
         suite.addTest(new StatelessEjbObjectTests());    
         suite.addTest(new StatelessRemoteIntfcTests());

Modified: incubator/openejb/trunk/openejb3/openejb-itests/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/openejb-itests/src/main/resources/META-INF/ejb-jar.xml?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/openejb-itests/src/main/resources/META-INF/ejb-jar.xml
(original)
+++ incubator/openejb/trunk/openejb3/openejb-itests/src/main/resources/META-INF/ejb-jar.xml
Tue Oct 17 22:25:26 2006
@@ -263,6 +263,7 @@
             <local>org.apache.openejb.test.stateful.BasicStatefulLocalObject</local>
             <ejb-class>org.apache.openejb.test.stateful.BasicStatefulPojoBean</ejb-class>
             <business-local>org.apache.openejb.test.stateful.BasicStatefulBusinessLocal</business-local>
+            <business-remote>org.apache.openejb.test.stateful.BasicStatefulBusinessRemote</business-remote>
             <session-type>Stateful</session-type>
             <transaction-type>Container</transaction-type>
             <security-role-ref>
@@ -507,6 +508,7 @@
             <local-home>org.apache.openejb.test.stateless.BasicStatelessLocalHome</local-home>
             <local>org.apache.openejb.test.stateless.BasicStatelessLocalObject</local>
             <business-local>org.apache.openejb.test.stateless.BasicStatelessBusinessLocal</business-local>
+            <business-remote>org.apache.openejb.test.stateless.BasicStatelessBusinessRemote</business-remote>
             <ejb-class>org.apache.openejb.test.stateless.BasicStatelessPojoBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>

Modified: incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java
(original)
+++ incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java
Tue Oct 17 22:25:26 2006
@@ -145,6 +145,15 @@
 
     }
 
+    private Object createBusinessObject(Object result) {
+        Object[] data = (Object[]) result;
+        EJBMetaDataImpl ejb = (EJBMetaDataImpl) data[0];
+        Object primaryKey = data[1];
+
+        EJBObjectHandler handler = EJBObjectHandler.createEJBObjectHandler(ejb, server, client,
primaryKey);
+        return handler.createEJBObjectProxy();
+    }
+
     public Object lookup(String name) throws NamingException {
 
         if (name == null) throw new InvalidNameException("The name cannot be null");
@@ -167,6 +176,9 @@
             case JNDI_EJBHOME:
 
                 return createEJBHomeProxy((EJBMetaDataImpl) res.getResult());
+
+            case JNDI_BUSINESS_OBJECT:
+                return createBusinessObject(res.getResult());
 
             case JNDI_OK:
                 return res.getResult();

Modified: incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIResponse.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIResponse.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIResponse.java
(original)
+++ incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIResponse.java
Tue Oct 17 22:25:26 2006
@@ -53,6 +53,7 @@
         responseCode = in.readByte();
 
         switch (responseCode) {
+            case JNDI_BUSINESS_OBJECT:
             case JNDI_OK:
             case JNDI_NAMING_EXCEPTION:
             case JNDI_RUNTIME_EXCEPTION:
@@ -75,6 +76,7 @@
         out.writeByte((byte) responseCode);
 
         switch (responseCode) {
+            case JNDI_BUSINESS_OBJECT:
             case JNDI_OK:
             case JNDI_NAMING_EXCEPTION:
             case JNDI_RUNTIME_EXCEPTION:

Modified: incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ResponseCodes.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ResponseCodes.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ResponseCodes.java
(original)
+++ incubator/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/ResponseCodes.java
Tue Oct 17 22:25:26 2006
@@ -38,5 +38,6 @@
     public static final int JNDI_RUNTIME_EXCEPTION = 18;
     public static final int JNDI_ERROR = 19;
     public static final int EJB_OK_FOUND_ENUMERATION = 20;
+    public static final int JNDI_BUSINESS_OBJECT = 21;
 }
 

Modified: incubator/openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java?view=diff&rev=465148&r1=465147&r2=465148
==============================================================================
--- incubator/openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java
(original)
+++ incubator/openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java
Tue Oct 17 22:25:26 2006
@@ -24,6 +24,12 @@
 import javax.naming.NamingException;
 
 import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.ProxyInfo;
+import org.apache.openejb.util.proxy.ProxyManager;
+import org.apache.openejb.core.ivm.EjbObjectProxyHandler;
+import org.apache.openejb.core.ivm.EjbHomeProxyHandler;
+import org.apache.openejb.core.ivm.BaseEjbProxyHandler;
+import org.apache.openejb.core.ivm.IntraVmProxy;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.spi.ContainerSystem;
 import org.apache.openejb.client.EJBMetaDataImpl;
@@ -35,11 +41,11 @@
 class JndiRequestHandler implements ResponseCodes, RequestMethods {
     private final EjbDaemon daemon;
 
-    javax.naming.Context clientJndi;
+    javax.naming.Context ejbJndiTree;
 
     JndiRequestHandler(EjbDaemon daemon) throws Exception {
         ContainerSystem containerSystem = (ContainerSystem) SystemInstance.get().getComponent(ContainerSystem.class);
-        clientJndi = (javax.naming.Context) containerSystem.getJNDIContext().lookup("openejb/ejb");
+        ejbJndiTree = (javax.naming.Context) containerSystem.getJNDIContext().lookup("openejb/ejb");
         this.daemon = daemon;
     }
 
@@ -51,34 +57,99 @@
         String name = req.getRequestString();
         if (name.startsWith("/")) name = name.substring(1);
 
-        DeploymentInfo deployment = daemon.deploymentIndex.getDeployment(name);
-
-        if (deployment == null) {
-            try {
-                Object obj = clientJndi.lookup(name);
-
-                if (obj instanceof Context) {
-                    res.setResponseCode(JNDI_CONTEXT);
-                } else
-                    res.setResponseCode(JNDI_NOT_FOUND);
-
-            } catch (NameNotFoundException e) {
-                res.setResponseCode(JNDI_NOT_FOUND);
-            } catch (NamingException e) {
-                res.setResponseCode(JNDI_NAMING_EXCEPTION);
-                res.setResult(e);
+        Object object = null;
+        try {
+            object = ejbJndiTree.lookup(name);
+
+            if (object instanceof Context) {
+                res.setResponseCode(JNDI_CONTEXT);
+                res.writeExternal(out);
+                return;
+            } else if (object == null) {
+                throw new NullPointerException("lookup of '"+name+"' returned null");
             }
-        } else {
+        } catch (NameNotFoundException e) {
+            res.setResponseCode(JNDI_NOT_FOUND);
+            res.writeExternal(out);
+            return;
+        } catch (NamingException e) {
+            res.setResponseCode(JNDI_NAMING_EXCEPTION);
+            res.setResult(e);
+            res.writeExternal(out);
+            return;
+        }
+
+
+        BaseEjbProxyHandler handler = null;
+        try {
+            handler = (BaseEjbProxyHandler) ProxyManager.getInvocationHandler(object);
+        } catch (ClassCastException e) {
+            res.setResponseCode(JNDI_NAMING_EXCEPTION);
+            res.setResult(new NamingException("Expected an ejb proxy, found unknown object:
type="+object.getClass().getName() + ", toString="+object));
+        }
+
+        ProxyInfo proxyInfo = handler.getProxyInfo();
+        DeploymentInfo deployment = proxyInfo.getDeploymentInfo();
+        String deploymentID = deployment.getDeploymentID().toString();
+
+        //DMB: HACK as proxyInfo.getInterface() reports the wrong interface, will fix that
next.
+        //Class interfce = proxyInfo.getInterface();
+        Class interfce = getProxyInterface(object);
+
+        if (handler instanceof EjbHomeProxyHandler && interfce.isAssignableFrom(deployment.getHomeInterface())){
             res.setResponseCode(JNDI_EJBHOME);
             EJBMetaDataImpl metaData = new EJBMetaDataImpl(deployment.getHomeInterface(),
                     deployment.getRemoteInterface(),
                     deployment.getPrimaryKeyClass(),
                     deployment.getComponentType(),
-                    deployment.getDeploymentID().toString(),
-                    this.daemon.deploymentIndex.getDeploymentIndex(name));
+                    deploymentID,
+                    this.daemon.deploymentIndex.getDeploymentIndex(deploymentID));
             res.setResult(metaData);
+        } else if (handler instanceof EjbHomeProxyHandler && interfce.isAssignableFrom(deployment.getLocalHomeInterface())){
+            res.setResponseCode(JNDI_NAMING_EXCEPTION);
+            res.setResult(new NamingException("Not remotable: '"+name+"'. EJBLocalHome interfaces
are not remotable as per the EJB specification."));
+        } else if (handler instanceof EjbObjectProxyHandler && interfce.isAssignableFrom(deployment.getBusinessRemoteInterface())){
+            res.setResponseCode(JNDI_BUSINESS_OBJECT);
+            EJBMetaDataImpl metaData = new EJBMetaDataImpl(null,
+                    deployment.getBusinessRemoteInterface(),
+                    deployment.getPrimaryKeyClass(),
+                    deployment.getComponentType(),
+                    deploymentID,
+                    this.daemon.deploymentIndex.getDeploymentIndex(deploymentID));
+            Object[] data = {metaData, proxyInfo.getPrimaryKey()};
+            res.setResult(data);
+        } else if (handler instanceof EjbObjectProxyHandler && interfce.isAssignableFrom(deployment.getBusinessLocalInterface())){
+            String property = SystemInstance.get().getProperty("openejb.businessLocal", "remotable");
+            if (property.equalsIgnoreCase("remotable")) {
+                res.setResponseCode(JNDI_BUSINESS_OBJECT);
+                EJBMetaDataImpl metaData = new EJBMetaDataImpl(null,
+                        deployment.getBusinessLocalInterface(),
+                        deployment.getPrimaryKeyClass(),
+                        deployment.getComponentType(),
+                        deploymentID,
+                        this.daemon.deploymentIndex.getDeploymentIndex(deploymentID));
+                Object[] data = {metaData, proxyInfo.getPrimaryKey()};
+                res.setResult(data);
+            } else {
+                res.setResponseCode(JNDI_NAMING_EXCEPTION);
+                res.setResult(new NamingException("Not remotable: '"+name+"'. Business Local
interfaces are not remotable as per the EJB specification.  To disable this restriction, set
the system property 'openejb.businessLocal=remotable' in the server."));
+            }
+        } else {
+            res.setResponseCode(JNDI_NAMING_EXCEPTION);
+            res.setResult(new NamingException("Not remotable: '"+name+"'."));
         }
 
         res.writeExternal(out);
+    }
+
+    private Class getProxyInterface(Object proxy) {
+        Class[] interfaces = proxy.getClass().getInterfaces();
+        for (int i = 0; i < interfaces.length; i++) {
+            Class clazz = interfaces[i];
+            if (!IntraVmProxy.class.isAssignableFrom(clazz)){
+                return clazz;
+            }
+        }
+        throw new IllegalStateException("Invalid Proxy.  Cannot determine interface.");
     }
 }



Mime
View raw message