Cleaned up several checkstyle reported errors/warnings.
authorKarl Heinz Marbaise <khmarbaise@apache.org>
Tue, 8 Dec 2015 11:09:41 +0000 (11:09 +0000)
committerKarl Heinz Marbaise <khmarbaise@apache.org>
Tue, 8 Dec 2015 11:09:41 +0000 (11:09 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1718564 13f79535-47bb-0310-9956-ffa450edef68

src/main/java/org/apache/maven/shared/io/download/DefaultDownloadManager.java
src/main/java/org/apache/maven/shared/io/location/ArtifactLocatorStrategy.java
src/main/java/org/apache/maven/shared/io/location/ClasspathResourceLocatorStrategy.java
src/main/java/org/apache/maven/shared/io/location/FileLocation.java
src/main/java/org/apache/maven/shared/io/location/FileLocatorStrategy.java
src/main/java/org/apache/maven/shared/io/location/Location.java
src/main/java/org/apache/maven/shared/io/location/Locator.java
src/main/java/org/apache/maven/shared/io/location/LocatorStrategy.java
src/main/java/org/apache/maven/shared/io/location/URLLocation.java
src/main/java/org/apache/maven/shared/io/location/URLLocatorStrategy.java
src/test/java/org/apache/maven/shared/io/location/LocatorTest.java

index 463d026..0e8165f 100644 (file)
@@ -42,7 +42,7 @@ import org.apache.maven.wagon.events.TransferListener;
 import org.apache.maven.wagon.repository.Repository;
 
 /**
- * The Implementation of the {@link DownloadManager}.
+ * The Implementation of the {@link DownloadManager
  *
  */
 public class DefaultDownloadManager
index 22a68f9..208020f 100644 (file)
@@ -29,6 +29,10 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.shared.io.logging.MessageHolder;
 
+/**
+ * The locator strategy.
+ *
+ */
 public class ArtifactLocatorStrategy
     implements LocatorStrategy
 {
@@ -40,12 +44,18 @@ public class ArtifactLocatorStrategy
 
     private final ArtifactRepository localRepository;
 
-    private final List remoteRepositories;
+    private final List<ArtifactRepository> remoteRepositories;
 
     private String defaultClassifier = null;
 
+    /**
+     * @param factory {@link ArtifactFactory}
+     * @param resolver {@link ArtifactResolver}
+     * @param localRepository {@link ArtifactRepository}
+     * @param remoteRepositories {@link RemoteRepository}
+     */
     public ArtifactLocatorStrategy( ArtifactFactory factory, ArtifactResolver resolver,
-                                    ArtifactRepository localRepository, List remoteRepositories )
+                                    ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
     {
         this.factory = factory;
         this.resolver = resolver;
@@ -53,8 +63,15 @@ public class ArtifactLocatorStrategy
         this.remoteRepositories = remoteRepositories;
     }
 
+    /**
+     * @param factory {@link ArtifactFactory}
+     * @param resolver {@link ArtifactResolver}
+     * @param localRepository {@link ArtifactRepository}
+     * @param remoteRepositories {@link ArtifactRepository}
+     * @param defaultArtifactType default artifact type.
+     */
     public ArtifactLocatorStrategy( ArtifactFactory factory, ArtifactResolver resolver,
-                                    ArtifactRepository localRepository, List remoteRepositories,
+                                    ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
                                     String defaultArtifactType )
     {
         this.factory = factory;
@@ -64,8 +81,16 @@ public class ArtifactLocatorStrategy
         this.defaultArtifactType = defaultArtifactType;
     }
 
+    /**
+     * @param factory {@link ArtifactFactory}
+     * @param resolver {@link ArtifactResolver}
+     * @param localRepository {@link ArtifactRepository}
+     * @param remoteRepositories {@link ArtifactRepository}
+     * @param defaultArtifactType default artifact type.
+     * @param defaultClassifier default classifier.
+     */
     public ArtifactLocatorStrategy( ArtifactFactory factory, ArtifactResolver resolver,
-                                    ArtifactRepository localRepository, List remoteRepositories,
+                                    ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
                                     String defaultArtifactType, String defaultClassifier )
     {
         this.factory = factory;
@@ -80,6 +105,9 @@ public class ArtifactLocatorStrategy
      * Assumes artifact identity is given in a set of comma-delimited tokens of
      * the form: <code>groupId:artifactId:version:type:classifier</code>, where
      * type and classifier are optional.
+     * @param locationSpecification location spec.
+     * @param messageHolder {@link MessageHolder}
+     * @return location.
      */
     public Location resolve( String locationSpecification, MessageHolder messageHolder )
     {
index f56c135..4d850cf 100644 (file)
@@ -23,6 +23,10 @@ import java.net.URL;
 
 import org.apache.maven.shared.io.logging.MessageHolder;
 
+/**
+ * classpath resource locator strategy.
+ *
+ */
 public class ClasspathResourceLocatorStrategy
     implements LocatorStrategy
 {
@@ -33,10 +37,18 @@ public class ClasspathResourceLocatorStrategy
 
     private boolean tempFileDeleteOnExit = true;
 
+    /**
+     * Create instance.
+     */
     public ClasspathResourceLocatorStrategy()
     {
     }
 
+    /**
+     * @param tempFilePrefix Prefix.
+     * @param tempFileSuffix Suffix.
+     * @param tempFileDeleteOnExit delete on exit.
+     */
     public ClasspathResourceLocatorStrategy( String tempFilePrefix, String tempFileSuffix,
                                              boolean tempFileDeleteOnExit )
     {
@@ -45,6 +57,7 @@ public class ClasspathResourceLocatorStrategy
         this.tempFileDeleteOnExit = tempFileDeleteOnExit;
     }
 
+    /** {@inheritDoc} */
     public Location resolve( String locationSpecification, MessageHolder messageHolder )
     {
         ClassLoader cloader = Thread.currentThread().getContextClassLoader();
index 1d03a57..a8a62e3 100644 (file)
@@ -27,6 +27,10 @@ import java.nio.ByteBuffer;
 import java.nio.channels.FileChannel;
 
 
+/**
+ * file location implementation.
+ *
+ */
 public class FileLocation
     implements Location
 {
@@ -36,17 +40,25 @@ public class FileLocation
     private final String specification;
     private FileInputStream stream;
 
+    /**
+     * @param file {@link File}
+     * @param specification spec.
+     */
     public FileLocation( File file, String specification )
     {
         this.file = file;
         this.specification = specification;
     }
 
+    /**
+     * @param specification spec.
+     */
     protected FileLocation( String specification )
     {
         this.specification = specification;
     }
 
+    /** {@inheritDoc} */
     public void close()
     {
         if ( ( channel != null ) && channel.isOpen() )
@@ -74,6 +86,7 @@ public class FileLocation
         }
     }
 
+    /** {@inheritDoc} */
     public File getFile()
         throws IOException
     {
@@ -82,11 +95,18 @@ public class FileLocation
         return unsafeGetFile();
     }
 
+    /**
+     * @return {@link File}
+     */
     protected File unsafeGetFile()
     {
         return file;
     }
 
+    /**
+     * initialize file.
+     * @throws IOException in case error.
+     */
     protected void initFile()
         throws IOException
     {
@@ -97,6 +117,9 @@ public class FileLocation
         }
     }
 
+    /**
+     * @param file {@link File}
+     */
     protected void setFile( File file )
     {
         if ( channel != null )
@@ -107,11 +130,13 @@ public class FileLocation
         this.file = file;
     }
 
+    /** {@inheritDoc} */
     public String getSpecification()
     {
         return specification;
     }
 
+    /** {@inheritDoc} */
     public void open()
         throws IOException
     {
@@ -124,6 +149,7 @@ public class FileLocation
         }
     }
 
+    /** {@inheritDoc} */
     public int read( ByteBuffer buffer )
         throws IOException
     {
@@ -131,6 +157,7 @@ public class FileLocation
         return channel.read( buffer );
     }
 
+    /** {@inheritDoc} */
     public int read( byte[] buffer )
         throws IOException
     {
@@ -138,6 +165,7 @@ public class FileLocation
         return channel.read( ByteBuffer.wrap( buffer ) );
     }
 
+    /** {@inheritDoc} */
     public InputStream getInputStream()
         throws IOException
     {
index 5f0dd0e..92aa3dd 100644 (file)
@@ -23,10 +23,15 @@ import java.io.File;
 
 import org.apache.maven.shared.io.logging.MessageHolder;
 
+/**
+ * file locator strategy.
+ *
+ */
 public class FileLocatorStrategy
     implements LocatorStrategy
 {
 
+    /** {@inheritDoc} */
     public Location resolve( String locationSpecification, MessageHolder messageHolder )
     {
         File file = new File( locationSpecification );
index a02ccc9..cfbd4ae 100644 (file)
@@ -24,21 +24,53 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.nio.ByteBuffer;
 
+/**
+ * The location interface.
+ *
+ */
 public interface Location
 {
 
+    /**
+     * @return {@link File}.
+     * @throws IOException in case of an error.
+     */
     File getFile() throws IOException;
 
+    /**
+     * open the location.
+     * @throws IOException in case of an error.
+     */
     void open() throws IOException;
 
+    /**
+     * Close the location.
+     */
     void close();
 
+    /**
+     * @param buffer The buffer.
+     * @return number of read bytes.
+     * @throws IOException in case of an error.
+     */
     int read( ByteBuffer buffer ) throws IOException;
 
+    /**
+     * @param buffer The buffer.
+     * @return number of read bytes.
+     * @throws IOException in case of an error.
+     */
     int read( byte[] buffer ) throws IOException;
 
+    /**
+     * @return the resulting input stream.
+     * @throws IOException in case of an error.
+     */
     InputStream getInputStream() throws IOException;
 
+    /**
+     * @return spec.
+     */
     String getSpecification();
 
 }
index 1e2dc02..45f27af 100644 (file)
@@ -26,55 +26,85 @@ import java.util.List;
 import org.apache.maven.shared.io.logging.DefaultMessageHolder;
 import org.apache.maven.shared.io.logging.MessageHolder;
 
+/**
+ * The Locator.
+ *
+ */
 public final class Locator
 {
 
-    private List strategies;
+    private List<LocatorStrategy> strategies;
     private final MessageHolder messageHolder;
 
-    public Locator( List strategies, MessageHolder messageHolder )
+    /**
+     * @param strategies List of strategies.
+     * @param messageHolder {@link MessageHolder}
+     */
+    public Locator( List<LocatorStrategy> strategies, MessageHolder messageHolder )
     {
         this.messageHolder = messageHolder;
-        this.strategies = new ArrayList( strategies );
+        this.strategies = new ArrayList<LocatorStrategy>( strategies );
     }
 
+    /**
+     * Create instance.
+     */
     public Locator()
     {
         this.messageHolder = new DefaultMessageHolder();
-        this.strategies = new ArrayList();
+        this.strategies = new ArrayList<LocatorStrategy>();
     }
 
+    /**
+     * @return {@link MessageHolder}
+     */
     public MessageHolder getMessageHolder()
     {
         return messageHolder;
     }
 
+    /**
+     * @param strategy The strategy to be added.
+     */
     public void addStrategy( LocatorStrategy strategy )
     {
         this.strategies.add( strategy );
     }
 
+    /**
+     * @param strategy the strategy to remove.
+     */
     public void removeStrategy( LocatorStrategy strategy )
     {
         this.strategies.remove( strategy );
     }
 
-    public void setStrategies( List strategies )
+    /**
+     * @param strategies the strategies to be set.
+     */
+    public void setStrategies( List<LocatorStrategy> strategies )
     {
         this.strategies.clear();
         this.strategies.addAll( strategies );
     }
 
-    public List getStrategies()
+    /**
+     * @return list of strategies.
+     */
+    public List<LocatorStrategy> getStrategies()
     {
         return strategies;
     }
 
+    /**
+     * @param locationSpecification location spec.
+     * @return {@link Location}
+     */
     public Location resolve( String locationSpecification )
     {
         Location location = null;
 
-        for ( Iterator it = strategies.iterator(); location == null && it.hasNext(); )
+        for ( Iterator<LocatorStrategy> it = strategies.iterator(); location == null && it.hasNext(); )
         {
             LocatorStrategy strategy = (LocatorStrategy) it.next();
 
index bf11c4c..f2087b6 100644 (file)
@@ -21,9 +21,18 @@ package org.apache.maven.shared.io.location;
 
 import org.apache.maven.shared.io.logging.MessageHolder;
 
+/**
+ * Locator Strategy interface.
+ *
+ */
 public interface LocatorStrategy
 {
 
+    /**
+     * @param locationSpecification the specifiaction.
+     * @param messageHolder {@link MessageHolder}
+     * @return {@link Location}
+     */
     Location resolve( String locationSpecification, MessageHolder messageHolder );
 
 }
index 1f329d4..cca1f24 100644 (file)
@@ -25,6 +25,10 @@ import java.net.URL;
 
 import org.apache.maven.shared.utils.io.FileUtils;
 
+/**
+ * The URL Location.
+ *
+ */
 public class URLLocation
     extends FileLocation
 {
@@ -37,6 +41,13 @@ public class URLLocation
 
     private final boolean tempFileDeleteOnExit;
 
+    /**
+     * @param url The URL.
+     * @param specification The spec.
+     * @param tempFilePrefix the prefix.
+     * @param tempFileSuffix The suffix.
+     * @param tempFileDeleteOnExit delete on exit.
+     */
     public URLLocation( URL url, String specification, String tempFilePrefix, String tempFileSuffix,
                         boolean tempFileDeleteOnExit )
     {
@@ -48,6 +59,7 @@ public class URLLocation
         this.tempFileDeleteOnExit = tempFileDeleteOnExit;
     }
 
+    /** {@inheritDoc} */
     protected void initFile()
         throws IOException
     {
index 01bad54..e7d259d 100644 (file)
@@ -24,6 +24,10 @@ import java.net.URL;
 
 import org.apache.maven.shared.io.logging.MessageHolder;
 
+/**
+ * URL Locator Strategy.
+ *
+ */
 public class URLLocatorStrategy
     implements LocatorStrategy
 {
@@ -34,10 +38,18 @@ public class URLLocatorStrategy
 
     private boolean tempFileDeleteOnExit = true;
 
+    /**
+     * Create instance.
+     */
     public URLLocatorStrategy()
     {
     }
 
+    /**
+     * @param tempFilePrefix prefix.
+     * @param tempFileSuffix suffix.
+     * @param tempFileDeleteOnExit delete on exit.
+     */
     public URLLocatorStrategy( String tempFilePrefix, String tempFileSuffix, boolean tempFileDeleteOnExit )
     {
         this.tempFilePrefix = tempFilePrefix;
@@ -45,6 +57,7 @@ public class URLLocatorStrategy
         this.tempFileDeleteOnExit = tempFileDeleteOnExit;
     }
 
+    /** {@inheritDoc} */
     public Location resolve( String locationSpecification, MessageHolder messageHolder )
     {
         Location location = null;
index 66f03eb..ab976ec 100644 (file)
@@ -41,12 +41,12 @@ public class LocatorTest
 
     public void testShouldConstructWithStrategyStackAndMessageHolder()
     {
-        new Locator( Collections.EMPTY_LIST, new DefaultMessageHolder() );
+        new Locator( Collections.<LocatorStrategy>emptyList(), new DefaultMessageHolder() );
     }
 
     public void testShouldAllowModificationOfStrategiesAfterConstructionWithUnmodifiableStack()
     {
-        Locator locator = new Locator( Collections.unmodifiableList( Collections.EMPTY_LIST ),
+        Locator locator = new Locator( Collections.unmodifiableList( Collections.<LocatorStrategy>emptyList() ),
                                        new DefaultMessageHolder() );
 
         locator.addStrategy( new FileLocatorStrategy() );
@@ -71,7 +71,7 @@ public class LocatorTest
 
         locator.setStrategies( Collections.singletonList( replacementStrategy ) );
 
-        List strategies = locator.getStrategies();
+        List<LocatorStrategy> strategies = locator.getStrategies();
 
         assertFalse( strategies.contains( originalStrategy ) );
         assertTrue( strategies.contains( replacementStrategy ) );
@@ -88,7 +88,7 @@ public class LocatorTest
         Locator locator = new Locator();
         locator.addStrategy( originalStrategy );
 
-        List strategies = locator.getStrategies();
+        List<LocatorStrategy> strategies = locator.getStrategies();
 
         assertTrue( strategies.contains( originalStrategy ) );
 
@@ -103,7 +103,7 @@ public class LocatorTest
 
     public void testResolutionFallsThroughStrategyStackAndReturnsNullIfNotResolved()
     {
-        List strategies = new ArrayList();
+        List<LocatorStrategy> strategies = new ArrayList<LocatorStrategy>();
 
         strategies.add( new LoggingLocatorStrategy() );
         strategies.add( new LoggingLocatorStrategy() );