You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ah...@apache.org on 2006/08/17 01:08:11 UTC

svn commit: r432063 - in /maven/maven-1/plugins/trunk/artifact/src: main/org/apache/maven/artifact/ main/org/apache/maven/artifact/deployer/ test/java/org/apache/maven/artifact/

Author: aheritier
Date: Wed Aug 16 16:08:10 2006
New Revision: 432063

URL: http://svn.apache.org/viewvc?rev=432063&view=rev
Log:
Reformat code using maven style (I'm doing it because there's no patch to apply in Jira).

Modified:
    maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/PomRewriter.java
    maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/ArtifactDeployer.java
    maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
    maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java
    maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/NamedArtifactDeployer.java
    maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/NamedArtifactTypeHandler.java
    maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
    maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java
    maven/maven-1/plugins/trunk/artifact/src/test/java/org/apache/maven/artifact/PomRewriterTest.java

Modified: maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/PomRewriter.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/PomRewriter.java?rev=432063&r1=432062&r2=432063&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/PomRewriter.java (original)
+++ maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/PomRewriter.java Wed Aug 16 16:08:10 2006
@@ -44,23 +44,23 @@
  */
 public class PomRewriter
 {
-    public static File getRewrittenPom( Project project )
+    public static File getRewrittenPom( final Project project )
         throws MavenException
     {
-        Model model = getRewrittenModel( project.getFile(), project.getContext() );
+        final Model model = PomRewriter.getRewrittenModel( project.getFile(), project.getContext() );
 
         FileWriter w = null;
         try
         {
-            MavenXpp3Writer writer = new MavenXpp3Writer();
-            File f = File.createTempFile( "maven-artifact-plugin.", null );
+            final MavenXpp3Writer writer = new MavenXpp3Writer();
+            final File f = File.createTempFile( "maven-artifact-plugin.", null );
             f.deleteOnExit();
             w = new FileWriter( f );
             writer.write( w, model );
 
             return f;
         }
-        catch ( IOException e )
+        catch ( final IOException e )
         {
             throw new MavenException( "Error getting the project as a string", e );
         }
@@ -70,7 +70,7 @@
         }
     }
 
