Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 11532 invoked from network); 20 Sep 2005 03:05:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Sep 2005 03:05:01 -0000 Received: (qmail 62467 invoked by uid 500); 20 Sep 2005 03:04:58 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 62404 invoked by uid 500); 20 Sep 2005 03:04:57 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 62391 invoked by uid 500); 20 Sep 2005 03:04:57 -0000 Received: (qmail 62388 invoked by uid 99); 20 Sep 2005 03:04:57 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 19 Sep 2005 20:04:57 -0700 Received: (qmail 10936 invoked by uid 65534); 20 Sep 2005 03:04:27 -0000 Message-ID: <20050920030427.10935.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r290337 - /jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SessionBeanProvider.java Date: Tue, 20 Sep 2005 03:04:26 -0000 To: commons-cvs@jakarta.apache.org From: jcarman@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org