brett       2004/02/07 13:57:37

  Modified:    src/java/org/apache/maven/jelly Tag: MAVEN-1_0-BRANCH
                        MavenJellyContext.java
               src/java/org/apache/maven/jelly/tags/werkz Tag:
                        MAVEN-1_0-BRANCH MavenAttainGoalTag.java
               src/java/org/apache/maven/plugin Tag: MAVEN-1_0-BRANCH
                        GoalToJellyScriptHousingMapper.java
                        JellyPlugin.java JellyScriptHousing.java
                        PluginManager.java PluginScriptParser.java
  Log:
  clean up
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.35.4.2  +1 -3      maven/src/java/org/apache/maven/jelly/MavenJellyContext.java
  
  Index: MavenJellyContext.java
  ===================================================================
  RCS file: /home/cvs/maven/src/java/org/apache/maven/jelly/MavenJellyContext.java,v
  retrieving revision 1.35.4.1
  retrieving revision 1.35.4.2
  diff -u -r1.35.4.1 -r1.35.4.2
  --- MavenJellyContext.java    2 Dec 2003 04:09:25 -0000       1.35.4.1
  +++ MavenJellyContext.java    7 Feb 2004 21:57:37 -0000       1.35.4.2
  @@ -687,12 +687,10 @@
       }
   
       /**
  -     * @todo [RC2] - can remove?
        * @see JellyContext#setParent(JellyContext)
        */
       public void setParent(JellyContext context)
       {
           super.setParent(context);
       }
  -
   }
  
  
  
  No                   revision
  No                   revision
  1.2.2.4   +4 -4      
