ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces EmbeddedAnt.java
Date Fri, 19 Apr 2002 12:09:55 GMT
adammurdoch    02/04/19 05:09:55

  Modified:    container/src/java/org/apache/myrmidon/frontends
                        CLIMain.java
               container/src/java/org/apache/myrmidon/interfaces
                        EmbeddedAnt.java
  Log:
  Have to pass the container classloader to EmbeddedAnt, now that it is no longer
  part of the container.
  
  Revision  Changes    Path
  1.41      +4 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/frontends/CLIMain.java
  
  Index: CLIMain.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/frontends/CLIMain.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- CLIMain.java	14 Apr 2002 08:47:26 -0000	1.40
  +++ CLIMain.java	19 Apr 2002 12:09:55 -0000	1.41
  @@ -34,7 +34,7 @@
    * to run project.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.40 $ $Date: 2002/04/14 08:47:26 $
  + * @version $Revision: 1.41 $ $Date: 2002/04/19 12:09:55 $
    */
   public class CLIMain
   {
  @@ -347,9 +347,11 @@
                                                   "org.apache.myrmidon.components.executor.PrintingExecutor"
);
               }
   
  -            // Set the common classloader
  +            // Set the common and container classloaders
               final ClassLoader sharedClassLoader = (ClassLoader)properties.get( "myrmidon.shared.classloader"
);
               m_embedded.setSharedClassLoader( sharedClassLoader );
  +            final ClassLoader containerClassLoader = (ClassLoader)properties.get( "myrmidon.container.classloader"
);
  +            m_embedded.setContainerClassLoader( containerClassLoader );
   
               //loop over build if we are in incremental mode..
               if( !m_incremental )
  
  
  
  1.2       +20 -2     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/EmbeddedAnt.java
  
  Index: EmbeddedAnt.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/EmbeddedAnt.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EmbeddedAnt.java	14 Apr 2002 08:47:26 -0000	1.1
  +++ EmbeddedAnt.java	19 Apr 2002 12:09:55 -0000	1.2
  @@ -40,7 +40,7 @@
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.1 $ $Date: 2002/04/14 08:47:26 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/19 12:09:55 $
    */
   public class EmbeddedAnt
       extends AbstractLogEnabled
  @@ -63,6 +63,7 @@
       private Embeddor m_embeddor;
       private File m_homeDir;
       private String m_projectType;
  +    private ClassLoader m_containerClassLoader;
   
       /**
        * Sets the Myrmidon home directory.  Default is to use the current
  @@ -161,6 +162,15 @@
       }
   
       /**
  +     * Sets the container classloader, which is used to load the task engine.
  +     * Default is to use the context classloader.
  +     */
  +    public void setContainerClassLoader( final ClassLoader classLoader )
  +    {
  +        m_containerClassLoader = classLoader;
  +    }
  +
  +    /**
        * Executes a set of targets in the project.  This method may be called
        * multiple times.
        */
  @@ -303,7 +313,15 @@
       private Embeddor createEmbeddor()
           throws Exception
       {
  -        final Class clazz = Class.forName( DEFAULT_EMBEDDOR_CLASS );
  +        final Class clazz;
  +        if( m_containerClassLoader != null )
  +        {
  +            clazz = m_containerClassLoader.loadClass( DEFAULT_EMBEDDOR_CLASS );
  +        }
  +        else
  +        {
  +            clazz = Thread.currentThread().getContextClassLoader().loadClass( DEFAULT_EMBEDDOR_CLASS
);
  +        }
           return (Embeddor)clazz.newInstance();
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message