vmassol     02/04/20 12:46:27

  Modified:    anttasks/src/java/org/apache/cactus/ant ResinRun.java
  Log:
  added support for Resin 2.1
  
  Revision  Changes    Path
  1.3       +28 -5     
jakarta-cactus/anttasks/src/java/org/apache/cactus/ant/ResinRun.java
  
  Index: ResinRun.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/anttasks/src/java/org/apache/cactus/ant/ResinRun.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResinRun.java     19 Mar 2002 10:40:35 -0000      1.2
  +++ ResinRun.java     20 Apr 2002 19:46:27 -0000      1.3
  @@ -58,6 +58,7 @@
   
   import java.lang.reflect.Constructor;
   import java.lang.reflect.Method;
  +import java.util.ArrayList;
   
   /**
    * Starts/stop Resin by setting up a listener socket.
  @@ -65,7 +66,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Vincent Massol</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Robert Leftwich</a>
    *
  - * @version $Id: ResinRun.java,v 1.2 2002/03/19 10:40:35 vmassol Exp $
  + * @version $Id: ResinRun.java,v 1.3 2002/04/20 19:46:27 vmassol Exp $
    * @see AbstractServerRun
    */
   public class ResinRun extends AbstractServerRun
  @@ -109,14 +110,36 @@
                   new Class[]{this.args.getClass(), boolean.class});
               this.resinServer = constructor.newInstance(
                   new Object[]{this.args, new Boolean(true)});
  -            Method initMethod = resinClass.getMethod("init",
  -                new Class[]{boolean.class});
  -            initMethod.invoke(this.resinServer, new Object[]{
  -                new Boolean(true)});
  +
  +            // Try Resin 2.0 first
  +            try {
  +                startResin20(resinServer, resinClass);
  +            } catch (NoSuchMethodException nsme) {
  +                // Try Resin 2.1
  +                startResin21(resinServer, resinClass);
  +            }
  +
           } catch (Exception e) {
               e.printStackTrace();
               throw new RuntimeException("Cannot create instance of ResinServer");
           }
  +    }
  +
  +    private void startResin20(Object resinServer, Class resinClass)
  +        throws Exception
  +    {
  +        Method initMethod = resinClass.getMethod("init",
  +            new Class[]{boolean.class});
  +        initMethod.invoke(resinServer, new Object[]{
  +            new Boolean(true)});
  +    }
  +
  +    private void startResin21(Object resinServer, Class resinClass)
  +        throws Exception
  +    {
  +        Method initMethod = resinClass.getMethod("init",
  +            new Class[]{ArrayList.class});
  +        initMethod.invoke(resinServer, new Object[]{ null });
       }
   
       /**
  
  
  

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

Reply via email to