dion        2003/08/24 21:22:17

  Modified:    src/java/org/apache/maven/plugin PluginManager.java
  Log:
  Checkstyle stuff
  
  Revision  Changes    Path
  1.64      +47 -43    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.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- PluginManager.java        19 Aug 2003 04:28:50 -0000      1.63
  +++ PluginManager.java        25 Aug 2003 04:22:17 -0000      1.64
  @@ -65,7 +65,6 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.maven.AbstractMavenComponent;
  -import org.apache.maven.GoalException;
   import org.apache.maven.MavenConstants;
   import org.apache.maven.MavenException;
   import org.apache.maven.MavenSession;
  @@ -173,12 +172,12 @@
       /**
        *  Default constructor.
        *
  -     *  @param mavenSession The MavenSession this plugin manager will use
  +     *  @param session The MavenSession this plugin manager will use
        *         until Maven shuts down.
        */
  -    public PluginManager( MavenSession mavenSession )
  +    public PluginManager( MavenSession session )
       {
  -        this.mavenSession = mavenSession;
  +        mavenSession = session;
   
           loadedPlugins = new HashSet();
           cacheManager = new PluginCacheManager( true );
  @@ -239,13 +238,13 @@
               return;
           }
   
  -        if( log.isDebugEnabled() )
  +        if (log.isDebugEnabled())
           {
              log.debug( "Initializing Plugins!" );
           }
           setPluginsDir( new File( mavenSession.getRootContext().getMavenHome(), 
"plugins" ) );
           setUnpackedPluginsDir( new File( 
mavenSession.getRootContext().getUnpackedPluginsDir() ) );
  -        if( log.isDebugEnabled() )
  +        if (log.isDebugEnabled())
           {
               log.debug( "Set plugin source directory to "
                   + getPluginsDir().getAbsolutePath() );
  @@ -254,7 +253,7 @@
           }
           cacheManager.loadCache();
   
  -        if( log.isDebugEnabled() )
  +        if (log.isDebugEnabled())
           {
               log.debug( "Unpacking plugins from directory --> "
                   + getPluginsDir().getAbsolutePath() );
  @@ -280,23 +279,23 @@
           // can process plugins that were just unpacked by the
           // above process. This time we're looking at the unpacked plugins.
           File[] files = getUnpackedPluginsDir().listFiles();
  -        
  +
           if (log.isDebugEnabled())
           {
               log.debug( "Processing unpacked plugins in "
                   + getUnpackedPluginsDir().getAbsolutePath() );
           }
  -        
  +
           // Process each of the directorties.
           for ( int i = 0; i < files.length; ++i )
           {
               if ( files[i].isDirectory() )
               {
                   String directory = files[i].getName();
  -        
  +
                   // If we haven't cached (or previous cache data has become invalid)
                   // the plugin, then do so now.
  -                if ( isCached( directory ) == false )
  +                if ( !isCached( directory ) )
                   {
                       try
                       {
  @@ -310,13 +309,13 @@
                   }
               }
           }
  -        
  +
           saveCache();
       }
   
       /**
        * Expand the plugin jars if needed
  -     * @throws MavenException
  +     * @throws MavenException when the plugin jars can't be expanded
        */
       private void expandPluginJars() throws MavenException
       {
  @@ -337,10 +336,10 @@
                   File unzipDir = new File( getUnpackedPluginsDir(), directory );
   
                   // if there's no directory, or the jar is newer, expand the jar
  -                if (   unzipDir.exists() == false
  -                    || files[i].lastModified() > unzipDir.lastModified() )
  +                if (   !unzipDir.exists()
  +                    || (files[i].lastModified() > unzipDir.lastModified()) )
                   {
  -                    if( log.isDebugEnabled() )
  +                    if (log.isDebugEnabled())
                       {
                           log.debug( "Unpacking '" + directory
                               + "' plugin to directory --> "
  @@ -373,13 +372,13 @@
   
       /**
        *  Attain the goals.
  -     *
  +     *  @param project the project to attain the goals for
        *  @throws org.apache.maven.UnknownGoalException If one of the specified
        *          goals refers to an non-existent goal.
        *  @throws Exception If an exception occurs while running a goal.
        */
       public void attainGoals( Project project )
  -        throws GoalException, Exception
  +        throws UnknownGoalException, Exception
       {
           // Before attempting to attain the goals verify the project
           // if desired.
  @@ -430,7 +429,7 @@
   
           //project.getGoalNames().add( BUILD_END_GOAL );
   
  -        for ( Iterator i = project.getGoalNames().iterator(); i.hasNext(); )
  +        for ( Iterator i = project.getGoalNames().iterator(); i.hasNext();)
           {
               String goalName = (String) i.next();
               prepForGoal( goalName, project );
  @@ -448,7 +447,7 @@
           // add the global session to the context so that it can be used by tags
           project.getContext().setVariable(GLOBAL_SESSION_KEY, session);
   
  -        for ( Iterator i = project.getGoalNames().iterator(); i.hasNext(); )
  +        for ( Iterator i = project.getGoalNames().iterator(); i.hasNext();)
           {
               String eachGoalName = (String) i.next();
               Goal eachGoal = project.getContext().getWerkzProject().getGoal( 
eachGoalName );
  @@ -461,20 +460,20 @@
        *  a shared jelly script used by the reactor.
        *
        *  @param jellyScript The jelly.
  -     *
  +     *  @param project the project to load the jelly script into
        *  @throws Exception If an error occurs while attempting to load the file.
        */
       public void loadJellyScript( File jellyScript, Project project )
           throws Exception
       {
  -        if ( jellyScript.exists() == false )
  +        if ( !jellyScript.exists() )
           {
               return;
           }
   
           Set originalGoals = new HashSet( 
project.getContext().getWerkzProject().getGoals() );
   
  -        for ( Iterator i = originalGoals.iterator(); i.hasNext(); )
  +        for ( Iterator i = originalGoals.iterator(); i.hasNext();)
           {
               Goal eachGoal = (Goal) i.next();
   
  @@ -508,7 +507,7 @@
        *  @param initialGoalToPrep The initial goal to prepare for. There may
        *         also be additional goals to prep for once prequisite goals
        *         are taken into consideration.
  -     *
  +     *  @param project the project the goal will be executed in
        *  @throws Exception If an error occurs while attempting to
        *          prepare for the goal.
        */
  @@ -521,7 +520,7 @@
   
           goalsToPrep.add( initialGoalToPrep );
   
  -        while ( goalsToPrep.isEmpty() == false )
  +        while ( !goalsToPrep.isEmpty() )
           {
               goalToPrep = (String) goalsToPrep.removeFirst();
   
  @@ -563,7 +562,7 @@
        *  Prepare and load plugins based upon callback dependencies.
        *
        *  @param goalName The goal name.
  -     *
  +     *  @param project the project the goal will be executed in
        *  @throws Exception If an error occurs while attempting to preprare
        *          callback dependencies.
        */
  @@ -684,7 +683,7 @@
        *  Load the specified plugin.
        *
        *  @param name The name of the plugin to load.
  -     *
  +     *  @param project the project the plugin is to be loaded for
        *  @throws Exception If an error occurs while initializing the plugin.
        */
       public void loadPlugin( String name, Project project )
  @@ -697,7 +696,7 @@
   
           File pluginScript = getPluginScript( name );
   
  -        if ( pluginScript.exists() == false )
  +        if ( !pluginScript.exists() )
           {
               return;
           }
  @@ -718,7 +717,7 @@
                                       project.getContext(),
                                       false );
   
  -        if ( isPluginProcessed( name ) == false )
  +        if ( !isPluginProcessed( name ) )
           {
               pluginProject.verifyDependencies();
   
  @@ -729,7 +728,7 @@
   
           // place dependencies on the right classloaders
           pluginProject.processDependencies();
  -        
  +
           // We need to create a separate context for the plugin.jelly script to
           // run against because we need our values of "plugin" and "plugin.dir"
           // to have distinct values. Everything else can be taken from the
  @@ -774,7 +773,7 @@
        *  Load plugins specified in a whitespace delimited string.
        *
        *  @param names The whitespace delimited string of plugin names.
  -     *
  +     *  @param project the project to load the plugins for
        *  @throws Exception If an error occurs while attempting to load
        *          the plugins.
        */
  @@ -836,7 +835,7 @@
        */
       void invalidateCache( String pluginName )
       {
  -        for ( Iterator i = cacheManager.getGoalCache().keySet().iterator(); 
i.hasNext(); )
  +        for ( Iterator i = cacheManager.getGoalCache().keySet().iterator(); 
i.hasNext();)
           {
               String eachGoal = (String) i.next();
   
  @@ -876,6 +875,9 @@
           return cacheManager.getGoalCache().containsKey( name );
       }
   
  +    /**
  +     * @return the keys of the dynamic taglib cache
  +     */
       Set getTagLibsCache()
       {
           return cacheManager.getDynaTagLibCache().keySet();
  @@ -910,7 +912,7 @@
        *  Determine if a plugin has been loaded.
        *
        *  @param name The plugin name.
  -     *
  +     *  @param project the project the plugin may be loaded in
        *  @return <code>true</code> if the plugin has been loaded,
        *          otherwise <code>false</code>.
        */
  @@ -935,7 +937,7 @@
       {
           File propsFile = new File( unpackedPluginDir, PLUGIN_PROPERTIES_NAME );
   
  -        if ( propsFile.exists() == false )
  +        if ( !propsFile.exists() )
           {
               return null;
           }
  @@ -981,11 +983,11 @@
       /**
        *  Sets the pluginsDir attribute of the PluginManager object
        *
  -     *  @param pluginsDir The maven plugin directory.
  +     *  @param dir The maven plugin directory.
        */
  -    void setPluginsDir( File pluginsDir )
  +    void setPluginsDir( File dir )
       {
  -        this.pluginsDir = pluginsDir;
  +        pluginsDir = dir;
       }
   
       /**
  @@ -1001,11 +1003,11 @@
       /**
        *  Sets the directory where the unpacked plugins are located.
        *
  -     *  @param unpackedPluginsDir The directory where the unpacked plugins are 
located.
  +     *  @param dir The directory where the unpacked plugins are located.
        */
  -    void setUnpackedPluginsDir( File unpackedPluginsDir )
  +    void setUnpackedPluginsDir( File dir )
       {
  -        this.unpackedPluginsDir = unpackedPluginsDir;
  +        unpackedPluginsDir = dir;
           cacheManager.setUnpackedPluginsDir( unpackedPluginsDir );
       }
   
  @@ -1023,7 +1025,9 @@
        * Load and install a plugin
        * @todo should check if it's already installed.
        * @todo I'm not sure if caching needs to be called.
  -     * @param file
  +     * @param file the file to install. Must be a plugin jar
  +     * @param project the project to load the installed plugin into
  +     * @throws Exception when unzipping fails
        */
       public void installPlugin(Project project, File file) throws Exception
       {
  @@ -1031,7 +1035,7 @@
           FileUtils.copyFileToDirectory(file, getPluginsDir());
           String pluginName = file.getCanonicalFile().getName();
           pluginName = pluginName.substring(0, pluginName.indexOf(".jar"));
  -        String newFileName = getPluginsDir().getCanonicalPath() 
  +        String newFileName = getPluginsDir().getCanonicalPath()
               + File.separator + file.getCanonicalFile().getName();
           // expand it
           Expand unzipper = new Expand();
  
  
  

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

Reply via email to