-    static Model getRewrittenModel( File file, JellyContext context )
+    static Model getRewrittenModel( final File file, final JellyContext context )
         throws MavenException
     {
         Model model;
@@ -78,20 +78,21 @@
         {
             // Very gross, but we don't want initialize() called
             // A future version should use use project.getModel() and serialize that
-            Method m = MavenUtils.class.getDeclaredMethod( "getNonJellyProject", new Class[]{File.class,
-                                                                                             MavenJellyContext.class,
-                                                                                             boolean.class} );
+            Method m = MavenUtils.class.getDeclaredMethod( "getNonJellyProject", new Class[] {
+                File.class,
+                MavenJellyContext.class,
+                boolean.class } );
             m.setAccessible( true );
-            Project p = (Project) m.invoke( null, new Object[]{file, context, Boolean.TRUE} );
+            Project p = (Project) m.invoke( null, new Object[] { file, context, Boolean.TRUE } );
             m.setAccessible( false );
-            m = MavenUtils.class.getDeclaredMethod( "getJellyProject", new Class[]{Project.class} );
+            m = MavenUtils.class.getDeclaredMethod( "getJellyProject", new Class[] { Project.class } );
             m.setAccessible( true );
-            p = (Project) m.invoke( null, new Object[]{p} );
+            p = (Project) m.invoke( null, new Object[] { p } );
             m.setAccessible( false );
             // The rewrittenPOM must redefine dependencies versions
             // if override properties are used
             p.buildArtifactList();
-            
+
             // now sanitize
             p.setContext( null );
             p.setParent( null );
@@ -99,27 +100,27 @@
             p.setDependencyVerifier( null );
             p.setExtend( null );
 
-            Map depProperties = new HashMap();
-            for ( Iterator i = p.getDependencies().iterator(); i.hasNext(); )
+            final Map depProperties = new HashMap();
+            for ( final Iterator i = p.getDependencies().iterator(); i.hasNext(); )
             {
-                org.apache.maven.project.Dependency d = (org.apache.maven.project.Dependency) i.next();
-                Map properties = d.getProperties();
-                if ( properties != null && !properties.isEmpty() )
+                final org.apache.maven.project.Dependency d = (org.apache.maven.project.Dependency) i.next();
+                final Map properties = d.getProperties();
+                if ( ( properties != null ) && !properties.isEmpty() )
                 {
                     depProperties.put( d.getId(), properties );
                     d.setProperties( null );
                 }
             }
 
-            String asString = p.getProjectAsString();
+            final String asString = p.getProjectAsString();
 
-            MavenXpp3Reader reader = new MavenXpp3Reader();
+            final MavenXpp3Reader reader = new MavenXpp3Reader();
             model = reader.read( new StringReader( asString ) );
             model.setId( null );
 
-            for ( Iterator i = model.getDependencies().iterator(); i.hasNext(); )
+            for ( final Iterator i = model.getDependencies().iterator(); i.hasNext(); )
             {
-                Dependency d = (Dependency) i.next();
+                final Dependency d = (Dependency) i.next();
 
                 if ( depProperties.containsKey( d.getId() ) )
                 {
@@ -128,24 +129,24 @@
 
                 d.setId( null );
 
-                if ( d.getUrl() != null && d.getUrl().length() == 0 )
+                if ( ( d.getUrl() != null ) && ( d.getUrl().length() == 0 ) )
                 {
                     d.setUrl( null );
                 }
 
-                if ( d.getType() != null && d.getType().length() == 0 )
+                if ( ( d.getType() != null ) && ( d.getType().length() == 0 ) )
                 {
                     d.setType( null );
                 }
 
-                if ( d.getJar() != null && d.getJar().length() == 0 )
+                if ( ( d.getJar() != null ) && ( d.getJar().length() == 0 ) )
                 {
                     d.setJar( null );
                 }
 
             }
         }
-        catch ( Exception e )
+        catch ( final Exception e )
         {
             throw new MavenException( "Error getting the project as a string", e );
         }

Modified: maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/ArtifactDeployer.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/ArtifactDeployer.java?rev=432063&r1=432062&r2=432063&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/ArtifactDeployer.java (original)
+++ maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/ArtifactDeployer.java Wed Aug 16 16:08:10 2006
@@ -50,7 +50,7 @@
      *          
      * @throws MavenException 
      */
-    void deploy(String artifact, String type, Project project, ArtifactTypeHandler handler)
+    void deploy( String artifact, String type, Project project, ArtifactTypeHandler handler )
         throws MavenException;
 
     /**
@@ -63,7 +63,7 @@
      *
      * @throws MavenException
      */
-    void deploySnapshot(String artifact, String type, Project project, ArtifactTypeHandler handler)
+    void deploySnapshot( String artifact, String type, Project project, ArtifactTypeHandler handler )
         throws MavenException;
 
     /**
@@ -75,7 +75,7 @@
      * @param handler the type handler for the artifact
      * @throws MavenException
      */
-    void install(String artifact, String type, Project project, ArtifactTypeHandler handler)
+    void install( String artifact, String type, Project project, ArtifactTypeHandler handler )
         throws MavenException;
 
     /**
@@ -87,7 +87,6 @@
      * @param handler the type handler for the artifact
      * @throws MavenException
      */
-    void installSnapshot(String artifact, String type, Project project, ArtifactTypeHandler handler)
+    void installSnapshot( String artifact, String type, Project project, ArtifactTypeHandler handler )
         throws MavenException;
 }
-

Modified: maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java?rev=432063&r1=432062&r2=432063&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java (original)
+++ maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java Wed Aug 16 16:08:10 2006
@@ -84,85 +84,86 @@
     /**
      * @see ArtifactDeployer#deploy(String, String, Project, ArtifactTypeHandler)
      */
-    public void deploy( String artifact, String type, Project project, ArtifactTypeHandler handler )
+    public void deploy( final String artifact, final String type, final Project project, final ArtifactTypeHandler handler )
         throws MavenException
     {
-        handleDeploy( type, project, project.getArtifactId(), artifact, handler, project.getCurrentVersion() );
+        this.handleDeploy( type, project, project.getArtifactId(), artifact, handler, project.getCurrentVersion() );
     }
 
     /**
      * @see DefaultArtifactDeployer#deploySnapshot(String, String, Project, ArtifactTypeHandler)
      */
-    public void deploySnapshot( String artifact, String type, Project project, ArtifactTypeHandler handler )
+    public void deploySnapshot( final String artifact, final String type, final Project project, final ArtifactTypeHandler handler )
         throws MavenException
     {
-        handleDeploy( type, project, project.getArtifactId(), artifact, handler, MavenConstants.SNAPSHOT_SIGNIFIER );
+        this.handleDeploy( type, project, project.getArtifactId(), artifact, handler, MavenConstants.SNAPSHOT_SIGNIFIER );
     }
 
-    protected void handleDeploy( String type, Project project, String artifactId, String artifact, ArtifactTypeHandler handler,
-                               String version )
+    protected void handleDeploy( final String type, final Project project, final String artifactId, final String artifact,
+                                 final ArtifactTypeHandler handler, final String version )
         throws MavenException
     {
         File file;
-        if ( POM_TYPE.equals( type ) )
+        if ( DefaultArtifactDeployer.POM_TYPE.equals( type ) )
         {
             file = PomRewriter.getRewrittenPom( project );
         }
         else
         {
-            file = getFileForArtifact( artifact );
+            file = this.getFileForArtifact( artifact );
         }
 
         // do not deploy POM twice
-        if ( !POM_TYPE.equals( type ) )
+        if ( !DefaultArtifactDeployer.POM_TYPE.equals( type ) )
         {
-            doDeploy( PomRewriter.getRewrittenPom( project ), project, artifactId, POM_ARTIFACT_TYPE_HANDLER, version, POM_TYPE );
+            this.doDeploy( PomRewriter.getRewrittenPom( project ), project, artifactId, DefaultArtifactDeployer.POM_ARTIFACT_TYPE_HANDLER, version,
+                      DefaultArtifactDeployer.POM_TYPE );
         }
 
-        doDeploy( file, project, artifactId, handler, version, type );
+        this.doDeploy( file, project, artifactId, handler, version, type );
 
-        snapshotSignature = null;
+        this.snapshotSignature = null;
 
     }
 
     /**
      * @see ArtifactDeployer#install(String, String, Project, ArtifactTypeHandler)
      */
-    public void install( String artifact, String type, Project project, ArtifactTypeHandler handler )
+    public void install( final String artifact, final String type, final Project project, final ArtifactTypeHandler handler )
         throws MavenException
     {
-        handleInstall( type, project, artifact, handler, project.getCurrentVersion() );
+        this.handleInstall( type, project, artifact, handler, project.getCurrentVersion() );
     }
 
     /**
      * @see ArtifactDeployer#installSnapshot(String, String, Project, ArtifactTypeHandler)
      */
-    public void installSnapshot( String artifact, String type, Project project, ArtifactTypeHandler handler )
+    public void installSnapshot( final String artifact, final String type, final Project project, final ArtifactTypeHandler handler )
         throws MavenException
     {
-        handleInstall( type, project, artifact, handler, MavenConstants.SNAPSHOT_SIGNIFIER );
+        this.handleInstall( type, project, artifact, handler, MavenConstants.SNAPSHOT_SIGNIFIER );
     }
 
-    private void handleInstall( String type, Project project, String artifact, ArtifactTypeHandler handler,
-                                String version )
+    private void handleInstall( final String type, final Project project, final String artifact, final ArtifactTypeHandler handler,
+                                final String version )
         throws MavenException
     {
         File file;
-        if ( POM_TYPE.equals( type ) )
+        if ( DefaultArtifactDeployer.POM_TYPE.equals( type ) )
         {
             file = PomRewriter.getRewrittenPom( project );
         }
         else
         {
-            file = getFileForArtifact( artifact );
+            file = this.getFileForArtifact( artifact );
         }
 
-        doInstall( file, type, project, version, handler );
+        this.doInstall( file, type, project, version, handler );
 
         // do not install twice
-        if ( !POM_TYPE.equals( type ) )
+        if ( !DefaultArtifactDeployer.POM_TYPE.equals( type ) )
         {
-            doInstall( PomRewriter.getRewrittenPom( project ), POM_TYPE, project, version, POM_ARTIFACT_TYPE_HANDLER );
+            this.doInstall( PomRewriter.getRewrittenPom( project ), DefaultArtifactDeployer.POM_TYPE, project, version, DefaultArtifactDeployer.POM_ARTIFACT_TYPE_HANDLER );
         }
     }
 
@@ -175,95 +176,95 @@
      * @param version String denominating the version of the artifact
      * @throws MavenException
      */
-    private void doInstall( File file, String type, Project project, String version, ArtifactTypeHandler handler )
+    private void doInstall( final File file, final String type, final Project project, final String version, final ArtifactTypeHandler handler )
         throws MavenException
     {
         try
         {
-            Repository repository = new Repository( "local", "file:" + project.getContext().getMavenRepoLocal() );
-            String repositoryPath = handler.constructRepositoryFullPath( type, project, version );
-            deployFile( repository, file, repositoryPath, project );
+            final Repository repository = new Repository( "local", "file:" + project.getContext().getMavenRepoLocal() );
+            final String repositoryPath = handler.constructRepositoryFullPath( type, project, version );
+            this.deployFile( repository, file, repositoryPath, project );
         }
-        catch ( Exception e )
+        catch ( final Exception e )
         {
-            String msg = "Cannot install file: '" + file + "'. Reason: " + e.getMessage();
+            final String msg = "Cannot install file: '" + file + "'. Reason: " + e.getMessage();
             throw new MavenException( msg, e );
         }
     }
 
     protected String findSshIdentity()
     {
-        String key = findSshIdentity( System.getProperty( "user.home" ) );
+        String key = this.findSshIdentity( System.getProperty( "user.home" ) );
         if ( key != null )
         {
             return key;
         }
         if ( System.getProperty( "user.home" ).equals( System.getProperty( "user.home.env" ) ) == false )
         {
-            key = findSshIdentity( System.getProperty( "user.home.env" ) );
+            key = this.findSshIdentity( System.getProperty( "user.home.env" ) );
             if ( key != null )
             {
                 return key;
             }
         }
-        LOG.warn( "Unable to locate identity id_rsa, id_dsa or identity - set maven.repo.default.privatekey" );
+        DefaultArtifactDeployer.LOG.warn( "Unable to locate identity id_rsa, id_dsa or identity - set maven.repo.default.privatekey" );
         return null;
     }
 
-    private String findSshIdentity( String home )
+    private String findSshIdentity( final String home )
     {
         if ( home == null )
         {
             return null;
         }
-        File sshHome = new File( home, ".ssh" );
-        LOG.debug( "Looking for SSH keys in " + sshHome );
+        final File sshHome = new File( home, ".ssh" );
+        DefaultArtifactDeployer.LOG.debug( "Looking for SSH keys in " + sshHome );
         File key = new File( sshHome, "id_dsa" );
         if ( key.exists() )
         {
-            LOG.debug( "found " + key );
+            DefaultArtifactDeployer.LOG.debug( "found " + key );
             return key.getAbsolutePath();
         }
         key = new File( sshHome, "id_rsa" );
         if ( key.exists() )
         {
-            LOG.debug( "found " + key );
+            DefaultArtifactDeployer.LOG.debug( "found " + key );
             return key.getAbsolutePath();
         }
         key = new File( sshHome, "identity" );
         if ( key.exists() )
         {
-            LOG.debug( "found " + key );
+            DefaultArtifactDeployer.LOG.debug( "found " + key );
             return key.getAbsolutePath();
         }
         return null;
     }
 
-    private void doDeploy( File file, Project project, String artifactId, ArtifactTypeHandler handler, String version, String type )
+    private void doDeploy( final File file, final Project project, final String artifactId, final ArtifactTypeHandler handler, final String version,
+                           final String type )
         throws MavenException
     {
-        List srcFiles = new ArrayList( 3 );
-        List destFiles = new ArrayList( 3 );
+        final List srcFiles = new ArrayList( 3 );
+        final List destFiles = new ArrayList( 3 );
 
         srcFiles.add( file );
         destFiles.add( handler.constructRepositoryFullPath( type, project, version ) );
 
         if ( version.indexOf( MavenConstants.SNAPSHOT_SIGNIFIER ) >= 0 )
         {
-            String signature = getSnapshotSignature();
-            String v = StringUtils.replace( version, MavenConstants.SNAPSHOT_SIGNIFIER, signature );
+            final String signature = this.getSnapshotSignature();
+            final String v = StringUtils.replace( version, MavenConstants.SNAPSHOT_SIGNIFIER, signature );
 
-            File snapshotVersionFile = createSnapshotVersionFile( file, v, artifactId, type );
+            final File snapshotVersionFile = this.createSnapshotVersionFile( file, v, artifactId, type );
 
-            String snapshotVersionsFilename = handler.constructRepositoryDirectoryPath( type, project ) +
-                artifactId + "-snapshot-version";
+            final String snapshotVersionsFilename = handler.constructRepositoryDirectoryPath( type, project ) + artifactId
+                + "-snapshot-version";
 
             srcFiles.add( snapshotVersionFile );
             destFiles.add( snapshotVersionsFilename );
 
-            String deployTimestamp =
-                (String) project.getContext().getVariable( "maven.artifact.deploy.timestamps" );
-            if ( deployTimestamp.equals("true") )
+            final String deployTimestamp = (String) project.getContext().getVariable( "maven.artifact.deploy.timestamps" );
+            if ( deployTimestamp.equals( "true" ) )
             {
                 srcFiles.add( file );
                 destFiles.add( handler.constructRepositoryFullPath( type, project, v ) );
@@ -274,26 +275,26 @@
 
         String repoStr = (String) project.getContext().getVariable( "maven.repo.list" );
 
-        if ( repoStr == null || repoStr.trim().length() == 0 )
+        if ( ( repoStr == null ) || ( repoStr.trim().length() == 0 ) )
         {
             String central = project.getDistributionSite();
             String centralDirectory = project.getDistributionDirectory();
-            if ( central == null || central.trim().length() == 0 )
+            if ( ( central == null ) || ( central.trim().length() == 0 ) )
             {
                 central = (String) project.getContext().getVariable( "maven.repo.central" );
                 centralDirectory = (String) project.getContext().getVariable( "maven.repo.central.directory" );
             }
-            if ( central != null && central.trim().length() > 0 )
+            if ( ( central != null ) && ( central.trim().length() > 0 ) )
             {
                 repoStr = "default";
                 project.getContext().setVariable( "maven.repo.default", "scp://" + central );
                 if ( project.getContext().getVariable( "maven.repo.default.privatekey" ) == null )
                 {
-                    project.getContext().setVariable( "maven.repo.default.privatekey", findSshIdentity() );
+                    project.getContext().setVariable( "maven.repo.default.privatekey", this.findSshIdentity() );
                 }
                 if ( project.getContext().getVariable( "maven.repo.default.passphrase" ) == null )
                 {
-                    LOG.warn( "WARNING: assuming empty passphrase. Specify maven.repo.default.passphrase if needed" );
+                    DefaultArtifactDeployer.LOG.warn( "WARNING: assuming empty passphrase. Specify maven.repo.default.passphrase if needed" );
                     project.getContext().setVariable( "maven.repo.default.passphrase", "" );
                 }
                 project.getContext().setVariable( "maven.repo.default.directory", centralDirectory );
@@ -304,26 +305,26 @@
             }
         }
 
-        String[] repos = StringUtils.split( repoStr, "," );
+        final String[] repos = StringUtils.split( repoStr, "," );
 
-        LOG.info( "Will deploy to " + repos.length + " repository(ies): " + repoStr );
+        DefaultArtifactDeployer.LOG.info( "Will deploy to " + repos.length + " repository(ies): " + repoStr );
         boolean success = false;
         for ( int i = 0; i < repos.length; i++ )
         {
 
-            String repo = repos[i].trim();
-            LOG.info( "Deploying to repository: " + repo );
-            Repository repository = RepositoryBuilder.getRepository( project, repo );
-            AuthenticationInfo authenticationInfo = RepositoryBuilder.getAuthenticationInfo( project, repo );
+            final String repo = repos[i].trim();
+            DefaultArtifactDeployer.LOG.info( "Deploying to repository: " + repo );
+            final Repository repository = RepositoryBuilder.getRepository( project, repo );
+            final AuthenticationInfo authenticationInfo = RepositoryBuilder.getAuthenticationInfo( project, repo );
             try
             {
-                deployFiles( repository, srcFiles, destFiles, authenticationInfo, project );
+                this.deployFiles( repository, srcFiles, destFiles, authenticationInfo, project );
                 success = true;
             }
-            catch ( Exception e )
+            catch ( final Exception e )
             {
-                String msg = "Failed to deploy to: " + repository.getId() + " Reason: " + e;
-                LOG.warn( msg, e );
+                final String msg = "Failed to deploy to: " + repository.getId() + " Reason: " + e;
+                DefaultArtifactDeployer.LOG.warn( msg, e );
                 // deploy to next repository
                 continue;
             }
@@ -335,30 +336,30 @@
         }
     }
 
-    protected void deployFile( Repository repository, File src, String dest, Project project )
+    protected void deployFile( final Repository repository, final File src, final String dest, final Project project )
         throws ResourceDoesNotExistException, MalformedURLException, NoSuchAlgorithmException, TransferFailedException,
         ConnectionException, AuthenticationException, AuthorizationException, MavenException
     {
-        deployFiles( repository, Collections.singletonList( src ), Collections.singletonList( dest ), null, project );
+        this.deployFiles( repository, Collections.singletonList( src ), Collections.singletonList( dest ), null, project );
     }
 
-    protected void deployFiles( Repository repository, List srcFiles, List destFiles,
-                              AuthenticationInfo authenticationInfo, Project project )
+    protected void deployFiles( final Repository repository, final List srcFiles, final List destFiles,
+                                final AuthenticationInfo authenticationInfo, final Project project )
         throws ConnectionException, AuthenticationException, ResourceDoesNotExistException, TransferFailedException,
         AuthorizationException, MalformedURLException, NoSuchAlgorithmException, MavenException
     {
 
         if ( srcFiles.size() != destFiles.size() )
         {
-            String msg = "Lengths of the lists should be the same";
+            final String msg = "Lengths of the lists should be the same";
             throw new IllegalArgumentException( msg );
         }
 
-        Wagon wagon = getWagon( repository.getProtocol(), project, repository.getId() );
+        final Wagon wagon = this.getWagon( repository.getProtocol(), project, repository.getId() );
 
-        TransferListener uploadMonitor = new UploadMeter();
+        final TransferListener uploadMonitor = new UploadMeter();
 
-        Map checksums = new HashMap( 2 );
+        final Map checksums = new HashMap( 2 );
 
         ChecksumObserver observer = new ChecksumObserver( "MD5" );
         checksums.put( "md5", observer );
@@ -370,41 +371,41 @@
         try
         {
             wagon.connect( repository, authenticationInfo );
-            Iterator srcIterator = srcFiles.iterator();
-            Iterator destIterator = destFiles.iterator();
+            final Iterator srcIterator = srcFiles.iterator();
+            final Iterator destIterator = destFiles.iterator();
             while ( srcIterator.hasNext() )
             {
                 wagon.addTransferListener( uploadMonitor );
- 
-                File srcFile = (File) srcIterator.next();
-                String destFile = (String) destIterator.next();
+
+                final File srcFile = (File) srcIterator.next();
+                final String destFile = (String) destIterator.next();
                 wagon.put( srcFile, destFile );
 
                 wagon.removeTransferListener( uploadMonitor );
 
-                Map sums = new HashMap( 2 );
-                for ( Iterator i = checksums.keySet().iterator(); i.hasNext(); )
+                final Map sums = new HashMap( 2 );
+                for ( final Iterator i = checksums.keySet().iterator(); i.hasNext(); )
                 {
                     // store first - a later put will modify them
-                    String extension = (String) i.next();
+                    final String extension = (String) i.next();
                     observer = (ChecksumObserver) checksums.get( extension );
                     sums.put( extension, observer.getActualChecksum() );
                 }
 
-                for ( Iterator i = checksums.keySet().iterator(); i.hasNext(); )
+                for ( final Iterator i = checksums.keySet().iterator(); i.hasNext(); )
                 {
-                    String extension = (String) i.next();
-    
+                    final String extension = (String) i.next();
+
                     // TODO: shouldn't need a file intermediatary - improve wagon to take a stream
-                    File temp = File.createTempFile( "maven-artifact", null );
+                    final File temp = File.createTempFile( "maven-artifact", null );
                     temp.deleteOnExit();
                     FileUtils.fileWrite( temp.getAbsolutePath(), (String) sums.get( extension ) );
-    
+
                     wagon.put( temp, destFile + "." + extension );
                 }
             }
         }
-        catch ( IOException e )
+        catch ( final IOException e )
         {
             throw new MavenException( "Error creating temporary file to transfer checksums", e );
         }
@@ -414,72 +415,83 @@
             {
                 wagon.disconnect();
             }
-            catch ( Exception e )
+            catch ( final Exception e )
             {
-                LOG.error( "Error cleaning up from the deployer", e );
+                DefaultArtifactDeployer.LOG.error( "Error cleaning up from the deployer", e );
             }
         }
     }
 
-    private Wagon getWagon( String protocol, Project project, String id )
+    private Wagon getWagon( final String protocol, final Project project, final String id )
         throws MalformedURLException
     {
-		Wagon wagon;
-	
-		if (protocol.equals("http")) {
-			wagon = new HttpWagon();
-		} else if (protocol.equals("ftp")) {
-			wagon = new FtpWagon();
-			RepositoryBuilder.configureFtpWagon(project, id, (FtpWagon) wagon);
-		} else if (protocol.equals("sftp")) {
-			wagon = new SftpWagon();
-			RepositoryBuilder.configureSftpWagon(project, id, (SftpWagon) wagon);
-		} else if (protocol.equals("file")) {
-			wagon = new FileWagon();
-		} else if (protocol.equals("scp")) {
-			wagon = new ScpWagon();
-			RepositoryBuilder.configureScpWagon(project, id, (ScpWagon) wagon);
-		} else if (protocol.equals("scpexe")) {
-			wagon = new ScpExternalWagon();
-			RepositoryBuilder.configureSshExternalWagon(project, id,
-					(ScpExternalWagon) wagon);
-			return wagon;
-		} else {
-			throw new MalformedURLException("Unknown Wagon protocol: "
-					+ protocol);
-		}
-	
-		return wagon;
-	}
+        Wagon wagon;
+
+        if ( protocol.equals( "http" ) )
+        {
+            wagon = new HttpWagon();
+        }
+        else if ( protocol.equals( "ftp" ) )
+        {
+            wagon = new FtpWagon();
+            RepositoryBuilder.configureFtpWagon( project, id, (FtpWagon) wagon );
+        }
+        else if ( protocol.equals( "sftp" ) )
+        {
+            wagon = new SftpWagon();
+            RepositoryBuilder.configureSftpWagon( project, id, (SftpWagon) wagon );
+        }
+        else if ( protocol.equals( "file" ) )
+        {
+            wagon = new FileWagon();
+        }
+        else if ( protocol.equals( "scp" ) )
+        {
+            wagon = new ScpWagon();
+            RepositoryBuilder.configureScpWagon( project, id, (ScpWagon) wagon );
+        }
+        else if ( protocol.equals( "scpexe" ) )
+        {
+            wagon = new ScpExternalWagon();
+            RepositoryBuilder.configureSshExternalWagon( project, id, (ScpExternalWagon) wagon );
+            return wagon;
+        }
+        else
+        {
+            throw new MalformedURLException( "Unknown Wagon protocol: " + protocol );
+        }
+
+        return wagon;
+    }
 
     protected String getSnapshotSignature()
     {
-        if ( snapshotSignature == null )
+        if ( this.snapshotSignature == null )
         {
-            DateFormat fmt = new SimpleDateFormat( SNAPSHOT_FORMAT );
+            final DateFormat fmt = new SimpleDateFormat( DefaultArtifactDeployer.SNAPSHOT_FORMAT );
             fmt.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
-            snapshotSignature = fmt.format( new Date() );
+            this.snapshotSignature = fmt.format( new Date() );
         }
-        return snapshotSignature;
+        return this.snapshotSignature;
     }
 
-    protected File getFileForArtifact( String artifact )
+    protected File getFileForArtifact( final String artifact )
         throws MavenException
     {
-        File file = new File( artifact );
+        final File file = new File( artifact );
         if ( !file.exists() )
         {
-            String msg = "Artifact file: '" + artifact + "' must exist";
+            final String msg = "Artifact file: '" + artifact + "' must exist";
             throw new MavenException( msg );
         }
         if ( !file.canRead() )
         {
-            String msg = "Artifact file: '" + artifact + "' must be readable";
+            final String msg = "Artifact file: '" + artifact + "' must be readable";
             throw new MavenException( msg );
         }
         if ( file.isDirectory() )
         {
-            String msg = "Artifact file: '" + artifact + "' must not be a directory";
+            final String msg = "Artifact file: '" + artifact + "' must not be a directory";
             throw new MavenException( msg );
         }
         return file.getAbsoluteFile();
@@ -488,18 +500,18 @@
     /**
      * Create a file which contains timestamp of the latetst snapshot
      */
-    protected File createSnapshotVersionFile( File artifact, String snapshotVersion, String artifactId, String type )
+    protected File createSnapshotVersionFile( final File artifact, final String snapshotVersion, final String artifactId, final String type )
         throws MavenException
     {
         File file = null;
-        String filename = artifactId + "-" + type + "-snapshot-version";
+        final String filename = artifactId + "-" + type + "-snapshot-version";
         try
         {
             file = new File( artifact.getParent(), filename );
             FileUtils.fileWrite( file.getAbsolutePath(), snapshotVersion );
             file.deleteOnExit();
         }
-        catch ( Exception e )
+        catch ( final Exception e )
         {
             throw new MavenException( "Cannot create snapshot-version file:" + file );
         }

Modified: maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java?rev=432063&r1=432062&r2=432063&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java (original)
+++ maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java Wed Aug 16 16:08:10 2006
@@ -34,64 +34,68 @@
     private NamedArtifactDeployer artifactDeployer;
 
     private Project project;
+
     private String artifact;
+
     private String type;
+
     private String artifactIdOverride;
+
     private ArtifactTypeHandler typeHandler;
 
     public DeployBean()
     {
-        artifactDeployer = new NamedArtifactDeployer();
+        this.artifactDeployer = new NamedArtifactDeployer();
     }
 
     public ArtifactTypeHandler getTypeHandler()
     {
-        return typeHandler;
+        return this.typeHandler;
     }
 
     /**
      * @param typeHandler
      */
-    public void setTypeHandler(ArtifactTypeHandler typeHandler)
+    public void setTypeHandler( final ArtifactTypeHandler typeHandler )
     {
         this.typeHandler = typeHandler;
     }
 
     public String getArtifact()
     {
-        return artifact;
+        return this.artifact;
     }
 
     /**
      * @param artifact
      */
-    public void setArtifact(String artifact)
+    public void setArtifact( final String artifact )
     {
         this.artifact = artifact;
     }
 
     public Project getProject()
     {
-        return project;
+        return this.project;
     }
 
     /**
      * @param project
      */
-    public void setProject(Project project)
+    public void setProject( final Project project )
     {
         this.project = project;
     }
 
     public String getType()
     {
-        return type;
+        return this.type;
     }
 
     /**
      * @param type
      */
-    public void setType(String type)
+    public void setType( final String type )
     {
         this.type = type;
     }
@@ -101,13 +105,13 @@
      */
     public String getArtifactIdOverride()
     {
-        return artifactIdOverride;
+        return this.artifactIdOverride;
     }
 
     /**
      * @param newIdOverride The new id.
      */
-    public void setArtifactIdOverride(String newIdOverride)
+    public void setArtifactIdOverride( final String newIdOverride )
     {
         this.artifactIdOverride = newIdOverride;
     }
@@ -115,27 +119,28 @@
     /**
      * @throws MavenException MavenException
      */
-    protected void checkAttributes() throws MavenException
+    protected void checkAttributes()
+        throws MavenException
     {
-        if (project == null)
+        if ( this.project == null )
         {
-            throw new MavenException("attribute 'project' is required");
+            throw new MavenException( "attribute 'project' is required" );
         }
 
-        if (artifact == null)
+        if ( this.artifact == null )
         {
-            throw new MavenException("attribute 'artifact' is required");
+            throw new MavenException( "attribute 'artifact' is required" );
         }
-        if (type == null)
+        if ( this.type == null )
         {
-            throw new MavenException("attribute 'type' is required");
+            throw new MavenException( "attribute 'type' is required" );
         }
-        if (typeHandler == null)
+        if ( this.typeHandler == null )
         {
-            typeHandler = new NamedArtifactTypeHandler();
-            if ( artifactIdOverride != null )
+            this.typeHandler = new NamedArtifactTypeHandler();
+            if ( this.artifactIdOverride != null )
             {
-                ((NamedArtifactTypeHandler) typeHandler).setArtifactId( artifactIdOverride );
+                ( (NamedArtifactTypeHandler) this.typeHandler ).setArtifactId( this.artifactIdOverride );
             }
         }
     }
@@ -143,64 +148,68 @@
     /**
      * @throws MavenException MavenException
      */
-    public void deploy() throws MavenException
+    public void deploy()
+        throws MavenException
     {
-        checkAttributes();
-        if ( artifactIdOverride != null )
+        this.checkAttributes();
+        if ( this.artifactIdOverride != null )
         {
-            artifactDeployer.deploy(artifact, type, project, (NamedArtifactTypeHandler) typeHandler);
+            this.artifactDeployer.deploy( this.artifact, this.type, this.project, (NamedArtifactTypeHandler) this.typeHandler );
         }
         else
         {
-            artifactDeployer.deploy(artifact, type, project, typeHandler);
+            this.artifactDeployer.deploy( this.artifact, this.type, this.project, this.typeHandler );
         }
     }
 
     /**
      * @throws MavenException MavenException
      */
-    public void deploySnapshot() throws MavenException
+    public void deploySnapshot()
+        throws MavenException
     {
-        checkAttributes();
-        if ( artifactIdOverride != null )
+        this.checkAttributes();
+        if ( this.artifactIdOverride != null )
         {
-            artifactDeployer.deploySnapshot(artifact, type, project, (NamedArtifactTypeHandler) typeHandler);
+            this.artifactDeployer.deploySnapshot( this.artifact, this.type, this.project, (NamedArtifactTypeHandler) this.typeHandler );
         }
         else
         {
-            artifactDeployer.deploySnapshot(artifact, type, project, typeHandler);
+            this.artifactDeployer.deploySnapshot( this.artifact, this.type, this.project, this.typeHandler );
         }
     }
 
     /**
      * @throws MavenException MavenException
      */
-    public void install() throws MavenException
+    public void install()
+        throws MavenException
     {
-        checkAttributes();
-        if ( artifactIdOverride != null )
+        this.checkAttributes();
+        if ( this.artifactIdOverride != null )
         {
-            artifactDeployer.install(artifact, type, project, (NamedArtifactTypeHandler) typeHandler);
+            this.artifactDeployer.install( this.artifact, this.type, this.project, this.typeHandler );
         }
         else
         {
-            artifactDeployer.install(artifact, type, project, typeHandler);
+            this.artifactDeployer.install( this.artifact, this.type, this.project, this.typeHandler );
         }
     }
 
     /**
      * @throws MavenException MavenException
      */
-    public void installSnapshot() throws MavenException
+    public void installSnapshot()
+        throws MavenException
     {
-        checkAttributes();
-        if ( artifactIdOverride != null )
+        this.checkAttributes();
+        if ( this.artifactIdOverride != null )
         {
-            artifactDeployer.installSnapshot(artifact, type, project, (NamedArtifactTypeHandler) typeHandler);
+            this.artifactDeployer.installSnapshot( this.artifact, this.type, this.project, this.typeHandler );
         }
         else
         {
-            artifactDeployer.installSnapshot(artifact, type, project, typeHandler);
+            this.artifactDeployer.installSnapshot( this.artifact, this.type, this.project, this.typeHandler );
         }
     }
 

Modified: maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/NamedArtifactDeployer.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/NamedArtifactDeployer.java?rev=432063&r1=432062&r2=432063&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/NamedArtifactDeployer.java (original)
+++ maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/NamedArtifactDeployer.java Wed Aug 16 16:08:10 2006
@@ -26,24 +26,25 @@
  *
  * @author <a href="mailto:ltheussl@apache.org">Lukas Theussl</a>
  */
-public class NamedArtifactDeployer extends DefaultArtifactDeployer
+public class NamedArtifactDeployer
+    extends DefaultArtifactDeployer
 {
 
     /**
      * @see ArtifactDeployer#deploy(String, String, Project, NamedArtifactTypeHandler)
      */
-    public void deploy( String artifact, String type, Project project, NamedArtifactTypeHandler handler )
+    public void deploy( final String artifact, final String type, final Project project, final NamedArtifactTypeHandler handler )
         throws MavenException
     {
-        handleDeploy( type, project, handler.getArtifactId(), artifact, handler, project.getCurrentVersion() );
+        this.handleDeploy( type, project, handler.getArtifactId(), artifact, handler, project.getCurrentVersion() );
     }
 
     /**
      * @see DefaultArtifactDeployer#deploySnapshot(String, String, Project, NamedArtifactTypeHandler)
      */
-    public void deploySnapshot( String artifact, String type, Project project, NamedArtifactTypeHandler handler )
+    public void deploySnapshot( final String artifact, final String type, final Project project, final NamedArtifactTypeHandler handler )
         throws MavenException
     {
-        handleDeploy( type, project, handler.getArtifactId(), artifact, handler, MavenConstants.SNAPSHOT_SIGNIFIER );
+        this.handleDeploy( type, project, handler.getArtifactId(), artifact, handler, MavenConstants.SNAPSHOT_SIGNIFIER );
     }
 }

Modified: maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/NamedArtifactTypeHandler.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/NamedArtifactTypeHandler.java?rev=432063&r1=432062&r2=432063&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/NamedArtifactTypeHandler.java (original)
+++ maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/NamedArtifactTypeHandler.java Wed Aug 16 16:08:10 2006
@@ -25,49 +25,47 @@
  *
  * @author <a href="mailto:neilc@strate.co.za">Neil Crow</a>
  */
-public class NamedArtifactTypeHandler extends DefaultArtifactTypeHandler
+public class NamedArtifactTypeHandler
+    extends DefaultArtifactTypeHandler
 {
     /** The artifactId. */
     private String artifactId = null;
 
     /**
-    * @return String
-    */
+     * @return String
+     */
     public String getArtifactId()
     {
-        return artifactId;
+        return this.artifactId;
     }
 
     /**
-    * @param newId - The artifactId which overides the pom default.
-    */
-    public void setArtifactId( String newId )
+     * @param newId - The artifactId which overides the pom default.
+     */
+    public void setArtifactId( final String newId )
     {
         this.artifactId = newId;
     }
 
-
     /**
-    * Map an artifact to a repository path.
-    *
-    * @param project the project for the artifact
-    * @param type The type of the artifact
-    * @param version The version of the artifact (may be a snapshot)
-    * @return the path
-    */
-    public String constructRepositoryFullPath( String type,
-        Project project, String version )
+     * Map an artifact to a repository path.
+     *
+     * @param project the project for the artifact
+     * @param type The type of the artifact
+     * @param version The version of the artifact (may be a snapshot)
+     * @return the path
+     */
+    public String constructRepositoryFullPath( final String type, final Project project, final String version )
     {
-        if ( artifactId == null )
+        if ( this.artifactId == null )
         {
-            artifactId = project.getArtifactId();
+            this.artifactId = project.getArtifactId();
         }
-        StringBuffer path =
-            new StringBuffer( constructRepositoryDirectoryPath( type, project ) );
-        path.append( artifactId );
+        final StringBuffer path = new StringBuffer( this.constructRepositoryDirectoryPath( type, project ) );
+        path.append( this.artifactId );
         path.append( "-" );
         path.append( version );
-        path.append( extensionForType( type) );
+        path.append( this.extensionForType( type ) );
         return path.toString();
     }
 
@@ -75,9 +73,9 @@
      * @param type type
      * @return extension
      */
-    private String extensionForType(String type)
+    private String extensionForType( final String type )
     {
-        if (type.equals("uberjar") || type.equals("ejb") || type.equals("plugin"))
+        if ( type.equals( "uberjar" ) || type.equals( "ejb" ) || type.equals( "plugin" ) )
         {
             return ".jar";
         }

Modified: maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java?rev=432063&r1=432062&r2=432063&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java (original)
+++ maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java Wed Aug 16 16:08:10 2006
@@ -42,19 +42,19 @@
 {
     private static final Log LOG = LogFactory.getLog( RepositoryBuilder.class );
 
-    public static Repository getRepository( Project project, String id )
+    public static Repository getRepository( final Project project, final String id )
         throws MavenException
     {
-        String url = (String) project.getContext().getVariable( "maven.repo." + id );
+        final String url = (String) project.getContext().getVariable( "maven.repo." + id );
         if ( url == null )
         {
             throw new MavenException( "URL not specified in property: maven.repo." + id );
         }
 
-        Repository repository = new Repository( id, url );
+        final Repository repository = new Repository( id, url );
 
         String dir = (String) project.getContext().getVariable( "maven.repo." + id + ".directory" );
-        if ( repository.getBasedir() != null && dir != null )
+        if ( ( repository.getBasedir() != null ) && ( dir != null ) )
         {
             dir = dir.replace( '\\', '/' );
             if ( !repository.getBasedir().endsWith( "/" ) && !dir.startsWith( "/" ) )
@@ -70,20 +70,20 @@
             throw new MavenException( "Directory not specified in property: maven.repo." + id + ".directory" );
         }
 
-        String port = (String) project.getContext().getVariable( "maven.repo." + id + ".port" );
+        final String port = (String) project.getContext().getVariable( "maven.repo." + id + ".port" );
         if ( port != null )
         {
             try
             {
                 repository.setPort( Integer.valueOf( port ).intValue() );
             }
-            catch ( NumberFormatException e )
+            catch ( final NumberFormatException e )
             {
-                LOG.warn( "Invalid format for port: " + port );
+                RepositoryBuilder.LOG.warn( "Invalid format for port: " + port );
             }
         }
 
-        String remoteGroup = (String) project.getContext().getVariable( "maven.repo." + id + ".group" );
+        final String remoteGroup = (String) project.getContext().getVariable( "maven.repo." + id + ".group" );
         String remoteMode = (String) project.getContext().getVariable( "maven.repo." + id + ".mode" );
         String remoteDirectoryMode = (String) project.getContext().getVariable( "maven.repo." + id + ".directory.mode" );
 
@@ -97,7 +97,7 @@
             remoteDirectoryMode = remoteMode;
         }
 
-        RepositoryPermissions permissions = new RepositoryPermissions();
+        final RepositoryPermissions permissions = new RepositoryPermissions();
         permissions.setDirectoryMode( remoteDirectoryMode );
         permissions.setFileMode( remoteMode );
         permissions.setGroup( remoteGroup );
@@ -106,54 +106,54 @@
         return repository;
     }
 
-    public static void configureFtpWagon( Project project, String id, FtpWagon wagon )
+    public static void configureFtpWagon( final Project project, final String id, final FtpWagon wagon )
     {
-/* TODO: implement in FTP wagon
-        String passiveModeOn = (String) project.getContext().getVariable( "maven.repo." + id + ".passiveModeOn" );
+        /* TODO: implement in FTP wagon
+         String passiveModeOn = (String) project.getContext().getVariable( "maven.repo." + id + ".passiveModeOn" );
 
-        String compress = (String) project.getContext().getVariable( "maven.repo." + id + ".compress" );
+         String compress = (String) project.getContext().getVariable( "maven.repo." + id + ".compress" );
 
-        if ( passiveModeOn != null )
-        {
-            if ( "false".equalsIgnoreCase( passiveModeOn ) )
-            {
-                wagon.setPassiveModeOn( false );
-            }
-        }
-        if ( compress != null )
-        {
-            try
-            {
-                wagon.setCompress( new Boolean( compress ).booleanValue() );
-            }
-            catch ( Exception e )
-            {
-                throw new MavenException( "maven.repo." + id + ".compress should be a boolean" );
-            }
-        }
-*/
+         if ( passiveModeOn != null )
+         {
+         if ( "false".equalsIgnoreCase( passiveModeOn ) )
+         {
+         wagon.setPassiveModeOn( false );
+         }
+         }
+         if ( compress != null )
+         {
+         try
+         {
+         wagon.setCompress( new Boolean( compress ).booleanValue() );
+         }
+         catch ( Exception e )
+         {
+         throw new MavenException( "maven.repo." + id + ".compress should be a boolean" );
+         }
+         }
+         */
     }
 
-    public static void configureSshWagon( Project project, String id, AbstractSshWagon wagon )
+    public static void configureSshWagon( final Project project, final String id, final AbstractSshWagon wagon )
     {
-    	// DON'T check host key
-    	// To do it we need to had more configuration settings (know_hosts file, ...)
-    	NullKnownHostProvider nkhp = new NullKnownHostProvider();
-    	nkhp.setHostKeyChecking("no");
-    	wagon.setKnownHostsProvider(nkhp);
+        // DON'T check host key
+        // To do it we need to had more configuration settings (know_hosts file, ...)
+        final NullKnownHostProvider nkhp = new NullKnownHostProvider();
+        nkhp.setHostKeyChecking( "no" );
+        wagon.setKnownHostsProvider( nkhp );
     }
 
-    public static void configureSftpWagon( Project project, String id, SftpWagon wagon )
+    public static void configureSftpWagon( final Project project, final String id, final SftpWagon wagon )
     {
-    	configureSshWagon(project,id,wagon);
+        RepositoryBuilder.configureSshWagon( project, id, wagon );
     }
-    
-    public static void configureScpWagon( Project project, String id, ScpWagon wagon )
+
+    public static void configureScpWagon( final Project project, final String id, final ScpWagon wagon )
     {
-    	configureSshWagon(project,id,wagon);
+        RepositoryBuilder.configureSshWagon( project, id, wagon );
     }
-    
-    public static void configureSshExternalWagon( Project project, String id, ScpExternalWagon wagon )
+
+    public static void configureSshExternalWagon( final Project project, final String id, final ScpExternalWagon wagon )
     {
         String scpExe = (String) project.getContext().getVariable( "maven.repo." + id + ".scp.executable" );
         if ( scpExe == null )
@@ -200,14 +200,14 @@
         }
     }
 
-    public static void getProxyInfo( Project project )
+    public static void getProxyInfo( final Project project )
     {
-        ProxyInfo proxyInfo = new ProxyInfo();
+        final ProxyInfo proxyInfo = new ProxyInfo();
 
-        String proxyHost = project.getContext().getProxyHost();
-        String proxyUser = project.getContext().getProxyUserName();
-        String proxyPassword = project.getContext().getProxyPassword();
-        String proxyPort = project.getContext().getProxyPort();
+        final String proxyHost = project.getContext().getProxyHost();
+        final String proxyUser = project.getContext().getProxyUserName();
+        final String proxyPassword = project.getContext().getProxyPassword();
+        final String proxyPort = project.getContext().getProxyPort();
 
         if ( proxyPort != null )
         {
@@ -215,9 +215,9 @@
             {
                 proxyInfo.setPort( Integer.valueOf( proxyPort ).intValue() );
             }
-            catch ( NumberFormatException e )
+            catch ( final NumberFormatException e )
             {
-                LOG.warn( "Invalid format for port: " + proxyPort );
+                RepositoryBuilder.LOG.warn( "Invalid format for port: " + proxyPort );
             }
         }
 
@@ -230,19 +230,19 @@
         proxyInfo.setPassword( proxyPassword );
     }
 
-    public static AuthenticationInfo getAuthenticationInfo( Project project, String id )
+    public static AuthenticationInfo getAuthenticationInfo( final Project project, final String id )
     {
         String username = (String) project.getContext().getVariable( "maven.repo." + id + ".username" );
-        String password = (String) project.getContext().getVariable( "maven.repo." + id + ".password" );
-        String passphrase = (String) project.getContext().getVariable( "maven.repo." + id + ".passphrase" );
-        String privateKey = (String) project.getContext().getVariable( "maven.repo." + id + ".privatekey" );
+        final String password = (String) project.getContext().getVariable( "maven.repo." + id + ".password" );
+        final String passphrase = (String) project.getContext().getVariable( "maven.repo." + id + ".passphrase" );
+        final String privateKey = (String) project.getContext().getVariable( "maven.repo." + id + ".privatekey" );
 
         if ( username == null )
         {
             username = (String) project.getContext().getVariable( "maven.username" );
         }
 
-        AuthenticationInfo authenticationInfo = new AuthenticationInfo();
+        final AuthenticationInfo authenticationInfo = new AuthenticationInfo();
         authenticationInfo.setUserName( username );
         authenticationInfo.setPassword( password );
         authenticationInfo.setPrivateKey( privateKey );

Modified: maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java?rev=432063&r1=432062&r2=432063&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java (original)
+++ maven/maven-1/plugins/trunk/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java Wed Aug 16 16:08:10 2006
@@ -28,15 +28,20 @@
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @version $Id$
  */
-public class UploadMeter implements TransferListener
+public class UploadMeter
+    implements TransferListener
 {
     /** log for debug output */
-    private static final Log log = LogFactory.getLog(UploadMeter.class);
+    private static final Log log = LogFactory.getLog( UploadMeter.class );
 
     private int shownSoFar;
+
     private final int numHashes;
+
     private final char hashChar;
+
     private long complete;
+
     private long total;
 
     private static final int KB = 1024;
@@ -46,52 +51,51 @@
         this( 20, '.' );
     }
 
-    public UploadMeter(int numHashes, char hashChar)
+    public UploadMeter( final int numHashes, final char hashChar )
     {
         this.numHashes = numHashes;
         this.hashChar = hashChar;
     }
 
-    public void transferInitiated( TransferEvent transferEvent )
+    public void transferInitiated( final TransferEvent transferEvent )
     {
         System.out.println( "Uploading to " + transferEvent.getResource().getName() + ": " );
     }
 
-    public void transferStarted( TransferEvent transferEvent )
+    public void transferStarted( final TransferEvent transferEvent )
     {
-        shownSoFar = 0;
-        complete = 0;
-        total = transferEvent.getLocalFile().length();
+        this.shownSoFar = 0;
+        this.complete = 0;
+        this.total = transferEvent.getLocalFile().length();
     }
 
-    public void transferProgress( TransferEvent transferEvent, byte[] buffer, int length )
+    public void transferProgress( final TransferEvent transferEvent, final byte[] buffer, final int length )
     {
-        complete += length;
+        this.complete += length;
 
-        if (total > 0)
+        if ( this.total > 0 )
         {
-            int numToShow = (int) ( ( complete * numHashes ) / total );
-            for ( int i = shownSoFar + 1; i <= numToShow; i++ )
+            final int numToShow = (int) ( ( this.complete * this.numHashes ) / this.total );
+            for ( int i = this.shownSoFar + 1; i <= numToShow; i++ )
             {
-                System.out.print( hashChar );
+                System.out.print( this.hashChar );
             }
-            shownSoFar = numToShow;
+            this.shownSoFar = numToShow;
         }
     }
 
-    public void transferCompleted( TransferEvent transferEvent )
+    public void transferCompleted( final TransferEvent transferEvent )
     {
-        System.out.println(" (" + total / KB + "K)");
+        System.out.println( " (" + this.total / UploadMeter.KB + "K)" );
     }
 
-    public void transferError( TransferEvent transferEvent )
+    public void transferError( final TransferEvent transferEvent )
     {
-        log.error( transferEvent.getException().getMessage() );
+        UploadMeter.log.error( transferEvent.getException().getMessage() );
     }
 
-    public void debug( String message )
+    public void debug( final String message )
     {
-        log.debug( message );
+        UploadMeter.log.debug( message );
     }
 }
-

Modified: maven/maven-1/plugins/trunk/artifact/src/test/java/org/apache/maven/artifact/PomRewriterTest.java
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/artifact/src/test/java/org/apache/maven/artifact/PomRewriterTest.java?rev=432063&r1=432062&r2=432063&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/artifact/src/test/java/org/apache/maven/artifact/PomRewriterTest.java (original)
+++ maven/maven-1/plugins/trunk/artifact/src/test/java/org/apache/maven/artifact/PomRewriterTest.java Wed Aug 16 16:08:10 2006
@@ -16,16 +16,14 @@
  * limitations under the License.
  */
 
+import java.io.File;
+
+import junit.framework.Assert;
 import junit.framework.TestCase;
-import org.apache.maven.project.Project;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.MavenException;
-import org.apache.maven.MavenUtils;
-import org.apache.maven.MavenConstants;
 
-import java.io.File;
-import java.io.FileReader;
+import org.apache.maven.MavenConstants;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Model;
 
 /**
  * Test the POM rewriter.
@@ -48,18 +46,19 @@
     public void testPropertiesRewriting()
         throws Exception
     {
-        String resourceName = "pom-with-properties.xml";
+        final String resourceName = "pom-with-properties.xml";
 
-        Model model = PomRewriter.getRewrittenModel( new File( System.getProperty( "basedir"), "src/test/resources/" + resourceName ), null );
+        final Model model = PomRewriter.getRewrittenModel( new File( System.getProperty( "basedir" ), "src/test/resources/"
+            + resourceName ), null );
 
         Dependency dep = (Dependency) model.getDependencies().get( 0 );
-        assertEquals( "check property war.bundle", "true", dep.getProperty( "war.bundle" ) );
-        assertEquals( "check num properties", 1, dep.getProperties().size() );
+        Assert.assertEquals( "check property war.bundle", "true", dep.getProperty( "war.bundle" ) );
+        Assert.assertEquals( "check num properties", 1, dep.getProperties().size() );
 
         dep = (Dependency) model.getDependencies().get( 1 );
-        assertEquals( "check property gump.project", "jakarta-taglibs-standard", dep.getProperty( "gump.project" ) );
-        assertEquals( "check property gump.id", "jstl", dep.getProperty( "gump.id" ) );
-        assertEquals( "check num properties", 2, dep.getProperties().size() );
+        Assert.assertEquals( "check property gump.project", "jakarta-taglibs-standard", dep.getProperty( "gump.project" ) );
+        Assert.assertEquals( "check property gump.id", "jstl", dep.getProperty( "gump.id" ) );
+        Assert.assertEquals( "check num properties", 2, dep.getProperties().size() );
     }
 
 }