dion 2003/08/03 21:30:39 Modified: src/java/org/apache/maven/plugin PluginManager.java Log: Refactor werkz project creation into helper method Revision Changes Path 1.61 +25 -11 maven/src/java/org/apache/maven/plugin/PluginManager.java Index: PluginManager.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/PluginManager.java,v retrieving revision 1.60 retrieving revision 1.61 diff -u -r1.60 -r1.61 --- PluginManager.java 4 Aug 2003 02:41:10 -0000 1.60 +++ PluginManager.java 4 Aug 2003 04:30:39 -0000 1.61 @@ -369,18 +369,10 @@ buildAntProject( project, baseContext ); Session session = getJellySession(baseContext); - // add the global session to the pluginContext so that it can be used by tags baseContext.setVariable( GLOBAL_SESSION_KEY, session ); - // We put in our listener to frob the session. - MavenAttainGoalListener listener = new MavenAttainGoalListener(); - listener.setBaseContext( baseContext ); - listener.setPluginManager( this ); - - WerkzProject werkzProject = new WerkzProject(); - werkzProject.addAttainGoalListener( listener ); - baseContext.setWerkzProject( werkzProject ); + WerkzProject werkzProject = buildWerkzProject( baseContext ); // ------------------------------------------------------------------------------------------------------------- // Execution of the Jelly scripts: @@ -407,6 +399,8 @@ //mapper.parse( new InputStreamReader( driver ), driverHousing ); //runJellyScriptHousing( driverHousing, baseContext ); + // FIXME: Part of this belongs as a method on Project, e.g. the name and + // construction of maven.xml // Project's Jelly script if ( project.getFile() != null ) { @@ -423,8 +417,11 @@ } // Parent's Jelly script + // FIXME: What about further up the chain? if ( project.hasParent() ) { + // FIXME: this is a badly named method + File f = project.parentMavenXml(); if ( f.exists() ) @@ -478,6 +475,23 @@ } /** + * + * @param context the base context for the werkz project + * @return a configured werkz project + */ + private WerkzProject buildWerkzProject(MavenJellyContext context) + { + // We put in our listener to frob the session. + MavenAttainGoalListener listener = new MavenAttainGoalListener(); + listener.setBaseContext( context ); + listener.setPluginManager( this ); + WerkzProject werkzProject = new WerkzProject(); + werkzProject.addAttainGoalListener( listener ); + context.setWerkzProject( werkzProject ); + return werkzProject; + } + + /** * Get the Werkz Session * FIXME: Describe what it's for? * @param baseContext the maven context the session should use @@ -606,7 +620,7 @@ * @return an Ant project * @throws Exception When any error occurs. FIXME this is bad. */ - public GrantProject buildAntProject( Project project, MavenJellyContext context ) + private GrantProject buildAntProject( Project project, MavenJellyContext context ) throws Exception { // Create the build listener.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]