hammant 02/03/12 03:26:49 Modified: altrmi/src/java/org/apache/commons/altrmi/client AltrmiInterfaceLookupFactory.java altrmi/src/java/org/apache/commons/altrmi/client/impl AbstractFactoryHelper.java AbstractInterfaceLookupFactory.java altrmi/src/java/org/apache/commons/altrmi/client/impl/naming DefaultAltrmiContext.java altrmi/src/java/org/apache/commons/altrmi/client/impl/rmi RmiFactoryHelper.java RmiHostContext.java altrmi/src/java/org/apache/commons/altrmi/client/impl/socket SocketCustomStreamFactoryHelper.java SocketObjectStreamFactoryHelper.java Log: Changes to help JNDI lookup in servlets Revision Changes Path 1.2 +20 -2 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/AltrmiInterfaceLookupFactory.java Index: AltrmiInterfaceLookupFactory.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/AltrmiInterfaceLookupFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AltrmiInterfaceLookupFactory.java 5 Mar 2002 16:30:17 -0000 1.1 +++ AltrmiInterfaceLookupFactory.java 12 Mar 2002 11:26:48 -0000 1.2 @@ -1,5 +1,7 @@ package org.apache.commons.altrmi.client; + + import org.apache.commons.altrmi.common.AltrmiConnectionException; @@ -8,7 +10,7 @@ * * * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> - * @version * $Revision: 1.1 $ + * @version * $Revision: 1.2 $ */ public interface AltrmiInterfaceLookupFactory { @@ -32,5 +34,21 @@ * @return * */ - AltrmiInterfaceLookup getAltrmiInterfaceLookup(String factoryString) throws AltrmiConnectionException; + AltrmiInterfaceLookup getAltrmiInterfaceLookup(String factoryString) + throws AltrmiConnectionException; + + /** + * Method getAltrmiInterfaceLookup + * + * + * @param factoryString + * @param interfacesClassLoader + * + * @return + * + * @throws AltrmiConnectionException + * + */ + AltrmiInterfaceLookup getAltrmiInterfaceLookup( + String factoryString, ClassLoader interfacesClassLoader) throws AltrmiConnectionException; } 1.2 +19 -1 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractFactoryHelper.java Index: AbstractFactoryHelper.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractFactoryHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AbstractFactoryHelper.java 5 Mar 2002 16:30:17 -0000 1.1 +++ AbstractFactoryHelper.java 12 Mar 2002 11:26:48 -0000 1.2 @@ -12,6 +12,8 @@ import org.apache.commons.altrmi.client.AltrmiFactory; import org.apache.commons.altrmi.client.AltrmiInterfaceLookupFactory; +import org.apache.commons.altrmi.client.AltrmiInterfaceLookup; +import org.apache.commons.altrmi.common.AltrmiConnectionException; import java.util.Vector; import java.util.StringTokenizer; @@ -22,7 +24,7 @@ * * * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public abstract class AbstractFactoryHelper implements AltrmiInterfaceLookupFactory { @@ -51,5 +53,21 @@ } else { return null; } + } + + /** + * Method getAltrmiInterfaceLookup + * + * + * @param factoryString + * + * @return + * + * @throws AltrmiConnectionException + * + */ + public final AltrmiInterfaceLookup getAltrmiInterfaceLookup(String factoryString) + throws AltrmiConnectionException { + return getAltrmiInterfaceLookup(factoryString, this.getClass().getClassLoader()); } } 1.2 +8 -4 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractInterfaceLookupFactory.java Index: AbstractInterfaceLookupFactory.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractInterfaceLookupFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AbstractInterfaceLookupFactory.java 5 Mar 2002 16:30:17 -0000 1.1 +++ AbstractInterfaceLookupFactory.java 12 Mar 2002 11:26:48 -0000 1.2 @@ -22,7 +22,7 @@ * * * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public class AbstractInterfaceLookupFactory implements AltrmiInterfaceLookupFactory { @@ -43,15 +43,19 @@ * @throws AltrmiConnectionException * */ - public AltrmiInterfaceLookup getAltrmiInterfaceLookup(String factoryString) + public final AltrmiInterfaceLookup getAltrmiInterfaceLookup(String factoryString) throws AltrmiConnectionException { + return getAltrmiInterfaceLookup(factoryString, this.getClass().getClassLoader()); + } + public AltrmiInterfaceLookup getAltrmiInterfaceLookup( + String factoryString, ClassLoader interfacesClassLoader) throws AltrmiConnectionException { for (int i = 0; i < factories.size(); i++) { Factory factory = (Factory) factories.elementAt(i); if (factoryString.startsWith(factory.factoryStringPrefix)) { return factory.altrmiInterfaceLookupFactory - .getAltrmiInterfaceLookup(factoryString); + .getAltrmiInterfaceLookup(factoryString, interfacesClassLoader); } } @@ -63,7 +67,7 @@ * * * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ private class Factory { 1.4 +8 -2 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/naming/DefaultAltrmiContext.java Index: DefaultAltrmiContext.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/naming/DefaultAltrmiContext.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DefaultAltrmiContext.java 11 Mar 2002 10:04:55 -0000 1.3 +++ DefaultAltrmiContext.java 12 Mar 2002 11:26:48 -0000 1.4 @@ -29,7 +29,7 @@ * * * @author Vinay Chandrasekharan <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ */ public class DefaultAltrmiContext implements Context { @@ -54,6 +54,7 @@ String proxyDetails = null; String beanDetails = null; + ClassLoader interfacesClassLoader = null; proxyDetails = (String) env.get("proxy.type"); if (proxyDetails == null) { @@ -78,6 +79,11 @@ throw new NamingException("proxy.type should be 'BeanOnly' or 'NotBeanOnly', you specified " + beanDetails); } + interfacesClassLoader = (ClassLoader) env.get("interfaces.classloader"); + if (interfacesClassLoader == null) { + interfacesClassLoader = this.getClass().getClassLoader(); + } + try { //System.out.println("iurl[" + transportStream + ":" + host + ":" + port + ":" // + proxyDetails + ":" + beanDetails + "]"); @@ -86,7 +92,7 @@ altrmiInterfaceLookupFactory.getAltrmiInterfaceLookup(transportStream + ":" + host + ":" + port + ":" + proxyDetails + ":" - + beanDetails); + + beanDetails,interfacesClassLoader); } catch (AltrmiConnectionException ace) { ace.printStackTrace(); 1.2 +2 -1 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/rmi/RmiFactoryHelper.java Index: RmiFactoryHelper.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/rmi/RmiFactoryHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- RmiFactoryHelper.java 6 Mar 2002 16:11:02 -0000 1.1 +++ RmiFactoryHelper.java 12 Mar 2002 11:26:49 -0000 1.2 @@ -27,7 +27,7 @@ * * * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public class RmiFactoryHelper extends AbstractFactoryHelper { @@ -36,11 +36,12 @@ * * * @param factoryString + * @param interfacesClassLoader * * @return * */ - public AltrmiInterfaceLookup getAltrmiInterfaceLookup(String factoryString) + public AltrmiInterfaceLookup getAltrmiInterfaceLookup(String factoryString, ClassLoader interfacesClassLoader) throws AltrmiConnectionException { // TODO maybe we should cache these. Or the abstract parent class should. 1.2 +3 -1 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/rmi/RmiHostContext.java Index: RmiHostContext.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/rmi/RmiHostContext.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- RmiHostContext.java 21 Jan 2002 15:38:20 -0000 1.1 +++ RmiHostContext.java 12 Mar 2002 11:26:49 -0000 1.2 @@ -19,9 +19,11 @@ * * * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public class RmiHostContext extends AbstractHostContext { + + //TODO constr with classloader /** * Constructor RmiHostContext 1.2 +8 -4 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketCustomStreamFactoryHelper.java Index: SocketCustomStreamFactoryHelper.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketCustomStreamFactoryHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SocketCustomStreamFactoryHelper.java 6 Mar 2002 16:11:02 -0000 1.1 +++ SocketCustomStreamFactoryHelper.java 12 Mar 2002 11:26:49 -0000 1.2 @@ -27,27 +27,31 @@ * * * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public class SocketCustomStreamFactoryHelper extends AbstractFactoryHelper { + + /** * Method getAltrmiInterfaceLookup * * * @param factoryString + * @param interfacesClassLoader * * @return * */ - public AltrmiInterfaceLookup getAltrmiInterfaceLookup(String factoryString) - throws AltrmiConnectionException { + public AltrmiInterfaceLookup getAltrmiInterfaceLookup( + String factoryString, ClassLoader interfacesClassLoader) + throws AltrmiConnectionException { // TODO maybe we should cache these. Or the abstract parent class should. - String[] terms = processFactoryString(factoryString); AltrmiHostContext hc = new SocketCustomStreamHostContext(terms[1], - Integer.parseInt(terms[2])); + Integer.parseInt(terms[2]), + interfacesClassLoader); AltrmiFactory af = createAltrmiFactory(terms[3], terms[4].equalsIgnoreCase("bo")); try { 1.3 +4 -3 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketObjectStreamFactoryHelper.java Index: SocketObjectStreamFactoryHelper.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/socket/SocketObjectStreamFactoryHelper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SocketObjectStreamFactoryHelper.java 6 Mar 2002 16:11:02 -0000 1.2 +++ SocketObjectStreamFactoryHelper.java 12 Mar 2002 11:26:49 -0000 1.3 @@ -27,7 +27,7 @@ * * * @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ public class SocketObjectStreamFactoryHelper extends AbstractFactoryHelper { @@ -36,18 +36,19 @@ * * * @param factoryString + * @param interfacesClassLoader * * @return * */ - public AltrmiInterfaceLookup getAltrmiInterfaceLookup(String factoryString) + public AltrmiInterfaceLookup getAltrmiInterfaceLookup(String factoryString, ClassLoader interfacesClassLoader) throws AltrmiConnectionException { // TODO maybe we should cache these. Or the abstract parent class should. String[] terms = processFactoryString(factoryString); AltrmiHostContext hc = new SocketObjectStreamHostContext(terms[1], - Integer.parseInt(terms[2])); + Integer.parseInt(terms[2]),interfacesClassLoader); AltrmiFactory af = createAltrmiFactory(terms[3], terms[4].equalsIgnoreCase("bo")); try {
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>