You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ni...@apache.org on 2004/05/22 09:39:02 UTC
svn commit: rev 20208 - avalon/trunk/tools/magic/java/src/dist
Author: niclas
Date: Sat May 22 00:39:01 2004
New Revision: 20208
Modified:
avalon/trunk/tools/magic/java/src/dist/build.bsh
Log:
Fixed the Java plugin against the new AbstractPlugin way of simplified plugin structure.
Modified: avalon/trunk/tools/magic/java/src/dist/build.bsh
==============================================================================
--- avalon/trunk/tools/magic/java/src/dist/build.bsh (original)
+++ avalon/trunk/tools/magic/java/src/dist/build.bsh Sat May 22 00:39:01 2004
@@ -4,6 +4,7 @@
import java.util.ArrayList;
import java.util.Iterator;
+import org.apache.merlin.magic.AbstractPlugin;
import org.apache.merlin.magic.Plugin;
import org.apache.merlin.magic.PluginContext;
@@ -18,56 +19,30 @@
import org.apache.tools.ant.taskdefs.Copy;
import org.apache.tools.ant.taskdefs.Javac;
-public class JavacPlugin extends AbstractLogEnabled
+public class JavacPlugin extends AbstractPlugin
implements Plugin, Contextualizable
{
- private PluginContext m_PluginContext;
-
private Project m_Project;
- private ArrayList m_CompileListeners;
-
private boolean m_Compiled = false;
- public void contextualize( Context ctx )
- {
- m_PluginContext = (PluginContext) ctx;
- m_Project = m_PluginContext.getAntProject();
- }
-
public void compile()
{
if( m_Compiled )
return;
- notifyPreCompile();
+ notifyPreMethod( "compile" );
copySources();
- notifyPrepareCompile();
+ notifyStep( "compile", "sources-copied" );
executeCompile();
- notifyPostCompile();
+ notifyPostMethod( "compile" );
m_Compiled = true;
}
- public void addCompileListener( CompileListener listener )
- {
- if( m_CompileListeners == null )
- {
- m_CompileListeners = new ArrayList();
- }
- m_CompileListeners.add( listener );
- }
-
- public void removeCompileListener( CompileListener listener )
- {
- if( m_CompileListeners == null )
- return;
- m_CompileListeners.remove( listener );
- }
-
private void copySources()
{
- String destdirname = m_PluginContext.getProperty( "java.build.src.dir" );
+ String destdirname = m_Context.getProperty( "java.build.src.dir" );
File toDir = new File( destdirname );
- String srcdirname = m_PluginContext.getProperty( "java.src.dir" );
+ String srcdirname = m_Context.getProperty( "java.src.dir" );
File fromDir = new File( srcdirname );
FileSet from = new FileSet();
@@ -84,14 +59,14 @@
private void executeCompile()
{
- String destdirname = m_PluginContext.getProperty( "java.build.dest.dir" );
+ String destdirname = m_Context.getProperty( "java.build.dest.dir" );
File toDir = new File( destdirname );
toDir.mkdirs();
- String srcdirname = m_PluginContext.getProperty( "java.build.src.dir" );
+ String srcdirname = m_Context.getProperty( "java.build.src.dir" );
File fromDir = new File( srcdirname );
- String classpath = m_PluginContext.getProperty( "java.class.path" );
+ String classpath = m_Context.getProperty( "java.class.path" );
Javac javac = (Javac) m_Project.createTask( "javac" );
/* Set the destination */
@@ -112,50 +87,5 @@
javac.init();
javac.execute();
- }
-
- private void notifyPreCompile()
- {
- if( m_CompileListeners == null )
- return;
- Iterator list = m_CompileListeners.iterator();
- while( list.hasNext() )
- {
- CompileListener listener = (CompileListener) list.next();
- listener.preCompile();
- }
- }
-
- private void notifyPrepareCompile()
- {
- if( m_CompileListeners == null )
- return;
- Iterator list = m_CompileListeners.iterator();
- while( list.hasNext() )
- {
- CompileListener listener = (CompileListener) list.next();
- listener.prepareCompile();
- }
- }
-
- private void notifyPostCompile()
- {
- if( m_CompileListeners == null )
- return;
- Iterator list = m_CompileListeners.iterator();
- while( list.hasNext() )
- {
- CompileListener listener = (CompileListener) list.next();
- listener.postCompile();
- }
- }
-
- public interface CompileListener
- {
- void preCompile();
-
- void prepareCompile();
-
- void postCompile();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org