maven/src/java/org/apache/maven/jelly/tags/werkz/Attic/MavenAttainGoalTag.java
  
  Index: MavenAttainGoalTag.java
  ===================================================================
  RCS file: 
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/werkz/Attic/MavenAttainGoalTag.java,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- MavenAttainGoalTag.java   28 Jan 2004 08:02:02 -0000      1.2.2.3
  +++ MavenAttainGoalTag.java   7 Feb 2004 21:57:37 -0000       1.2.2.4
  @@ -114,9 +114,9 @@
       {
           if ( this.session == null )
           {
  -            /*  TODO [RC2]: this is for compatibility - do we want the user to 
request a new session instead? 
  -                            eg force=true on the tag
  -                            not great to tie variables to session if we are 
creating a new one */
  +            /*  TODO: this is for compatibility - do we want the user to request a 
new session instead? 
  +                      eg force=true on the tag
  +                      not great to tie variables to session if we are creating a 
new one */
               Session session = ( Session ) getContext().getVariable( 
PluginManager.GLOBAL_SESSION_KEY );
               this.session = new JellySession( ( ( MavenJellyContext ) getContext() 
).getXMLOutput() );
               for ( Iterator i = session.getAttributes().keySet().iterator(); 
i.hasNext(); )
  
  
  
  No                   revision
  No                   revision
  1.3.4.7   +6 -4      
maven/src/java/org/apache/maven/plugin/Attic/GoalToJellyScriptHousingMapper.java
  
  Index: GoalToJellyScriptHousingMapper.java
  ===================================================================
  RCS file: 
/home/cvs/maven/src/java/org/apache/maven/plugin/Attic/GoalToJellyScriptHousingMapper.java,v
  retrieving revision 1.3.4.6
  retrieving revision 1.3.4.7
  diff -u -r1.3.4.6 -r1.3.4.7
  --- GoalToJellyScriptHousingMapper.java       2 Feb 2004 22:48:26 -0000       1.3.4.6
  +++ GoalToJellyScriptHousingMapper.java       7 Feb 2004 21:57:37 -0000       1.3.4.7
  @@ -350,9 +350,7 @@
               pluginSet.addAll( decorators );
           }
   
  -        // TODO [RC2]: inline this?
  -        Set a = resolveDynaTagPlugins( pluginSet );
  -        pluginSet.addAll( a );
  +        pluginSet.addAll( resolveDynaTagPlugins( pluginSet ) );
   
           // Here we make the resolved plugins field be the full set of plugins, and 
the plugins returned just the
           // additional ones resolved.
  @@ -407,7 +405,6 @@
        * 
        * @param plugins the plugins containing tags
        * @return the plugins providing tags
  -     * @todo [RC2] - can "seen" be put outside j loop?
        */
       private Set resolveDynaTagPlugins( Set plugins )
       {
  @@ -480,6 +477,11 @@
           {
               getPluginDynaTagDeps( getJellyScriptHousing() ).add( uri );
           }
  +    }
  +
  +    void addPluginDynaTagDep( JellyScriptHousing housing, String uri )
  +    {
  +        getPluginDynaTagDeps( housing ).add( uri );
       }
   
       /**
  
  
  
  1.3.4.6   +2 -2      maven/src/java/org/apache/maven/plugin/Attic/JellyPlugin.java
  
  Index: JellyPlugin.java
  ===================================================================
  RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/Attic/JellyPlugin.java,v
  retrieving revision 1.3.4.5
  retrieving revision 1.3.4.6
  diff -u -r1.3.4.5 -r1.3.4.6
  --- JellyPlugin.java  2 Feb 2004 22:48:27 -0000       1.3.4.5
  +++ JellyPlugin.java  7 Feb 2004 21:57:37 -0000       1.3.4.6
  @@ -77,7 +77,7 @@
       /** Logger. */
       private static final Log log = LogFactory.getLog( JellyPlugin.class );
   
  -    /** the directory the plugin is installed into. @todo [RC2] - needed? */
  +    /** the directory the plugin is installed into. */
       private File directory;
   
       /** the project.xml file for the plugin */
  
  
  
  1.3.4.5   +4 -5      
maven/src/java/org/apache/maven/plugin/Attic/JellyScriptHousing.java
  
  Index: JellyScriptHousing.java
  ===================================================================
  RCS file: 
/home/cvs/maven/src/java/org/apache/maven/plugin/Attic/JellyScriptHousing.java,v
  retrieving revision 1.3.4.4
  retrieving revision 1.3.4.5
  diff -u -r1.3.4.4 -r1.3.4.5
  --- JellyScriptHousing.java   29 Jan 2004 01:04:15 -0000      1.3.4.4
  +++ JellyScriptHousing.java   7 Feb 2004 21:57:37 -0000       1.3.4.5
  @@ -22,7 +22,7 @@
       /** Jelly Script. */
       private Script script;
   
  -    /** the source of the jelly script. @todo [RC2] not always set correctly */
  +    /** the source of the jelly script. */
       private File source;
   
       private ForeheadClassLoader pluginClassLoader;
  @@ -85,15 +85,14 @@
       private Script getScript(PluginManager manager)
           throws Exception
       {
  -        // TODO [RC2]: needs refactoring - don't do it all here
  +        // TODO [1.0]: needs refactoring - don't do it all here
           if (script != null)
           {
               return script;
           }
   
           if (source != null && source.exists()) {
  -            // TODO [RC2]: use a compilation context?
  -            // TODO [RC2]: this currently duplicates createJellyScriptHousing for 
others - it is the lazy version
  +            // TODO [1.0]: this currently duplicates createJellyScriptHousing for 
others - it is the lazy version
               //pluginClassLoader = new ForeheadClassLoader( 
project.getContext().getClassLoader(), project.getId() );
               pluginClassLoader = (ForeheadClassLoader) 
project.getContext().getClassLoader();
   
  
  
  
  1.70.4.14 +23 -56    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.70.4.13
  retrieving revision 1.70.4.14
  diff -u -r1.70.4.13 -r1.70.4.14
  --- PluginManager.java        2 Feb 2004 22:48:27 -0000       1.70.4.13
  +++ PluginManager.java        7 Feb 2004 21:57:37 -0000       1.70.4.14
  @@ -147,10 +147,13 @@
       public static final String PLUGIN_MANAGER = "maven.plugin.manager";
       public static final String GOAL_MAPPER = "maven.plugin.mapper";
   
  -    /** The directory where plugin jars reside under Maven's home. @todo refactor 
away  [RC2] */
  +    /** */
  +    public static final String BASE_CONTEXT = "maven.goalAttainmentContext";
  +
  +    /** The directory where plugin jars reside under Maven's home. @todo refactor 
away  [1.0] */
       private File pluginsDir;
   
  -    /** The directory where the plugin jars are unpacked to. @todo refactor away 
[RC2] */
  +    /** The directory where the plugin jars are unpacked to. @todo refactor away 
[1.0] */
       private File unpackedPluginsDir;
   
       /** This contains a map of plugins, keyed by id. */
  @@ -171,13 +174,13 @@
       /** Goal to Plugins mapper. */
       private final GoalToJellyScriptHousingMapper mapper = new 
GoalToJellyScriptHousingMapper();
   
  -    /** Is the plugin manager initialized. @todo refactor away [RC2]. */
  +    /** Is the plugin manager initialized. @todo refactor away [1.0]. */
       private boolean initialized = false;
   
  -    /** rootClassLoader classloader. @todo refactor away [RC2] */
  +    /** rootClassLoader classloader. @todo refactor away [1.0] */
       private final ForeheadClassLoader rootClassLoader;
   
  -    /** maven.rootClassLoader classloader. @todo refactor away? [RC2] */
  +    /** maven.rootClassLoader classloader. @todo refactor away? [1.0] */
       private final ForeheadClassLoader mavenRootClassLoader;
   
       /** Plugins to be popped afterwards. @todo refactor out */
  @@ -242,7 +245,7 @@
           {
               File pluginDir = files[i];
   
  -            // TODO [RC2]: put descriptor / loading logic into JellyPlugin
  +            // TODO [1.0]: put descriptor / loading logic into JellyPlugin
               if ( pluginDir.isDirectory() && new File( pluginDir, "project.xml" 
).exists() )
               {
                   loadPlugin( pluginDir );
  @@ -254,7 +257,7 @@
        * Initialize all plugins.
        * 
        * @throws Exception If an error occurs while initializing any plugin.
  -     * @todo [RC2] refactor into constructor
  +     * @todo [1.0] refactor into constructor
        */
       public void initialize() throws Exception
       {
  @@ -342,14 +345,14 @@
        * @param jelly                   
        * @return 
        * @throws Exception 
  -     * @todo [RC2] refactor into housing
  +     * @todo [1.0] refactor into housing
        * @deprecated get rid of this - it duplicates functionality in the housing
        */
       private JellyScriptHousing createJellyScriptHousing( Project project, 
InputStream jelly ) throws Exception
       {
           JellyScriptHousing jellyScriptHousing = new JellyScriptHousing();
   
  -        // TODO [RC2]: this is processing the loaded project, and hence all project 
dependencies - move it?
  +        // TODO [1.0]: this is processing the loaded project, and hence all project 
dependencies - move it?
           ForeheadClassLoader classLoader = new ForeheadClassLoader( 
mavenRootClassLoader, project.getId() );
   
           // We will add the JARs that have been instructed to be place in the class 
loader
  @@ -373,14 +376,14 @@
        * @param classesDirectory 
        * @param jelly            
        * @return 
  -     * @todo [RC2] into the housing?
  +     * @todo [1.0] into the housing?
        */
       private JellyScriptHousing createJellyScriptHousing( Project project, File 
jelly )
               throws Exception
       {
           JellyScriptHousing jellyScriptHousing = new JellyScriptHousing();
   
  -        // TOOD [RC2]: isn't this all redundant processing?
  +        // TOOD [1.0]: isn't this all redundant processing?
           ForeheadClassLoader classLoader = new ForeheadClassLoader( 
mavenRootClassLoader, project.getId() );
   
           // We will add the JARs that have been instructed to be place in the class 
loader
  @@ -460,11 +463,6 @@
           project.getContext().setClassLoader( projectClassLoader );
       }
   
  -    //TODO [RC2] are these all needed?
  -
  -    /** */
  -    public static final String BASE_CONTEXT = "maven.goalAttainmentContext";
  -
       /**
        * Attain the goals.
        * 
  @@ -491,9 +489,7 @@
           // Set up the ant project.
           AntProjectBuilder.build( project, baseContext );
   
  -        // TODO [RC2] - I think this needs to be reverted afterwards (antTagLibrary)
  -
  -        // TODO [RC2]: shouldn't this be a stack too? Then session attribute not 
needed
  +        // TODO [1.0]: shouldn't this be a stack too? Then session attribute not 
needed
           GoalToJellyScriptHousingMapper transientMapper = new 
GoalToJellyScriptHousingMapper();
   
           // Create the Jelly session
  @@ -526,7 +522,7 @@
           // driver.jelly
           InputStream driver = getClass().getResourceAsStream( "/driver.jelly" );
           JellyScriptHousing driverHousing = createJellyScriptHousing( project, 
driver );
  -        // TODO [RC2] stop reading all scripts 2 times
  +        // TODO [1.0] stop reading all scripts 2 times
           driver.close();
           driver = getClass().getResourceAsStream( "/driver.jelly" );
           transientMapper.parse( driver, driverHousing );
  @@ -541,7 +537,7 @@
               File mavenXml = p.getMavenXml();
   
               JellyScriptHousing jellyScriptHousing = createJellyScriptHousing( p, 
mavenXml );
  -            // TODO [RC2] stop reading all scripts 2 times
  +            // TODO [1.0] stop reading all scripts 2 times
               transientMapper.parse( new FileInputStream( mavenXml ), 
jellyScriptHousing );
               projectHousings.add( jellyScriptHousing );
   
  @@ -563,7 +559,7 @@
               goals = Collections.EMPTY_LIST;
           }
   
  -        // TODO [RC2]: any reason not to do this at the start?
  +        // TODO [1.0]: any reason not to do this at the start?
           transientMapper.merge( mapper );
   
           Thread.currentThread().setContextClassLoader( null );
  @@ -641,18 +637,16 @@
   
               // FIXME: this is a bit nasty
               File pluginDirectory = housing.getProject().getFile().getParentFile();
  -            // TODO [RC2] - integrate into original pluginContext
  +            // TODO [1.0] - integrate into original pluginContext
               MavenUtils.integrateMapInContext( getPluginProperties( pluginDirectory 
), baseContext );
   
  -            // TODO [RC2]: necessary to create a new one every time?
  -            // TODO [RC2]: this is looking messy: refactor
  +            // TODO [1.0]: necessary to create a new one every time?
               MavenJellyContext pluginContext = new MavenJellyContext( baseContext );
               housing.getProject().pushContext( pluginContext );
  -            // TODO [RC2] - process in project dependencies here instead?
               pluginContext.setInherit( true );
               pluginContext.setVariable( "context", pluginContext );
   
  -            // TODO [RC2] - integrate into original pluginContext
  +            // TODO [1.0] - integrate into original pluginContext
               pluginContext.setVariable( "plugin", housing.getProject() );
               pluginContext.setVariable( "plugin.dir", pluginDirectory );
               pluginContext.setVariable( "plugin.resources", new File( 
pluginDirectory, "plugin-resources" ) );
  @@ -817,7 +811,7 @@
       }
   
       /**
  -     * @todo [RC2] refactor out, or make more appropriate structure
  +     * @todo [1.0] refactor out, or make more appropriate structure
        * @param id
        * @return
        * @throws UnknownPluginException
  @@ -835,33 +829,6 @@
               return plugin.getProject().getContext();
           }
           throw new UnknownPluginException( id );
  -    }
  -
  -    /**
  -     * @param ctx1 
  -     * @param ctx2 
  -     * @todo [RC2] - move to utils?
  -     */
  -    public static void compareContexts( MavenJellyContext ctx1, MavenJellyContext 
ctx2 )
  -    {
  -        System.out.println( "======== compare contexts ========" );
  -        for ( Iterator i = ctx1.getVariableNames(); i.hasNext(); )
  -        {
  -            String name = ( String ) i.next();
  -            if ( ctx2.getVariable( name ) == null )
  -            {
  -                System.out.println( name + " not in ctx2" );
  -            }
  -            else
  -            {
  -                if ( !ctx2.getVariable( name ).equals( ctx1.getVariable( name ) ) )
  -                {
  -                    System.out.println( name + " doesn't match: '" + 
ctx1.getVariable( name ) + "' vs '"
  -                                        + ctx2.getVariable( name ) + "'" );
  -                }
  -            }
  -        }
  -        System.out.println( "======== comparison  done ========" );
       }
   
       public String getGoalDescription( String goalName )
  
  
  
  1.1.4.3   +17 -8     
maven/src/java/org/apache/maven/plugin/Attic/PluginScriptParser.java
  
  Index: PluginScriptParser.java
  ===================================================================
  RCS file: 
/home/cvs/maven/src/java/org/apache/maven/plugin/Attic/PluginScriptParser.java,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- PluginScriptParser.java   26 Jan 2004 23:36:09 -0000      1.1.4.2
  +++ PluginScriptParser.java   7 Feb 2004 21:57:37 -0000       1.1.4.3
  @@ -80,6 +80,18 @@
       /** The plugin name, including version. */
       private final String pluginName;
   
  +    /** The plugin housing. */
  +    private final JellyScriptHousing jellyScriptHousing;
  +
  +    /** The goal mapper. */
  +    private final GoalToJellyScriptHousingMapper mapper;
  +
  +    /** Logging instance. */
  +    private static final Log log = LogFactory.getLog( PluginScriptParser.class );
  +
  +    /** Storage of defined dynamic tag libraries. */
  +    private final Set dynaTagLibDecls = new HashSet();
  +
       /**
        * Get the tag libraries declared in this plugin.
        * @return set of tag library URIs
  @@ -89,22 +101,18 @@
           return dynaTagLibDecls;
       }
   
  -    /** Storage of defined dynamic tag libraries. */
  -    private final Set dynaTagLibDecls = new HashSet();
  -
       /**
        * Constructor.
        * @param pluginCacheManager the cache manager to use.
        */
  -    PluginScriptParser( PluginCacheManager pluginCacheManager, String pluginName )
  +    PluginScriptParser( PluginCacheManager pluginCacheManager, String pluginName, 
JellyScriptHousing jellyScriptHousing, GoalToJellyScriptHousingMapper mapper )
       {
           this.pluginCacheManager = pluginCacheManager;
           this.pluginName = pluginName;
  +        this.jellyScriptHousing = jellyScriptHousing;
  +        this.mapper = mapper;
       }
   
  -    /** Logging instance. */
  -    private static final Log log = LogFactory.getLog( PluginScriptParser.class );
  -
       /**
        * We are looking for namespace declarations like the following:
        *
  @@ -121,10 +129,11 @@
        */
       public void startPrefixMapping( String prefix, String uri )
       {
  -        if ( uri.startsWith( "jelly:" ) == false && uri.startsWith( "dummy" ) == 
false && uri.equals( "" ) == false )
  +        if ( !prefix.equals( "" ) && !uri.startsWith( "jelly:" ) && 
!uri.startsWith( "dummy" ) && !uri.equals( "" ) )
           {
               dynaTagLibDecls.add( uri );
               pluginCacheManager.cachePluginDynaTagDep( pluginName, uri );
  +            mapper.addPluginDynaTagDep( jellyScriptHousing, uri );
   
               if ( log.isDebugEnabled() )
               {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to