incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: incubator-altrmi/server/impl/src/java/org/apache/altrmi/server/impl/callback CallbackHelperImpl.java
Date Fri, 05 Sep 2003 16:21:46 GMT
hammant     2003/09/05 09:21:46

  Modified:    client/impl/src/java/org/apache/altrmi/client/impl/callback/stream
                        CallbackEnabledClientCustomStreamReadWriter.java
               common/src/java/org/apache/altrmi/common ClassFoo.java
               server/api/src/java/org/apache/altrmi/server
                        CallbackHelper.java
               server/impl/src/java/org/apache/altrmi/server/impl/callback
                        CallbackHelperImpl.java
  Log:
  ClassFoo downsized a little
  
  Revision  Changes    Path
  1.3       +10 -9     incubator-altrmi/client/impl/src/java/org/apache/altrmi/client/impl/callback/stream/CallbackEnabledClientCustomStreamReadWriter.java
  
  Index: CallbackEnabledClientCustomStreamReadWriter.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/client/impl/src/java/org/apache/altrmi/client/impl/callback/stream/CallbackEnabledClientCustomStreamReadWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CallbackEnabledClientCustomStreamReadWriter.java	5 Sep 2003 08:14:30 -0000	1.2
  +++ CallbackEnabledClientCustomStreamReadWriter.java	5 Sep 2003 16:21:46 -0000	1.3
  @@ -138,17 +138,18 @@
           // for the server to make callbacks upon.
           ServerMonitor serverMonitor = callbackHelper.createServerMonitor();
   
  -        // replace remaining ClassFoo method invocations.
  -        ServerSideClientContextFactory serverSideClientContextFactory = (ServerSideClientContextFactory)
