From d4bf78d25251786e26d7c10c0aa0e95ab69203d7 Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Sat, 2 Feb 2002 05:50:22 +0000 Subject: [PATCH] Dont reference DefaultEmbeddor directly but via reflection so that the frontend is not directly referencing any objects in component hierarchy. Detected by JDepend git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271058 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/myrmidon/frontends/CLIMain.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java b/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java index d9cb8499c..e458c79b2 100644 --- a/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java +++ b/proposal/myrmidon/src/java/org/apache/myrmidon/frontends/CLIMain.java @@ -30,7 +30,6 @@ import org.apache.log.format.PatternFormatter; 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 @@ public class CLIMain 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 @@ public class CLIMain "org.apache.myrmidon.components.executor.PrintingExecutor" ); } - final Embeddor embeddor = new DefaultEmbeddor(); + final Embeddor embeddor = createEmbeddor(); setupLogger( embeddor ); embeddor.parameterize( m_parameters ); embeddor.initialize(); @@ -404,6 +404,13 @@ public class CLIMain embeddor.dispose(); } + private Embeddor createEmbeddor() + throws Exception + { + final Class clazz = Class.forName( DEFAULT_EMBEDDOR_CLASS ); + return (Embeddor)clazz.newInstance(); + } + /** * Actually do the build. *