Author: jcarman
Date: Mon Sep 19 20:04:23 2005
New Revision: 290337

URL: http://svn.apache.org/viewcvs?rev=290337&view=rev
Log:
Added support for custom JNDI properties.

Modified:
    
jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SessionBeanProvider.java

Modified: 
jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SessionBeanProvider.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SessionBeanProvider.java?rev=290337&r1=290336&r2=290337&view=diff
==============================================================================
--- 
jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SessionBeanProvider.java
 (original)
+++ 
jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SessionBeanProvider.java
 Mon Sep 19 20:04:23 2005
@@ -24,6 +24,7 @@
 import javax.rmi.PortableRemoteObject;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.Properties;
 
 /**
  * Provides a reference to a session bean by looking up the home object and 
calling (via reflection) the no-argument
@@ -41,6 +42,7 @@
     private final String jndiName;
     private final Class serviceInterface;
     private final Class homeInterface;
+    private final Properties properties;
 
 
//----------------------------------------------------------------------------------------------------------------------
 // Constructors
@@ -51,6 +53,15 @@
         this.jndiName = jndiName;
         this.serviceInterface = serviceInterface;
         this.homeInterface = homeInterface;
+        this.properties = null;
+    }
+
+    public SessionBeanProvider( String jndiName, Class serviceInterface, Class 
homeInterface, Properties properties )
+    {
+        this.jndiName = jndiName;
+        this.serviceInterface = serviceInterface;
+        this.homeInterface = homeInterface;
+        this.properties = properties;
     }
 
 
//----------------------------------------------------------------------------------------------------------------------
@@ -61,7 +72,8 @@
     {
         try
         {
-            Object homeObject = PortableRemoteObject.narrow( new 
InitialContext().lookup( jndiName ), homeInterface );
+            final InitialContext initialContext = properties == null ? new 
InitialContext() : new InitialContext( properties );
+            Object homeObject = PortableRemoteObject.narrow( 
initialContext.lookup( jndiName ), homeInterface );
             final Method createMethod = homeObject.getClass().getMethod( 
"create" );
             return serviceInterface.cast( createMethod.invoke( homeObject ) );
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to