ClassFoo.instantiate("org.apache.altrmi.server.impl.DefaultServerSideClientContextFactory");
  -        Authenticator authenticator = (Authenticator) ClassFoo.instantiate("org.apache.altrmi.server.impl.DefaultAuthenticator");
  +        ServerSideClientContextFactory serverSideClientContextFactory = callbackHelper.createServerSideClientContextFactory();
  +
  +        Authenticator authenticator = callbackHelper.createAuthenticator();
   
           //System.out.println("1 " + PlainClassRetriever.class.getClassLoader());
           //System.out.println("2 " + ClassFoo.class.getClassLoader());
  -        ClassRetriever classRetriever = (ClassRetriever) ClassFoo.instantiate("org.apache.altrmi.server.impl.classretrievers.PlainClassRetriever",
ClassLoader.class.getName(), this.getClass().getClassLoader());
  -        m_clientServerHostingExposedObjects = (Server) ClassFoo.instantiate("org.apache.altrmi.server.impl.direct.DirectServer",
  -            new String[]{ClassRetriever.class.getName(), Authenticator.class.getName(),
ServerMonitor.class.getName(), ThreadPool.class.getName(), ServerSideClientContextFactory.class.getName()},
  -            new Object[]{classRetriever, authenticator, serverMonitor,
  -                         threadPool, serverSideClientContextFactory});
  +        ClassRetriever classRetriever = callbackHelper.createClassRetriever(this.getClass().getClassLoader());
  +
  +        m_clientServerHostingExposedObjects = callbackHelper.createServer(classRetriever,
authenticator, serverMonitor,
  +                         threadPool, serverSideClientContextFactory);
  +
  +
           try {
               m_clientServerHostingExposedObjects.start();
           } catch (ServerException e) {
  
  
  
  1.3       +0 -27     incubator-altrmi/common/src/java/org/apache/altrmi/common/ClassFoo.java
  
  Index: ClassFoo.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/common/src/java/org/apache/altrmi/common/ClassFoo.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClassFoo.java	5 Sep 2003 08:14:30 -0000	1.2
  +++ ClassFoo.java	5 Sep 2003 16:21:46 -0000	1.3
  @@ -54,9 +54,6 @@
    */
   package org.apache.altrmi.common;
   
  -import java.lang.reflect.Constructor;
  -import java.lang.reflect.InvocationTargetException;
  -
   public class ClassFoo {
       public static Object instantiate(String className) {
           try {
  @@ -68,30 +65,6 @@
               throw new AltrmiRuntimeException("InstantiationException",e);
           } catch (IllegalAccessException e) {
               throw new AltrmiRuntimeException("IllegalAccessException",e);
  -        }
  -    }
  -    public static Object instantiate(String className, String param, Object arg) {
  -        return instantiate(className, new String[] {param}, new Object[] {arg});
  -    }
  -    public static Object instantiate(String className, String[] params, Object[] args)
{
  -        Class[] paramz = new Class[params.length];
  -        try {
  -            for (int i = 0; i < params.length; i++) {
  -                paramz[i] = Class.forName(params[i]);
  -            }
  -            Class clazz = Class.forName(className, true, ClassFoo.class.getClassLoader());
  -            Constructor ctor = clazz.getConstructor(paramz);
  -            return ctor.newInstance(args);
  -        } catch (ClassNotFoundException e) {
  -            throw new AltrmiRuntimeException("Class Not Found",e);
  -        } catch (InstantiationException e) {
  -            throw new AltrmiRuntimeException("InstantiationException",e);
  -        } catch (IllegalAccessException e) {
  -            throw new AltrmiRuntimeException("IllegalAccessException",e);
  -        } catch (NoSuchMethodException e) {
  -            throw new AltrmiRuntimeException("NoSuchMethodException",e);
  -        } catch (InvocationTargetException e) {
  -            throw new AltrmiRuntimeException("InvocationTargetException",e);
           }
       }
   }
  
  
  
  1.2       +10 -0     incubator-altrmi/server/api/src/java/org/apache/altrmi/server/CallbackHelper.java
  
  Index: CallbackHelper.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/server/api/src/java/org/apache/altrmi/server/CallbackHelper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CallbackHelper.java	5 Sep 2003 08:14:30 -0000	1.1
  +++ CallbackHelper.java	5 Sep 2003 16:21:46 -0000	1.2
  @@ -1,6 +1,16 @@
   package org.apache.altrmi.server;
   
  +import org.apache.altrmi.common.ThreadPool;
  +
   public interface CallbackHelper {
   
       ServerMonitor createServerMonitor();
  +
  +    ServerSideClientContextFactory createServerSideClientContextFactory();
  +
  +    Authenticator createAuthenticator();
  +
  +    ClassRetriever createClassRetriever(ClassLoader classLoader);
  +
  +    Server createServer(ClassRetriever classRetriever, Authenticator authenticator, ServerMonitor
serverMonitor, ThreadPool threadPool, ServerSideClientContextFactory serverSideClientContextFactory);
   }
  
  
  
  1.3       +25 -0     incubator-altrmi/server/impl/src/java/org/apache/altrmi/server/impl/callback/CallbackHelperImpl.java
  
  Index: CallbackHelperImpl.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/server/impl/src/java/org/apache/altrmi/server/impl/callback/CallbackHelperImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CallbackHelperImpl.java	5 Sep 2003 08:15:15 -0000	1.2
  +++ CallbackHelperImpl.java	5 Sep 2003 16:21:46 -0000	1.3
  @@ -2,12 +2,37 @@
   
   import org.apache.altrmi.server.ServerMonitor;
   import org.apache.altrmi.server.CallbackHelper;
  +import org.apache.altrmi.server.ServerSideClientContextFactory;
  +import org.apache.altrmi.server.Authenticator;
  +import org.apache.altrmi.server.ClassRetriever;
  +import org.apache.altrmi.server.Server;
   import org.apache.altrmi.server.impl.NullServerMonitor;
  +import org.apache.altrmi.server.impl.DefaultServerSideClientContextFactory;
  +import org.apache.altrmi.server.impl.DefaultAuthenticator;
  +import org.apache.altrmi.server.impl.direct.DirectServer;
  +import org.apache.altrmi.server.impl.classretrievers.PlainClassRetriever;
  +import org.apache.altrmi.common.ThreadPool;
   
   public class CallbackHelperImpl implements CallbackHelper {
   
       public ServerMonitor createServerMonitor() {
           return new NullServerMonitor();
  +    }
  +
  +    public ServerSideClientContextFactory createServerSideClientContextFactory() {
  +        return new DefaultServerSideClientContextFactory();
  +    }
  +
  +    public Authenticator createAuthenticator() {
  +        return new DefaultAuthenticator();
  +    }
  +
  +    public ClassRetriever createClassRetriever(ClassLoader classLoader) {
  +        return new PlainClassRetriever(classLoader);
  +    }
  +
  +    public Server createServer(ClassRetriever classRetriever, Authenticator authenticator,
ServerMonitor serverMonitor, ThreadPool threadPool, ServerSideClientContextFactory serverSideClientContextFactory)
{
  +        return new DirectServer(classRetriever, authenticator, serverMonitor, threadPool,
serverSideClientContextFactory);
       }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message