You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@apache.org on 2002/02/02 06:50:22 UTC

cvs commit: jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends CLIMain.java

donaldp     02/02/01 21:50:22

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/frontends
                        CLIMain.java
  Log:
  Dont reference DefaultEmbeddor directly but via reflection so that the frontend is not directly referencing any objects in component hierarchy.
  
  Detected by JDepend
  
  Revision  Changes    Path
  1.20      +9 -2      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java
  
  Index: CLIMain.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- CLIMain.java	28 Jan 2002 09:22:30 -0000	1.19
  +++ CLIMain.java	2 Feb 2002 05:50:22 -0000	1.20
  @@ -30,7 +30,6 @@
   import org.apache.log.output.io.StreamTarget;
   import org.apache.myrmidon.Constants;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.myrmidon.components.embeddor.DefaultEmbeddor;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
   import org.apache.myrmidon.interfaces.executor.Executor;
   import org.apache.myrmidon.interfaces.model.Project;
  @@ -50,6 +49,7 @@
       private final static Resources REZ =
           ResourceManager.getPackageResources( CLIMain.class );
   
  +    private final String DEFAULT_EMBEDDOR_CLASS = "org.apache.myrmidon.components.embeddor.DefaultEmbeddor";
       private final static String PATTERN = "[%8.8{category}] %{message}\\n%{throwable}";
   
       //defines for the Command Line options
  @@ -356,7 +356,7 @@
                                          "org.apache.myrmidon.components.executor.PrintingExecutor" );
           }
   
  -        final Embeddor embeddor = new DefaultEmbeddor();
  +        final Embeddor embeddor = createEmbeddor();
           setupLogger( embeddor );
           embeddor.parameterize( m_parameters );
           embeddor.initialize();
  @@ -402,6 +402,13 @@
   
           embeddor.stop();
           embeddor.dispose();
  +    }
  +
  +    private Embeddor createEmbeddor()
  +        throws Exception
  +    {
  +        final Class clazz = Class.forName( DEFAULT_EMBEDDOR_CLASS );
  +        return (Embeddor)clazz.newInstance();
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>