]> source.dussan.org Git - archiva.git/commitdiff
reformat
authorBrett Porter <brett@apache.org>
Fri, 30 Dec 2005 04:37:28 +0000 (04:37 +0000)
committerBrett Porter <brett@apache.org>
Fri, 30 Dec 2005 04:37:28 +0000 (04:37 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@359986 13f79535-47bb-0310-9956-ffa450edef68

71 files changed:
maven-repository-discovery/pom.xml
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractArtifactDiscoverer.java
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/ArtifactDiscoverer.java
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultArtifactDiscoverer.java
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/LegacyArtifactDiscoverer.java
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/MetadataDiscoverer.java
maven-repository-discovery/src/main/resources/META-INF/plexus/components.xml
maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultArtifactDiscovererTest.java
maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/DefaultMetadataDiscovererTest.java
maven-repository-discovery/src/test/java/org/apache/maven/repository/discovery/LegacyArtifactDiscovererTest.java
maven-repository-discovery/src/test/repository/javax/maven-metadata-repository.xml
maven-repository-discovery/src/test/repository/javax/sql/jdbc/2.0/maven-metadata-repository.xml
maven-repository-discovery/src/test/repository/javax/sql/jdbc/maven-metadata-repository.xml
maven-repository-discovery/src/test/repository/javax/sql/maven-metadata-repository.xml
maven-repository-discovery/src/test/repository/org/apache/maven/some-ejb/1.0/maven-metadata-repository.xml
maven-repository-indexer/pom.xml
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexAnalyzer.java
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexSearcher.java
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexException.java
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearcher.java
maven-repository-indexer/src/main/resources/META-INF/plexus/components.xml
maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java
maven-repository-reports-standard/pom.xml
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/AbstractRepositoryQueryLayer.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ArtifactReportProcessor.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ArtifactReporter.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ArtifactResult.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/BadMetadataReportProcessor.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/CachedRepositoryQueryLayer.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ChecksumArtifactReporter.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultArtifactReportProcessor.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultArtifactReporter.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultRepositoryQueryLayer.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/DefaultRepositoryQueryLayerFactory.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/InvalidPomArtifactReportProcessor.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/LocationArtifactReportProcessor.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/MetadataReportProcessor.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/ReportProcessorException.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryMetadataResult.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayer.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayerException.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/RepositoryQueryLayerFactory.java
maven-repository-reports-standard/src/main/resources/META-INF/plexus/components.xml
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractChecksumArtifactReporterTest.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractRepositoryQueryLayerTest.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/AbstractRepositoryReportsTestCase.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/ArtifactReportProcessorTest.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/ArtifactReporterTest.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/BadMetadataReportProcessorTest.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/CacheTest.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/CachedRepositoryQueryLayerTest.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/ChecksumArtifactReporterTest.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/DefaultArtifactReporterTest.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/GenericMockObject.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/InvalidPomArtifactReportProcessorTest.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/LocationArtifactReportProcessorTest.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/MockArtifact.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/MockArtifactFactory.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/MockArtifactReportProcessor.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/MockArtifactReporter.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/MockRepositoryQueryLayer.java
maven-repository-reports-standard/src/test/java/org/apache/maven/repository/reporting/ReportCondition.java
maven-repository-reports-standard/src/test/repository/groupId/artifactId/maven-metadata.xml
maven-repository-reports-standard/src/test/repository/groupId/unexpectedfile.xml
maven-repository-reports-standard/src/test/repository/maven-metadata-repository.xml
pom.xml

index 8426562e3f3562c90421f14f3d20510a5b6bf6e5..32f8a525dd3e3b7b2a3ba6dfa331e2b4e33c9690 100755 (executable)
@@ -1,3 +1,19 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
index f7c94612b21ccbc05d5e314b19269f5de689dd84..f55154c1733ac1ecea36531f856834f5314ca991 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.discovery;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index cd51ee015afc640126404be924e1ecb97fe320bc..5383fdae30bf1c67b1fcb19d22108e24ed8028ae 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.discovery;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 00fe863d441e1a56fae217e687cbfbbcc2f1afae..d88ed4f5294e0179e96329a1133ccdc864649d02 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.discovery;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 9431ae0323c6a347210abe2763101ab72d31fdad..e7948f2268c790d3c5b77bf1557f69fb1e47bed7 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.discovery;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,20 +16,6 @@ package org.apache.maven.repository.discovery;
  * limitations under the License.
  */
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DefaultArtifact;
 import org.apache.maven.artifact.handler.ArtifactHandler;
@@ -45,175 +31,211 @@ import org.codehaus.plexus.util.DirectoryScanner;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
 /**
  * This class gets all the paths that contain the metadata files.
- * 
  */
-public class DefaultMetadataDiscoverer implements MetadataDiscoverer {
-
-       /**
-        * Standard patterns to exclude from discovery as they are not artifacts.
-        */
-       private static final String[] STANDARD_DISCOVERY_EXCLUDES = { "bin/**",
-                       "reports/**", ".maven/**", "**/*.md5", "**/*.MD5", "**/*.sha1",
-                       "**/*.SHA1", "**/*snapshot-version", "*/website/**",
-                       "*/licenses/**", "*/licences/**", "**/.htaccess", "**/*.html",
-                       "**/*.asc", "**/*.txt", "**/README*", "**/CHANGELOG*", "**/KEYS*" };
-
-       /**
-        * Standard patterns to include in discovery of metadata files.
-        */
-       private static final String[] STANDARD_DISCOVERY_INCLUDES = {
-                       "**/*-metadata.xml", "**/*/*-metadata.xml",
-                       "**/*/*/*-metadata.xml", "**/*-metadata-*.xml",
-                       "**/*/*-metadata-*.xml", "**/*/*/*-metadata-*.xml" };
-
-       private static final String[] EMPTY_STRING_ARRAY = new String[0];
-
-       private List excludedPaths = new ArrayList();
-
-       private List kickedOutPaths = new ArrayList();
-
-       /**
-        * Search the repository for metadata files.
-        * 
-        * @param repositoryBase
-        * @param blacklistedPatterns
-        */
-       public List discoverMetadata(File repositoryBase, String blacklistedPatterns) {
-               List metadataFiles = new ArrayList();
-               String[] metadataPaths = scanForMetadataPaths(repositoryBase,
-                               blacklistedPatterns);
-
-               for (int i = 0; i < metadataPaths.length; i++) {
-                       RepositoryMetadata metadata = buildMetadata(repositoryBase
-                                       .getPath(), metadataPaths[i]);
-
-                       if (metadata != null)
-                               metadataFiles.add(metadata);
-                       else
-                               kickedOutPaths.add(metadataPaths[i]);
-               }
-
-               return metadataFiles;
-       }
-
-       /**
-        * Create RepositoryMetadata object.
-        * 
-        * @param repo
-        *            The path to the repository.
-        * @param metadataPath
-        *            The path to the metadata file.
-        * @return
-        */
-       private RepositoryMetadata buildMetadata(String repo, String metadataPath) {
-
-               RepositoryMetadata metadata = null;
-
-               try {
-                       URL url = new File(repo + "/" + metadataPath).toURL();
-                       InputStream is = url.openStream();
-                       Reader reader = new InputStreamReader(is);
-                       MetadataXpp3Reader metadataReader = new MetadataXpp3Reader();
-
-                       Metadata m = metadataReader.read(reader);
-                       String metaGroupId = m.getGroupId();
-                       String metaArtifactId = m.getArtifactId();
-                       String metaVersion = m.getVersion();
-
-                       // check if the groupId, artifactId and version is in the
-                       // metadataPath
-                       // parse the path, in reverse order
-                       List pathParts = new ArrayList();
-                       StringTokenizer st = new StringTokenizer(metadataPath, "/\\");
-                       while (st.hasMoreTokens()) {
-                               pathParts.add(st.nextToken());
-                       }
-
-                       Collections.reverse(pathParts);
-                       // remove the metadata file
-                       pathParts.remove(0);
-                       Iterator it = pathParts.iterator();
-                       String tmpDir = (String) it.next();
-
-                       ArtifactHandler handler = new DefaultArtifactHandler("jar");
-                       VersionRange version = VersionRange.createFromVersion(metaVersion);
-                       Artifact artifact = new DefaultArtifact(metaGroupId,
-                                       metaArtifactId, version, "compile", "jar", "", handler);
-
-                       // snapshotMetadata
-                       if (tmpDir.equals(metaVersion)) {
-                               metadata = new SnapshotArtifactRepositoryMetadata(artifact);
-                       } else if (tmpDir.equals(metaArtifactId)) {
-                               // artifactMetadata
-                               metadata = new ArtifactRepositoryMetadata(artifact);
-                       } else {
-
-                               String groupDir = "";
-                               int ctr = 0;
-                               for (it = pathParts.iterator(); it.hasNext();) {
-                                       if (ctr == 0)
-                                               groupDir = (String) it.next();
-                                       else
-                                               groupDir = (String) it.next() + "." + groupDir;
-                                       ctr++;
-                               }
-
-                               // groupMetadata
-                               if (metaGroupId.equals(groupDir))
-                                       metadata = new GroupRepositoryMetadata(metaGroupId);
-                       }
-
-               } catch (FileNotFoundException fe) {
-                       return null;
-               } catch (XmlPullParserException xe) {
-                       return null;
-               } catch (IOException ie) {
-                       return null;
-               }
-
-               return metadata;
-       }
-
-       /**
-        * Scan or search for metadata files.
-        * 
-        * @param repositoryBase
-        *            The repository directory.
-        * @param blacklistedPatterns
-        *            The patterns to be exluded from the search.
-        * @return
-        */
-       private String[] scanForMetadataPaths(File repositoryBase,
-                       String blacklistedPatterns) {
-
-               List allExcludes = new ArrayList();
-               allExcludes.addAll(FileUtils.getDefaultExcludesAsList());
-               allExcludes.addAll(Arrays.asList(STANDARD_DISCOVERY_EXCLUDES));
-
-               if (blacklistedPatterns != null && blacklistedPatterns.length() > 0) {
-                       allExcludes.addAll(Arrays.asList(blacklistedPatterns.split(",")));
-               }
-
-               DirectoryScanner scanner = new DirectoryScanner();
-               scanner.setBasedir(repositoryBase);
-               scanner.setIncludes(STANDARD_DISCOVERY_INCLUDES);
-               scanner.setExcludes((String[]) allExcludes.toArray(EMPTY_STRING_ARRAY));
-               scanner.scan();
-
-               excludedPaths.addAll(Arrays.asList(scanner.getExcludedFiles()));
-
-               return scanner.getIncludedFiles();
-
-       }
-
-       public Iterator getExcludedPathsIterator() {
-               return excludedPaths.iterator();
-       }
-
-       public Iterator getKickedOutPathsIterator() {
-               return kickedOutPaths.iterator();
-       }
+public class DefaultMetadataDiscoverer
+    implements MetadataDiscoverer
+{
+
+    /**
+     * Standard patterns to exclude from discovery as they are not artifacts.
+     */
+    private static final String[] STANDARD_DISCOVERY_EXCLUDES = {"bin/**", "reports/**", ".maven/**", "**/*.md5",
+        "**/*.MD5", "**/*.sha1", "**/*.SHA1", "**/*snapshot-version", "*/website/**", "*/licenses/**", "*/licences/**",
+        "**/.htaccess", "**/*.html", "**/*.asc", "**/*.txt", "**/README*", "**/CHANGELOG*", "**/KEYS*"};
+
+    /**
+     * Standard patterns to include in discovery of metadata files.
+     */
+    private static final String[] STANDARD_DISCOVERY_INCLUDES = {"**/*-metadata.xml", "**/*/*-metadata.xml",
+        "**/*/*/*-metadata.xml", "**/*-metadata-*.xml", "**/*/*-metadata-*.xml", "**/*/*/*-metadata-*.xml"};
+
+    private static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+    private List excludedPaths = new ArrayList();
+
+    private List kickedOutPaths = new ArrayList();
+
+    /**
+     * Search the repository for metadata files.
+     *
+     * @param repositoryBase
+     * @param blacklistedPatterns
+     */
+    public List discoverMetadata( File repositoryBase, String blacklistedPatterns )
+    {
+        List metadataFiles = new ArrayList();
+        String[] metadataPaths = scanForMetadataPaths( repositoryBase, blacklistedPatterns );
+
+        for ( int i = 0; i < metadataPaths.length; i++ )
+        {
+            RepositoryMetadata metadata = buildMetadata( repositoryBase
+                .getPath(), metadataPaths[i] );
+
+            if ( metadata != null )
+            {
+                metadataFiles.add( metadata );
+            }
+            else
+            {
+                kickedOutPaths.add( metadataPaths[i] );
+            }
+        }
+
+        return metadataFiles;
+    }
+
+    /**
+     * Create RepositoryMetadata object.
+     *
+     * @param repo         The path to the repository.
+     * @param metadataPath The path to the metadata file.
+     * @return
+     */
+    private RepositoryMetadata buildMetadata( String repo, String metadataPath )
+    {
+
+        RepositoryMetadata metadata = null;
+
+        try
+        {
+            URL url = new File( repo + "/" + metadataPath ).toURL();
+            InputStream is = url.openStream();
+            Reader reader = new InputStreamReader( is );
+            MetadataXpp3Reader metadataReader = new MetadataXpp3Reader();
+
+            Metadata m = metadataReader.read( reader );
+            String metaGroupId = m.getGroupId();
+            String metaArtifactId = m.getArtifactId();
+            String metaVersion = m.getVersion();
+
+            // check if the groupId, artifactId and version is in the
+            // metadataPath
+            // parse the path, in reverse order
+            List pathParts = new ArrayList();
+            StringTokenizer st = new StringTokenizer( metadataPath, "/\\" );
+            while ( st.hasMoreTokens() )
+            {
+                pathParts.add( st.nextToken() );
+            }
+
+            Collections.reverse( pathParts );
+            // remove the metadata file
+            pathParts.remove( 0 );
+            Iterator it = pathParts.iterator();
+            String tmpDir = (String) it.next();
+
+            ArtifactHandler handler = new DefaultArtifactHandler( "jar" );
+            VersionRange version = VersionRange.createFromVersion( metaVersion );
+            Artifact artifact =
+                new DefaultArtifact( metaGroupId, metaArtifactId, version, "compile", "jar", "", handler );
+
+            // snapshotMetadata
+            if ( tmpDir.equals( metaVersion ) )
+            {
+                metadata = new SnapshotArtifactRepositoryMetadata( artifact );
+            }
+            else if ( tmpDir.equals( metaArtifactId ) )
+            {
+                // artifactMetadata
+                metadata = new ArtifactRepositoryMetadata( artifact );
+            }
+            else
+            {
+
+                String groupDir = "";
+                int ctr = 0;
+                for ( it = pathParts.iterator(); it.hasNext(); )
+                {
+                    if ( ctr == 0 )
+                    {
+                        groupDir = (String) it.next();
+                    }
+                    else
+                    {
+                        groupDir = (String) it.next() + "." + groupDir;
+                    }
+                    ctr++;
+                }
+
+                // groupMetadata
+                if ( metaGroupId.equals( groupDir ) )
+                {
+                    metadata = new GroupRepositoryMetadata( metaGroupId );
+                }
+            }
+
+        }
+        catch ( FileNotFoundException fe )
+        {
+            return null;
+        }
+        catch ( XmlPullParserException xe )
+        {
+            return null;
+        }
+        catch ( IOException ie )
+        {
+            return null;
+        }
+
+        return metadata;
+    }
+
+    /**
+     * Scan or search for metadata files.
+     *
+     * @param repositoryBase      The repository directory.
+     * @param blacklistedPatterns The patterns to be exluded from the search.
+     * @return
+     */
+    private String[] scanForMetadataPaths( File repositoryBase, String blacklistedPatterns )
+    {
+
+        List allExcludes = new ArrayList();
+        allExcludes.addAll( FileUtils.getDefaultExcludesAsList() );
+        allExcludes.addAll( Arrays.asList( STANDARD_DISCOVERY_EXCLUDES ) );
+
+        if ( blacklistedPatterns != null && blacklistedPatterns.length() > 0 )
+        {
+            allExcludes.addAll( Arrays.asList( blacklistedPatterns.split( "," ) ) );
+        }
+
+        DirectoryScanner scanner = new DirectoryScanner();
+        scanner.setBasedir( repositoryBase );
+        scanner.setIncludes( STANDARD_DISCOVERY_INCLUDES );
+        scanner.setExcludes( (String[]) allExcludes.toArray( EMPTY_STRING_ARRAY ) );
+        scanner.scan();
+
+        excludedPaths.addAll( Arrays.asList( scanner.getExcludedFiles() ) );
+
+        return scanner.getIncludedFiles();
+
+    }
+
+    public Iterator getExcludedPathsIterator()
+    {
+        return excludedPaths.iterator();
+    }
+
+    public Iterator getKickedOutPathsIterator()
+    {
+        return kickedOutPaths.iterator();
+    }
 
 }
index a9e0eb82e3513ad29297e8de5c70e984f66be1e2..b41cef5538c757269f91e740048e19b64818e9b9 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.discovery;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index a5ed87588c6c30be4caa372769af716e653e6898..516123ceaa5ab83fb33334a0e662d835ecc8cd67 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.discovery;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,33 +22,31 @@ import java.util.List;
 
 /**
  * Interface for discovering metadata files.
- * 
  */
-public interface MetadataDiscoverer {
-       String ROLE = MetadataDiscoverer.class.getName();
+public interface MetadataDiscoverer
+{
+    String ROLE = MetadataDiscoverer.class.getName();
 
-       /**
-        * Search for metadata files in the repository.
-        * 
-        * @param repositoryBase
-        *            The repository directory.
-        * @param blacklistedPatterns
-        *            Patterns that are to be excluded from the discovery process.
-        * @return
-        */
-       List discoverMetadata(File repositoryBase, String blacklistedPatterns);
+    /**
+     * Search for metadata files in the repository.
+     *
+     * @param repositoryBase      The repository directory.
+     * @param blacklistedPatterns Patterns that are to be excluded from the discovery process.
+     * @return
+     */
+    List discoverMetadata( File repositoryBase, String blacklistedPatterns );
 
-       /**
-        * Get the list of paths kicked out during the discovery process.
-        * 
-        * @return the paths as Strings.
-        */
-       Iterator getKickedOutPathsIterator();
+    /**
+     * Get the list of paths kicked out during the discovery process.
+     *
+     * @return the paths as Strings.
+     */
+    Iterator getKickedOutPathsIterator();
 
-       /**
-        * Get the list of paths excluded during the discovery process.
-        * 
-        * @return the paths as Strings.
-        */
-       Iterator getExcludedPathsIterator();
+    /**
+     * Get the list of paths excluded during the discovery process.
+     *
+     * @return the paths as Strings.
+     */
+    Iterator getExcludedPathsIterator();
 }
index 3e8ef2c3929af33cac7a74b6bea5ce16b311d08a..4bda86fe28f7d614c715c0910c5fe36ae15eb57e 100644 (file)
@@ -1,11 +1,27 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <component-set>
   <components>
     <component>
-       <role>org.apache.maven.repository.discovery.MetadataDiscoverer</role>
-       <role-hint>default</role-hint>
-       <implementation>org.apache.maven.repository.discovery.DefaultMetadataDiscoverer</implementation>
-       <instantiation-strategy>per-lookup</instantiation-strategy>
-    </component>    
+      <role>org.apache.maven.repository.discovery.MetadataDiscoverer</role>
+      <role-hint>default</role-hint>
+      <implementation>org.apache.maven.repository.discovery.DefaultMetadataDiscoverer</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+    </component>
     <component>
       <role>org.apache.maven.repository.discovery.ArtifactDiscoverer</role>
       <role-hint>legacy</role-hint>
index 6d2ef2427e9d09aa686e528a897eb41ed9ca4696..9de8ce7aebd7e64c0dfc8d9a55cabdd21e2722d2 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.discovery;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -275,8 +275,8 @@ public class DefaultArtifactDiscovererTest
         List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, true );
         assertNotNull( "Check artifacts not null", artifacts );
 
-        assertTrue( "Check normal included",
-                    artifacts.contains( createArtifact( "org.apache.maven", "testing", "1.0", "java-source", "sources" ) ) );
+        assertTrue( "Check normal included", artifacts.contains(
+            createArtifact( "org.apache.maven", "testing", "1.0", "java-source", "sources" ) ) );
     }
 
     public void testDistributionInclusion()
index f4df65bbf9e4d8a81557c2b5a924c336fc4837e8..fa19654172c147ca04144b8940a64fefaf6818f8 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.discovery;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,12 +16,12 @@ package org.apache.maven.repository.discovery;
  * limitations under the License.
  */
 
+import org.codehaus.plexus.PlexusTestCase;
+
 import java.io.File;
 import java.util.Iterator;
 import java.util.List;
 
-import org.codehaus.plexus.PlexusTestCase;
-
 /**
  * This class tests the DefaultMetadataDiscoverer class.
  */
index cf33067d6bdf744e5044a5643c43a618ee370711..b28a30551fdd3d1d7c8c148d16e7a4b16c769e2a 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.discovery;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -260,8 +260,8 @@ public class LegacyArtifactDiscovererTest
         List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, true );
         assertNotNull( "Check artifacts not null", artifacts );
 
-        assertTrue( "Check normal included",
-                    artifacts.contains( createArtifact( "org.apache.maven", "testing", "1.0", "java-source", "sources" ) ) );
+        assertTrue( "Check normal included", artifacts.contains(
+            createArtifact( "org.apache.maven", "testing", "1.0", "java-source", "sources" ) ) );
     }
 
     public void testDistributionInclusion()
index 96d11ff311e076130c40e7e1328119ba0ed7aba7..17775863bc5f2552e55f25531aa8044e96910187 100644 (file)
@@ -1,3 +1,19 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <metadata>
   <groupId>javax.sql</groupId>
   <artifactId>jdbc</artifactId>
index 96d11ff311e076130c40e7e1328119ba0ed7aba7..17775863bc5f2552e55f25531aa8044e96910187 100644 (file)
@@ -1,3 +1,19 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <metadata>
   <groupId>javax.sql</groupId>
   <artifactId>jdbc</artifactId>
index 78ab1f9ee700a232b0ddf9330fd74824a72b5138..214b7dc2854ce97a64c467deff1afe3199764af0 100644 (file)
@@ -1,3 +1,19 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <metadata>
   <groupId>javax.sql</groupId>
   <artifactId>jdbc</artifactId>
index 96d11ff311e076130c40e7e1328119ba0ed7aba7..17775863bc5f2552e55f25531aa8044e96910187 100644 (file)
@@ -1,3 +1,19 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <metadata>
   <groupId>javax.sql</groupId>
   <artifactId>jdbc</artifactId>
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f947561484e76ed9bfc8f488b23d8e33afcaef1d 100644 (file)
@@ -0,0 +1,16 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
index 7d1fc5fd9e06773bcd152beb2769d0ca024de7d0..09d2d548188a5f251da83802d59b8968fe9903cd 100644 (file)
@@ -1,3 +1,19 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
index 1ab6046225a8f5139fbda003af6750db42fef4ac..9d5e304c3503378100f694cc997282320d787c38 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.indexing;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,13 +16,13 @@ package org.apache.maven.repository.indexing;
  * limitations under the License.
  */
 
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.IndexWriter;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
 
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriter;
-
 /**
  * Abstract class for RepositoryIndexers
  *
@@ -33,10 +32,13 @@ public abstract class AbstractRepositoryIndex
     implements RepositoryIndex
 {
     protected String indexPath;
+
     protected boolean indexOpen;
+
     protected IndexReader indexReader;
+
     protected IndexWriter indexWriter;
-    
+
     /**
      * method to encapsulate the optimize() method for lucene
      */
@@ -67,11 +69,11 @@ public abstract class AbstractRepositoryIndex
     {
         return indexOpen;
     }
-    
+
     /**
      * method used to close all open streams to the index directory
      */
-    public void close() 
+    public void close()
         throws RepositoryIndexException
     {
         try
@@ -112,7 +114,7 @@ public abstract class AbstractRepositoryIndex
             throw new RepositoryIndexException( e );
         }
     }
-    
+
     public String getIndexPath()
     {
         return indexPath;
@@ -135,10 +137,10 @@ public abstract class AbstractRepositoryIndex
             indexReader = IndexReader.open( indexPath );
         }
     }
-    
+
     /**
      * method for validating an index directory
-     * 
+     *
      * @throws RepositoryIndexException if the given indexPath is not valid for this type of RepositoryIndex
      */
     protected void validateIndex()
@@ -152,18 +154,18 @@ public abstract class AbstractRepositoryIndex
             {
                 Collection fields = indexReader.getFieldNames();
                 String[] indexFields = getIndexFields();
-                for( int idx=0; idx<indexFields.length; idx++ )
+                for ( int idx = 0; idx < indexFields.length; idx++ )
                 {
-                    if ( !fields.contains( indexFields[ idx ] ) )
+                    if ( !fields.contains( indexFields[idx] ) )
                     {
-                        throw new RepositoryIndexException( "The Field " + indexFields[ idx ] + " does not exist in " +
-                                "index path " + indexPath + "." );
+                        throw new RepositoryIndexException(
+                            "The Field " + indexFields[idx] + " does not exist in " + "index path " + indexPath + "." );
                     }
                 }
             }
             else
             {
-                System.out.println("Skipping index field validations for empty index." );
+                System.out.println( "Skipping index field validations for empty index." );
             }
         }
         else if ( !indexDir.exists() )
index 38da7d24691d09fad15fc5122ebc1c84eddbd305..c07ffdb5c769457916157f3436f45ac26560d17d 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.indexing;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,6 +16,12 @@ package org.apache.maven.repository.indexing;
  * limitations under the License.
  */
 
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.SimpleAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.maven.artifact.Artifact;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -29,12 +34,6 @@ import java.util.zip.ZipEntry;
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
 
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.SimpleAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.maven.artifact.Artifact;
-
 
 /**
  * Class used to index Artifact objects in a specified repository
@@ -45,23 +44,33 @@ public class ArtifactRepositoryIndex
     extends AbstractRepositoryIndex
 {
     private static final String NAME = "name";
+
     private static final String GROUPID = "groupId";
+
     private static final String ARTIFACTID = "artifactId";
+
     private static final String VERSION = "version";
+
     private static final String SHA1 = "sha1";
+
     private static final String MD5 = "md5";
+
     private static final String CLASSES = "classes";
+
     private static final String PACKAGES = "packages";
+
     private static final String FILES = "files";
-    
-    private static final String[] FIELDS = { NAME, GROUPID, ARTIFACTID, VERSION, SHA1, MD5,
-                                               CLASSES, PACKAGES, FILES };
-    
+
+    private static final String[] FIELDS = {NAME, GROUPID, ARTIFACTID, VERSION, SHA1, MD5, CLASSES, PACKAGES, FILES};
+
     private Analyzer analyzer;
+
     private StringBuffer classes;
+
     private StringBuffer packages;
+
     private StringBuffer files;
-    
+
     /**
      * method to get the Analyzer used to create indices
      *
@@ -73,7 +82,7 @@ public class ArtifactRepositoryIndex
         {
             analyzer = new ArtifactRepositoryIndexAnalyzer( new SimpleAnalyzer() );
         }
-        
+
         return analyzer;
     }
 
@@ -92,7 +101,7 @@ public class ArtifactRepositoryIndex
      *
      * @param obj the object to be indexed by this indexer
      */
-    public void index(Object obj) 
+    public void index( Object obj )
         throws RepositoryIndexException
     {
         if ( obj instanceof Artifact )
@@ -101,8 +110,8 @@ public class ArtifactRepositoryIndex
         }
         else
         {
-            throw new RepositoryIndexException( "This instance of indexer cannot index instances of " + 
-                    obj.getClass().getName() );
+            throw new RepositoryIndexException(
+                "This instance of indexer cannot index instances of " + obj.getClass().getName() );
         }
     }
 
@@ -124,7 +133,7 @@ public class ArtifactRepositoryIndex
             getIndexWriter();
 
             processArtifactContents( artifact.getFile() );
-            
+
             //@todo should some of these fields be Keyword instead of Text ?
             Document doc = new Document();
             doc.add( Field.Text( NAME, artifact.getFile().getName() ) );
@@ -140,7 +149,7 @@ public class ArtifactRepositoryIndex
 
             removeBuffers();
         }
-        catch( Exception e )
+        catch ( Exception e )
         {
             throw new RepositoryIndexException( e );
         }
@@ -152,7 +161,7 @@ public class ArtifactRepositoryIndex
         FileInputStream fIn = new FileInputStream( artifact.getFile() );
         return new String( getChecksum( fIn, "SHA-1" ) );
     }
-    
+
     private String getMd5( Artifact artifact )
         throws FileNotFoundException, IOException, NoSuchAlgorithmException
     {
@@ -213,21 +222,24 @@ public class ArtifactRepositoryIndex
     private boolean addIfClassEntry( ZipEntry entry )
     {
         boolean isAdded = false;
-        
+
         String name = entry.getName();
-        if( name.endsWith( ".class") )
+        if ( name.endsWith( ".class" ) )
         {
             // TODO verify if class is public or protected
-            if( name.lastIndexOf( "$" ) == -1)
+            if ( name.lastIndexOf( "$" ) == -1 )
             {
                 int idx = name.lastIndexOf( '/' );
-                if ( idx < 0 ) idx = 0;
+                if ( idx < 0 )
+                {
+                    idx = 0;
+                }
                 String classname = name.substring( idx, name.length() - 6 );
                 classes.append( classname ).append( "\n" );
                 isAdded = true;
             }
         }
-        
+
         return isAdded;
     }
 
@@ -245,7 +257,7 @@ public class ArtifactRepositoryIndex
             }
             isAdded = true;
         }
-        
+
         return isAdded;
     }
 
@@ -265,7 +277,7 @@ public class ArtifactRepositoryIndex
             files.append( name ).append( "\n" );
             isAdded = true;
         }
-        
+
         return isAdded;
     }
 }
index de1f17587af2313cd251fec390293984bdfb105a..ba09036313a83467287f71e34b5c451b8993bde6 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.indexing;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,12 +16,12 @@ package org.apache.maven.repository.indexing;
  * limitations under the License.
  */
 
-import java.io.Reader;
-
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.CharTokenizer;
 import org.apache.lucene.analysis.TokenStream;
 
+import java.io.Reader;
+
 /**
  * Class created specifically to index artifacts
  *
@@ -35,7 +34,7 @@ public class ArtifactRepositoryIndexAnalyzer
 
     /**
      * constructor to for this analyzer
-     * 
+     *
      * @character defaultAnalyzer the analyzer to use as default for the general fields of the artifact indeces
      */
     public ArtifactRepositoryIndexAnalyzer( Analyzer defaultAnalyzer )
@@ -45,11 +44,10 @@ public class ArtifactRepositoryIndexAnalyzer
 
     /**
      * Method called by lucence during indexing operations
-     * 
+     *
+     * @return an analyzer to specific to the field name or the default analyzer if none is present
      * @character fieldName the field name that the lucene object is currently processing
      * @character reader a Reader object to the index stream
-     * 
-     * @return an analyzer to specific to the field name or the default analyzer if none is present
      */
     public TokenStream tokenStream( String fieldName, Reader reader )
     {
@@ -66,7 +64,7 @@ public class ArtifactRepositoryIndexAnalyzer
 
         return tokenStream;
     }
-    
+
     /**
      * Class used to tokenize an artifact's version.
      */
@@ -85,20 +83,20 @@ public class ArtifactRepositoryIndexAnalyzer
 
         /**
          * method that lucene calls to check tokenization of a stream character
-         * 
-         * @param character char currently being processed
          *
+         * @param character char currently being processed
          * @return true if the char is a token, false if the char is a stop char
          */
         protected boolean isTokenChar( char character )
         {
             boolean token;
 
-            switch( character )
+            switch ( character )
             {
-                case '.': 
-                case '-': 
-                    token = false; break;
+                case '.':
+                case '-':
+                    token = false;
+                    break;
                 default:
                     token = true;
             }
index 87fc927083fceda5d7976620427818b2ca8eed90..c03548ae2b3381fe15a96e728ab0255fb08e6242 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.indexing;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,8 +16,6 @@ package org.apache.maven.repository.indexing;
  * limitations under the License.
  */
 
-import java.util.ArrayList;
-import java.util.List;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.queryParser.QueryParser;
 import org.apache.lucene.search.Hits;
@@ -28,62 +25,70 @@ import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 
+import java.util.ArrayList;
+import java.util.List;
+
 
 /**
  * This class searches the index for existing artifacts that contains the
  * specified query string.
- * 
  */
 public class ArtifactRepositoryIndexSearcher
     implements RepositoryIndexSearcher
 {
-       private static final String NAME = "name";
-       private static final String GROUPID = "groupId";
-       private static final String ARTIFACTID = "artifactId";
-       private static final String VERSION = "version";
-
-       private IndexSearcher searcher;
-       private ArtifactRepository repository;
-       private ArtifactFactory factory;
-       
-       /**
-        * Search the artifact that contains the query string in the specified
-        * search field.
-        * 
-        * @param queryString
-        * @param searchField
-        * @return
-        */
-       public List search( RepositoryIndex index, String queryString, String searchField )
+    private static final String NAME = "name";
+
+    private static final String GROUPID = "groupId";
+
+    private static final String ARTIFACTID = "artifactId";
+
+    private static final String VERSION = "version";
+
+    private IndexSearcher searcher;
+
+    private ArtifactRepository repository;
+
+    private ArtifactFactory factory;
+
+    /**
+     * Search the artifact that contains the query string in the specified
+     * search field.
+     *
+     * @param queryString
+     * @param searchField
+     * @return
+     */
+    public List search( RepositoryIndex index, String queryString, String searchField )
     {
         List artifactList = new ArrayList();
 
-               try {
+        try
+        {
             searcher = new IndexSearcher( index.getIndexPath() );
             QueryParser parser = new QueryParser( searchField, index.getAnalyzer() );
             Query qry = parser.parse( queryString );
             Hits hits = searcher.search( qry );
-                        //System.out.println("HITS SIZE --> " + hits.length());
+            //System.out.println("HITS SIZE --> " + hits.length());
 
-                       for ( int i = 0; i < hits.length(); i++ )
+            for ( int i = 0; i < hits.length(); i++ )
             {
-                               Document doc = hits.doc( i );
+                Document doc = hits.doc( i );
 
                 String groupId = doc.get( GROUPID );
                 String artifactId = doc.get( ARTIFACTID );
                 String version = doc.get( VERSION );
-                String name = doc.get( NAME);
+                String name = doc.get( NAME );
                 String packaging = name.substring( name.lastIndexOf( '.' ) + 1 );
                 Artifact artifact = factory.createBuildArtifact( groupId, artifactId, version, packaging );
-                
+
                 artifactList.add( artifact );
-                       }
-               }
+            }
+        }
         catch ( Exception e )
         {
-                       e.printStackTrace();
-               }
+            e.printStackTrace();
+        }
 
-               return artifactList;
-       }
+        return artifactList;
+    }
 }
index 39de6e6cc235fd15deef985fc1bcb4ac2e51d410..29b8bc5149e5844ca9427efa65bc698624218bb3 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.indexing;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -20,26 +19,29 @@ package org.apache.maven.repository.indexing;
 import org.apache.lucene.analysis.Analyzer;
 
 /**
- *
  * @author Edwin Punzalan
  */
 public interface RepositoryIndex
 {
     String ROLE = RepositoryIndex.class.getName();
-    
+
     String[] getIndexFields();
-    
+
     boolean isOpen();
 
-    void index( Object obj ) throws RepositoryIndexException;
+    void index( Object obj )
+        throws RepositoryIndexException;
 
-    void close() throws RepositoryIndexException;
+    void close()
+        throws RepositoryIndexException;
 
-    void open( String indexPath ) throws RepositoryIndexException;
+    void open( String indexPath )
+        throws RepositoryIndexException;
 
-    void optimize() throws RepositoryIndexException;
+    void optimize()
+        throws RepositoryIndexException;
 
     Analyzer getAnalyzer();
-    
+
     String getIndexPath();
 }
index b323b967177cb848b271fcc7098acc88cbe1193e..c9dd41e7fd8fa10b08802ee13c9dfd787f564517 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.indexing;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,7 +17,6 @@ package org.apache.maven.repository.indexing;
  */
 
 /**
- *
  * @author Edwin Punzalan
  */
 public class RepositoryIndexException
@@ -28,12 +26,12 @@ public class RepositoryIndexException
     {
         super( message, cause );
     }
-    
+
     public RepositoryIndexException( Throwable cause )
     {
         super( cause );
     }
-    
+
     public RepositoryIndexException( String message )
     {
         super( message );
index 76309ba90a1ad014c62e2098c6bab2c33c9cd11f..81ca498d5bb54754eb5035da44f9cae46475e7ad 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.indexing;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,18 +21,19 @@ import java.util.List;
 /**
  *
  */
-public interface RepositoryIndexSearcher {
+public interface RepositoryIndexSearcher
+{
 
-       String ROLE = RepositoryIndexSearcher.class.getName();
-       
-       /**
-        * Search the artifact that contains the query string in the specified
-        * search field.
-        * 
+    String ROLE = RepositoryIndexSearcher.class.getName();
+
+    /**
+     * Search the artifact that contains the query string in the specified
+     * search field.
+     *
      * @param index
-        * @param queryString
-        * @param searchField
-        * @return
-        */
-       public List search( RepositoryIndex index, String queryString, String searchField );
+     * @param queryString
+     * @param searchField
+     * @return
+     */
+    public List search( RepositoryIndex index, String queryString, String searchField );
 }
index 483ca418b77c408281b5a5572d04bb990afbcdfb..4cc04b397a38cd27671236441fdca86854e63640 100644 (file)
@@ -1,3 +1,19 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <component-set>
   <components>
     <component>
index 254fa1ddbd141ac491a2bd72df72015b8a87b48e..742545a9452810e647f32d7d443edf2a5abb49fc 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.indexing;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -9,7 +9,6 @@ package org.apache.maven.repository.indexing;
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
- *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
index 007fd95b76a0bcd149ae36503455fd806027663d..02d2de17b3160e39f9c9fedc71be8786be331382 100755 (executable)
@@ -1,3 +1,19 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-artifact-manager</artifactId>
     </dependency>
-<!--
-    <dependency>
-      <groupId>org.apache.maven.repository</groupId>
-      <artifactId>maven-repository-discovery</artifactId>
-    </dependency>
--->
+    <!--
+        <dependency>
+          <groupId>org.apache.maven.repository</groupId>
+          <artifactId>maven-repository-discovery</artifactId>
+        </dependency>
+    -->
   </dependencies>
   <build>
     <plugins>
index 7f2d4e43c36417707ab359f3f734b2726ed700aa..d024a934d14594845e64aa4d60abe23b015349ab 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,10 +16,6 @@ package org.apache.maven.repository.reporting;
  * limitations under the License.
  */
 
-import java.io.File;
-import java.io.FileReader;
-import java.util.List;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
@@ -28,6 +23,10 @@ import org.apache.maven.artifact.repository.metadata.Metadata;
 import org.apache.maven.artifact.repository.metadata.Snapshot;
 import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
 
+import java.io.File;
+import java.io.FileReader;
+import java.util.List;
+
 /**
  *
  */
@@ -53,15 +52,15 @@ public abstract class AbstractRepositoryQueryLayer
         throws RepositoryQueryLayerException
     {
         Metadata metadata = getMetadata( artifact );
-        
+
         return metadata.getVersioning().getVersions();
     }
 
     protected String getSnapshotArtifactRepositoryPath( Artifact artifact, Snapshot snapshot )
     {
         File f = new File( repository.getBasedir(), repository.pathOf( artifact ) );
-        String snapshotInfo = artifact.getVersion().replaceFirst( "SNAPSHOT", snapshot.getTimestamp() + "-" + 
-                                                                            snapshot.getBuildNumber() + ".pom" );
+        String snapshotInfo = artifact.getVersion().replaceFirst( "SNAPSHOT", snapshot.getTimestamp() + "-" +
+            snapshot.getBuildNumber() + ".pom" );
         File snapshotFile = new File( f.getParentFile(), artifact.getArtifactId() + "-" + snapshotInfo );
         return snapshotFile.getAbsolutePath();
     }
index b965c537d14bcc17bc272de47a82081c7cdf90c2..d7fad91c96f5855a59fb974903191b780122221b 100644 (file)
@@ -1,20 +1,19 @@
 package org.apache.maven.repository.reporting;
 
-/* 
- * Copyright 2001-2005 The Apache Software Foundation. 
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
-
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 import org.apache.maven.artifact.Artifact;
@@ -22,8 +21,8 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.model.Model;
 
 /**
- * This interface will be called by the main system for each artifact as it is discovered. This is how each of the 
- *      different types of reports are implemented.
+ * This interface will be called by the main system for each artifact as it is discovered. This is how each of the
+ * different types of reports are implemented.
  */
 public interface ArtifactReportProcessor
 {
index 5b19ccdbc1282242ce6d1321ae728186e4677de3..4dfb932972ed1b6f51ac977488f30757876bec47 100644 (file)
@@ -1,19 +1,19 @@
 package org.apache.maven.repository.reporting;
 
-/* 
- * Copyright 2001-2005 The Apache Software Foundation. 
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 import org.apache.maven.artifact.Artifact;
@@ -33,15 +33,25 @@ public interface ArtifactReporter
     String ROLE = ArtifactReporter.class.getName();
 
     public static String NULL_MODEL = "Provided model was null";
+
     public static String NULL_ARTIFACT = "Provided artifact was null";
+
     public static String EMPTY_GROUP_ID = "Group id was empty or null";
+
     public static String EMPTY_ARTIFACT_ID = "Artifact id was empty or null";
+
     public static String EMPTY_VERSION = "Version was empty or null";
+
     public static String EMPTY_DEPENDENCY_GROUP_ID = "Group id was empty or null";
+
     public static String EMPTY_DEPENDENCY_ARTIFACT_ID = "Artifact id was empty or null";
+
     public static String EMPTY_DEPENDENCY_VERSION = "Version was empty or null";
+
     public static String NO_DEPENDENCIES = "Artifact has no dependencies";
+
     public static String ARTIFACT_NOT_FOUND = "Artifact does not exist in the repository";
+
     public static String DEPENDENCY_NOT_FOUND = "Artifact's dependency does not exist in the repository";
 
     void addFailure( Artifact artifact, String reason );
index fd91b9f6a0938f30b64daca71892495ddcff80e3..6c0aba90029bd600e56d136a21a284fa13189385 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 18e7c0e8c0e1d314c2db2f4debe4a92433b50a41..645468d44fce75a1ea532a762689bf67e838eb67 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -46,14 +46,13 @@ public class BadMetadataReportProcessor
 
     private RepositoryQueryLayerFactory repositoryQueryLayerFactory;
 
-    
+
     /**
      * Process the metadata encountered in the repository and report all errors found, if any.
      *
      * @param metadata   the metadata to be processed.
      * @param repository the repository where the metadata was encountered
      * @param reporter   the ArtifactReporter to receive processing results
-     *
      * @throws ReportProcessorException if an error was occurred while processing the metadata
      */
     public void processMetadata( RepositoryMetadata metadata, ArtifactRepository repository, ArtifactReporter reporter )
@@ -105,7 +104,7 @@ public class BadMetadataReportProcessor
                 }
             }
         }
-        
+
         if ( !hasFailures )
         {
             reporter.addSuccess( metadata );
@@ -120,7 +119,7 @@ public class BadMetadataReportProcessor
      * @param reporter   the ArtifactReporter to receive processing results
      */
     protected boolean checkPluginMetadata( RepositoryMetadata metadata, ArtifactRepository repository,
-                                        ArtifactReporter reporter )
+                                           ArtifactReporter reporter )
         throws IOException
     {
         boolean hasFailures = false;
@@ -144,7 +143,7 @@ public class BadMetadataReportProcessor
             String prefix = plugin.getPrefix();
             if ( prefix == null || prefix.length() == 0 )
             {
-                reporter.addFailure( metadata, "Missing or empty plugin prefix for artifactId " + artifactId + ".");
+                reporter.addFailure( metadata, "Missing or empty plugin prefix for artifactId " + artifactId + "." );
                 hasFailures = true;
             }
             else
@@ -174,10 +173,10 @@ public class BadMetadataReportProcessor
                 }
             }
         }
-        
+
         if ( pluginDirs.size() > 0 )
         {
-            for( Iterator plugins = pluginDirs.iterator(); plugins.hasNext(); )
+            for ( Iterator plugins = pluginDirs.iterator(); plugins.hasNext(); )
             {
                 File plugin = (File) plugins.next();
                 reporter.addFailure( metadata, "Plugin " + plugin.getName() + " is present in the repository but " +
@@ -197,7 +196,7 @@ public class BadMetadataReportProcessor
      * @param reporter   the ArtifactReporter to receive processing results
      */
     protected boolean checkSnapshotMetadata( RepositoryMetadata metadata, ArtifactRepository repository,
-                                           ArtifactReporter reporter )
+                                             ArtifactReporter reporter )
     {
         RepositoryQueryLayer repositoryQueryLayer =
             repositoryQueryLayerFactory.createRepositoryQueryLayer( repository );
@@ -226,7 +225,7 @@ public class BadMetadataReportProcessor
      * @param reporter   the ArtifactReporter to receive processing results
      */
     protected boolean checkMetadataVersions( RepositoryMetadata metadata, ArtifactRepository repository,
-                                           ArtifactReporter reporter )
+                                             ArtifactReporter reporter )
     {
         RepositoryQueryLayer repositoryQueryLayer =
             repositoryQueryLayerFactory.createRepositoryQueryLayer( repository );
@@ -258,7 +257,7 @@ public class BadMetadataReportProcessor
      * @param reporter   the ArtifactReporter to receive processing results
      */
     protected boolean checkRepositoryVersions( RepositoryMetadata metadata, ArtifactRepository repository,
-                                             ArtifactReporter reporter )
+                                               ArtifactReporter reporter )
         throws IOException
     {
         boolean hasFailures = false;
@@ -297,7 +296,7 @@ public class BadMetadataReportProcessor
     {
         return artifactFactory.createBuildArtifact( metadata.getGroupId(), metadata.getArtifactId(), version, "pom" );
     }
-    
+
     /**
      * Used to gather artifactIds from a groupId directory
      */
@@ -305,12 +304,12 @@ public class BadMetadataReportProcessor
         throws IOException
     {
         List artifactIdFiles = new ArrayList();
-        
+
         List fileArray = new ArrayList( Arrays.asList( groupIdDir.listFiles() ) );
-        for( Iterator files=fileArray.iterator(); files.hasNext(); )
+        for ( Iterator files = fileArray.iterator(); files.hasNext(); )
         {
             File artifactDir = (File) files.next();
-            
+
             if ( artifactDir.isDirectory() )
             {
                 List versions = FileUtils.getFileNames( artifactDir, "*/*.pom", null, false );
@@ -320,7 +319,7 @@ public class BadMetadataReportProcessor
                 }
             }
         }
-        
+
         return artifactIdFiles;
     }
 }
index 8c0e88d49b37904e5b233afe11e3c8bb83970306..bb748b75d9056941526a237756dd87d3b1fa1d1f 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,17 +21,19 @@ import java.util.Map;
 
 /**
  * Class to implement caching
- *
  */
 public class Cache
 {
     private Map cache;
 
     private DblLinkedList mostRecent;
+
     private double cacheHitRatio = 0;
+
     private long cacheMaxSize = 0;
-    
+
     private long cacheHits = 0;
+
     private long cacheMiss = 0;
 
     /**
@@ -53,27 +54,26 @@ public class Cache
 
     /**
      * Caches all data and expires only the oldest data when either the specified cache hit rate is reached
-     *     or the maximum cache size is reached.
+     * or the maximum cache size is reached.
      */
     public Cache( double cacheHitRatio, long cacheMaxSize )
     {
         this.cacheHitRatio = cacheHitRatio;
         this.cacheMaxSize = cacheMaxSize;
-        
+
         cache = new HashMap();
     }
-    
+
     /**
      * Check if the specified key is already mapped to an object.
      *
      * @param key the key used to map the cached object
-     *
      * @returns true if the cache contains an object associated with the given key
      */
     public boolean containsKey( Object key )
     {
         boolean contains = cache.containsKey( key );
-        
+
         if ( contains )
         {
             cacheHits++;
@@ -82,29 +82,28 @@ public class Cache
         {
             cacheMiss++;
         }
-        
+
         return contains;
     }
-    
+
     /**
      * Check for a cached object and return it if it exists. Returns null when the keyed object is not found
      *
      * @param key the key used to map the cached object
-     *
      * @returns the object mapped to the given key, or null if no cache object is mapped to the given key
      */
     public Object get( Object key )
     {
         Object retValue = null;
-        
+
         if ( cache.containsKey( key ) )
         {
             DblLinkedList cacheEntry = (DblLinkedList) cache.get( key );
-            
+
             makeMostRecent( cacheEntry );
-            
+
             retValue = cacheEntry.cacheValue;
-            
+
             cacheHits++;
         }
         else
@@ -147,7 +146,7 @@ public class Cache
     {
         return ( cacheHits == 0 && cacheMiss == 0 ) ? 0 : ( (double) cacheHits ) / (double) ( cacheHits + cacheMiss );
     }
-    
+
     /**
      * Get the total number of cache objects currently cached.
      */
@@ -155,14 +154,16 @@ public class Cache
     {
         return cache.size();
     }
-    
+
     /**
      * Empty the cache and reset the cache hit rate
      */
     public void flush()
     {
         while ( cache.size() > 0 )
+        {
             trimCache();
+        }
         cacheHits = 0;
         cacheMiss = 0;
         cache = new HashMap();
@@ -186,10 +187,14 @@ public class Cache
     private void removeFromLinks( DblLinkedList list )
     {
         if ( list.prev != null )
+        {
             list.prev.next = list.next;
+        }
         if ( list.next != null )
+        {
             list.next.prev = list.prev;
-        
+        }
+
         list.prev = null;
         list.next = null;
     }
@@ -207,7 +212,7 @@ public class Cache
         else if ( cache.size() > cacheMaxSize )
         {
             // maximum cache size is reached
-            while( cache.size() > cacheMaxSize )
+            while ( cache.size() > cacheMaxSize )
             {
                 trimCache();
             }
@@ -236,23 +241,29 @@ public class Cache
             mostRecent = null;
         }
     }
-    
+
     private DblLinkedList getLeastRecent()
     {
         DblLinkedList trail = mostRecent;
 
-        while( trail.next != null )
+        while ( trail.next != null )
+        {
             trail = trail.next;
+        }
 
         return trail;
     }
 
-    private class DblLinkedList {
+    private class DblLinkedList
+    {
         Object cacheKey;
+
         Object cacheValue;
+
         DblLinkedList prev;
+
         DblLinkedList next;
-        
+
         public DblLinkedList( Object key, Object value )
         {
             this.cacheKey = key;
index d1637cdd3001aeb9173621e41807dd643484cd6c..73e77432023f9b9848674a9c4b67c4c3b1d87e46 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,18 +16,12 @@ package org.apache.maven.repository.reporting;
  * limitations under the License.
  */
 
-import java.io.File;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Map;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.metadata.Metadata;
 import org.apache.maven.artifact.repository.metadata.Snapshot;
 
 
-
 /**
  * 
  */
@@ -37,23 +30,23 @@ public class CachedRepositoryQueryLayer
 {
     private Cache cache;
 
-    
+
     public CachedRepositoryQueryLayer( ArtifactRepository repository )
     {
         this.repository = repository;
-        
+
         cache = new Cache( 0.5 );
     }
-    
+
     public double getCacheHitRate()
     {
         return cache.getHitRate();
     }
-    
+
     public boolean containsArtifact( Artifact artifact )
     {
         boolean artifactFound = true;
-        
+
         // @todo should check for snapshot artifacts
         String artifactPath = repository.getBasedir() + "/" + repository.pathOf( artifact );
 
@@ -94,13 +87,13 @@ public class CachedRepositoryQueryLayer
         throws RepositoryQueryLayerException
     {
         Metadata metadata = (Metadata) cache.get( artifact.getId() );
-        
+
         if ( metadata == null )
         {
             metadata = super.getMetadata( artifact );
             cache.put( artifact.getId(), metadata );
         }
-        
+
         return metadata;
     }
 }
index 44eebf136357e51494d7ad467964fd5ab7885798..ed77edd88685924d9743592eb44813a9ef6950c3 100644 (file)
@@ -1,22 +1,26 @@
 package org.apache.maven.repository.reporting;
 
-/* 
- * Copyright 2001-2005 The Apache Software Foundation. 
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
-
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
+import org.apache.maven.model.Model;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -27,13 +31,8 @@ import java.net.URL;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
-import org.apache.maven.model.Model;
-import org.apache.maven.artifact.repository.*;
-
 /**
- * This class reports invalid and mismatched checksums of artifacts and metadata files. 
+ * This class reports invalid and mismatched checksums of artifacts and metadata files.
  * It validates MD5 and SHA-1 checksums.
  */
 public class ChecksumArtifactReporter
@@ -49,13 +48,14 @@ public class ChecksumArtifactReporter
 
     /**
      * Validate the checksum of the specified artifact.
+     *
      * @param model
      * @param artifact
      * @param reporter
      * @param repository
      */
     public void processArtifact( Model model, Artifact artifact, ArtifactReporter reporter,
-                                ArtifactRepository repository )
+                                 ArtifactRepository repository )
     {
         //System.out.println( " " );
         //System.out
@@ -74,9 +74,9 @@ public class ChecksumArtifactReporter
             repositoryUrl = repository.getBasedir();
         }
 
-        artifactUrl = repositoryUrl + artifact.getGroupId() + "/" + artifact.getArtifactId() + "/"
-            + artifact.getBaseVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getBaseVersion() + "."
-            artifact.getType();
+        artifactUrl = repositoryUrl + artifact.getGroupId() + "/" + artifact.getArtifactId() + "/" +
+            artifact.getBaseVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getBaseVersion() + "." +
+            artifact.getType();
 
         //check if checksum files exist
         boolean md5Exists = getMD5File( artifactUrl );
@@ -116,7 +116,7 @@ public class ChecksumArtifactReporter
     }
 
     /**
-     * Validate the checksums of the metadata. Get the metadata file from the 
+     * Validate the checksums of the metadata. Get the metadata file from the
      * repository then validate the checksum.
      */
     public void processMetadata( RepositoryMetadata metadata, ArtifactRepository repository, ArtifactReporter reporter )
@@ -141,8 +141,8 @@ public class ChecksumArtifactReporter
         if ( metadata.storedInArtifactVersionDirectory() == true && metadata.storedInGroupDirectory() == false )
         {
             //version metadata
-            metadataUrl = repositoryUrl + metadata.getGroupId() + "/" + metadata.getArtifactId() + "/"
-                metadata.getBaseVersion() + "/";
+            metadataUrl = repositoryUrl + metadata.getGroupId() + "/" + metadata.getArtifactId() + "/" +
+                metadata.getBaseVersion() + "/";
         }
         else if ( metadata.storedInArtifactVersionDirectory() == false && metadata.storedInGroupDirectory() == true )
         {
@@ -198,6 +198,7 @@ public class ChecksumArtifactReporter
 
     /**
      * Get the MD5 Checksum file. If not found, return false.
+     *
      * @param filename The name of the artifact whose MD5 Checksum file will be retrieved.
      * @return
      */
@@ -226,6 +227,7 @@ public class ChecksumArtifactReporter
 
     /**
      * Get the SHA1 Checksum file. If not found, return false.
+     *
      * @param filename The name of the artifact whose SHA-1 Checksum file will be retrieved.
      * @return
      */
@@ -253,8 +255,9 @@ public class ChecksumArtifactReporter
 
     /**
      * Validate the checksum of the file.
+     *
      * @param fileUrl The file to be validated.
-     * @param algo The checksum algorithm used. 
+     * @param algo    The checksum algorithm used.
      * @return
      */
     protected boolean validateChecksum( String fileUrl, String algo )
@@ -267,7 +270,9 @@ public class ChecksumArtifactReporter
             //Create checksum for jar file
             String ext = ".md5";
             if ( algo.equals( "SHA-1" ) )
+            {
                 ext = ".sha1";
+            }
             chk1 = createChecksum( fileUrl, algo );
             if ( chk1 != null )
             {
@@ -320,8 +325,9 @@ public class ChecksumArtifactReporter
 
     /**
      * Create a checksum from the specified metadata file.
+     *
      * @param filename The file that will be created a checksum.
-     * @param algo The algorithm to be used (MD5, SHA-1)
+     * @param algo     The algorithm to be used (MD5, SHA-1)
      * @return
      * @throws FileNotFoundException
      * @throws NoSuchAlgorithmException
@@ -364,6 +370,7 @@ public class ChecksumArtifactReporter
     /**
      * Convert an incoming array of bytes into a string that represents each of
      * the bytes as two hex characters.
+     *
      * @param data
      * @return
      */
@@ -383,7 +390,9 @@ public class ChecksumArtifactReporter
 
             //Append a leading 0 if necessary so that each hex string will contain 2 characters.
             if ( tempStr.length() == 1 )
+            {
                 tempStr = "0" + tempStr;
+            }
 
             //Concatenate the two characters to the output string.
             output = output + tempStr;
index cad66e62d2e5823be2eaeda99ceaef55324334df..8af45d652c322616b855cad622a4f93966f4b020 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,14 +16,14 @@ package org.apache.maven.repository.reporting;
  * limitations under the License.
  */
 
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Dependency;
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Model;
 
-import java.util.List;
 import java.util.Iterator;
+import java.util.List;
 
 /**
  * 
index 18dac5ced1d2c628de4d1c26a8ea031af30646ce..a0c167fea5296ef878007af56db529b3105b6bbb 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
-
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -20,9 +19,9 @@ package org.apache.maven.repository.reporting;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
 
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.ArrayList;
 
 /**
  * 
@@ -101,6 +100,7 @@ public class DefaultArtifactReporter
     {
         return metadataWarnings.iterator();
     }
+
     public int getFailures()
     {
         return artifactFailures.size() + metadataFailures.size();
index 73a0b9f4d8c9bc87c260c11e8336d1a5a329b6ca..5570666dde2cc4dce615ae141bdef60ba682baec 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,17 +16,7 @@ package org.apache.maven.repository.reporting;
  * limitations under the License.
  */
 
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.metadata.Snapshot;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.List;
-import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
-import org.apache.maven.artifact.repository.metadata.Metadata;
-import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
 
 /**
  * 
index 32e3b79e9dc1c3add068d29e4dbdc7ee04c64952..2043637681943ad279cfec219c3f4fa0973ffc54 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 865ba7d644b50b866683139a6b66f90567d84103..620450dc6dc9356499268a35afbceb3cdf671811 100644 (file)
@@ -1,22 +1,27 @@
 package org.apache.maven.repository.reporting;
 
-/* 
- * Copyright 2001-2005 The Apache Software Foundation. 
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
-
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -26,70 +31,81 @@ import java.io.Reader;
 import java.net.MalformedURLException;
 import java.net.URL;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
 /**
  * This class validates well-formedness of pom xml file.
  */
 public class InvalidPomArtifactReportProcessor
     implements ArtifactReportProcessor
 {
-   
+
     /**
      * @param model
-     * @param artifact The pom xml file to be validated, passed as an artifact object.
-     * @param reporter The artifact reporter object.
+     * @param artifact   The pom xml file to be validated, passed as an artifact object.
+     * @param reporter   The artifact reporter object.
      * @param repository the repository where the artifact is located.
      */
     public void processArtifact( Model model, Artifact artifact, ArtifactReporter reporter,
-                                ArtifactRepository repository )
+                                 ArtifactRepository repository )
     {
-        InputStream is = null;        
-        
-        if((artifact.getType().toLowerCase()).equals("pom")){
-            
-            if(repository.getProtocol().equals("file")){
-                try{
-                    is = new FileInputStream(repository.getBasedir() + artifact.getGroupId() + "/" + 
-                         artifact.getArtifactId() + "/" + artifact.getBaseVersion() + "/" + 
-                         artifact.getArtifactId() + "-" + artifact.getBaseVersion() + "." + 
-                         artifact.getType());
-                }catch(FileNotFoundException fe){
-                    reporter.addFailure(artifact, "Artifact not found.");
+        InputStream is = null;
+
+        if ( ( artifact.getType().toLowerCase() ).equals( "pom" ) )
+        {
+
+            if ( repository.getProtocol().equals( "file" ) )
+            {
+                try
+                {
+                    is = new FileInputStream( repository.getBasedir() + artifact.getGroupId() + "/" +
+                        artifact.getArtifactId() + "/" + artifact.getBaseVersion() + "/" + artifact.getArtifactId() +
+                        "-" + artifact.getBaseVersion() + "." + artifact.getType() );
                 }
-            }else{
-                try{
-                    URL url = new URL(repository.getUrl() + artifact.getGroupId() + "/" + 
-                         artifact.getArtifactId() + "/" + artifact.getBaseVersion() + "/" + 
-                         artifact.getArtifactId() + "-" + artifact.getBaseVersion() + "." + 
-                         artifact.getType());
+                catch ( FileNotFoundException fe )
+                {
+                    reporter.addFailure( artifact, "Artifact not found." );
+                }
+            }
+            else
+            {
+                try
+                {
+                    URL url = new URL( repository.getUrl() + artifact.getGroupId() + "/" + artifact.getArtifactId() +
+                        "/" + artifact.getBaseVersion() + "/" + artifact.getArtifactId() + "-" +
+                        artifact.getBaseVersion() + "." + artifact.getType() );
                     is = url.openStream();
-                    
-                }catch(MalformedURLException me){
-                    reporter.addFailure(artifact, "Error retrieving artifact from remote repository.");
-                }catch(IOException ie){
-                    reporter.addFailure(artifact, "Error retrieving artifact from remote repository.");
+
+                }
+                catch ( MalformedURLException me )
+                {
+                    reporter.addFailure( artifact, "Error retrieving artifact from remote repository." );
+                }
+                catch ( IOException ie )
+                {
+                    reporter.addFailure( artifact, "Error retrieving artifact from remote repository." );
                 }
             }
-            
-            Reader reader = new InputStreamReader(is);
+
+            Reader reader = new InputStreamReader( is );
             MavenXpp3Reader pomReader = new MavenXpp3Reader();
-            
-            try{
-                Model pomModel = pomReader.read(reader);
-                reporter.addSuccess(artifact);
-            }catch(XmlPullParserException xe){
-                reporter.addFailure(artifact, "The pom xml file is not well-formed. Error while parsing.");                
-            }catch(IOException oe){
-                reporter.addFailure(artifact, "Error while reading the pom xml file.");
+
+            try
+            {
+                Model pomModel = pomReader.read( reader );
+                reporter.addSuccess( artifact );
+            }
+            catch ( XmlPullParserException xe )
+            {
+                reporter.addFailure( artifact, "The pom xml file is not well-formed. Error while parsing." );
             }
-            
-        }else{
-            reporter.addWarning(artifact, "The artifact is not a pom xml file.");
+            catch ( IOException oe )
+            {
+                reporter.addFailure( artifact, "Error while reading the pom xml file." );
+            }
+
+        }
+        else
+        {
+            reporter.addWarning( artifact, "The artifact is not a pom xml file." );
         }
     }
 
index 2dd31439641ea9ad5a309bfb663f4f9e714b076b..fa5b847f6f857a63c0a1fe8e0d1eafef3f7af393 100644 (file)
@@ -1,22 +1,27 @@
 package org.apache.maven.repository.reporting;
 
-/* 
- * Copyright 2001-2005 The Apache Software Foundation. 
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
-
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.codehaus.plexus.util.FileUtils;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -28,12 +33,6 @@ import java.net.URL;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.codehaus.plexus.util.FileUtils;
-
 /**
  * Validate the location of the artifact based on the values indicated
  * in its pom (both the pom packaged with the artifact & the pom in the
@@ -49,18 +48,18 @@ public class LocationArtifactReportProcessor
     /**
      * Check whether the artifact is in its proper location. The location of the artifact
      * is validated first against the groupId, artifactId and versionId in the specified model
-     * object (pom in the file system). Then unpack the artifact (jar file) and get the model (pom) 
-     * included in the package. If a model exists inside the package, then check if the artifact's 
+     * object (pom in the file system). Then unpack the artifact (jar file) and get the model (pom)
+     * included in the package. If a model exists inside the package, then check if the artifact's
      * location is valid based on the location specified in the pom. Check if the both the location
      * specified in the file system pom and in the pom included in the package is the same.
-     * 
-     * @param model Represents the pom in the file system.
-     * @param artifact 
+     *
+     * @param model      Represents the pom in the file system.
+     * @param artifact
      * @param reporter
      * @param repository
      */
     public void processArtifact( Model model, Artifact artifact, ArtifactReporter reporter,
-                                ArtifactRepository repository )
+                                 ArtifactRepository repository )
     {
         boolean fsPomLocation = false, pkgPomLocation = false;
         String repositoryUrl = "", modelArtifactLocation = "";
@@ -77,27 +76,27 @@ public class LocationArtifactReportProcessor
 
         //check if the artifact is located in its proper location based on the info
         //specified in the model object/pom
-        modelArtifactLocation = repositoryUrl + model.getGroupId() + "/" + model.getArtifactId() + "/"
-            model.getVersion() + "/" + model.getArtifactId() + "-" + model.getVersion() + "." + model.getPackaging();
+        modelArtifactLocation = repositoryUrl + model.getGroupId() + "/" + model.getArtifactId() + "/" +
+            model.getVersion() + "/" + model.getArtifactId() + "-" + model.getVersion() + "." + model.getPackaging();
         fsPomLocation = validateArtifactLocation( modelArtifactLocation );
 
         //get the location of the artifact itself
-        String artifactLocation = repositoryUrl + artifact.getGroupId() + "/" + artifact.getArtifactId() + "/"
-            + artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getVersion() + "."
-            artifact.getType();
+        String artifactLocation = repositoryUrl + artifact.getGroupId() + "/" + artifact.getArtifactId() + "/" +
+            artifact.getVersion() + "/" + artifact.getArtifactId() + "-" + artifact.getVersion() + "." +
+            artifact.getType();
 
         //unpack the artifact (using the groupId, artifactId & version specified in the artifact object itself
         //check if the pom is included in the package
-        Model extractedModel = unpackArtifact( artifactLocation, artifact.getGroupId(), artifact.getArtifactId(),
-                                               artifact.getVersion() );
+        Model extractedModel =
+            unpackArtifact( artifactLocation, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );
 
         if ( extractedModel != null )
         {
 
-            String pkgPomArtifactLocation = repositoryUrl + extractedModel.getGroupId() + "/"
-                + extractedModel.getArtifactId() + "/" + extractedModel.getVersion() + "/"
-                + extractedModel.getArtifactId() + "-" + extractedModel.getVersion() + "."
-                extractedModel.getPackaging();
+            String pkgPomArtifactLocation = repositoryUrl + extractedModel.getGroupId() + "/" +
+                extractedModel.getArtifactId() + "/" + extractedModel.getVersion() + "/" +
+                extractedModel.getArtifactId() + "-" + extractedModel.getVersion() + "." +
+                extractedModel.getPackaging();
             pkgPomLocation = validateArtifactLocation( pkgPomArtifactLocation );
 
             //check the conditions
@@ -143,7 +142,7 @@ public class LocationArtifactReportProcessor
 
     /**
      * Validate the if the artifact exists in the specified location.
-     * 
+     *
      * @param filename
      * @return
      */
@@ -172,7 +171,7 @@ public class LocationArtifactReportProcessor
 
     /**
      * Extract the contents of the artifact/jar file.
-     * 
+     *
      * @param filename
      * @param groupId
      * @param artifactId
index aecfdfd35b8681df2cdfba0a5852a7ba6e7b66bd..0431a8adf296e56f551d4b82d384e6f883898754 100644 (file)
@@ -1,20 +1,19 @@
 package org.apache.maven.repository.reporting;
 
-/* 
- * Copyright 2001-2005 The Apache Software Foundation. 
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
-
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
index 5c1fa2a81dc9fb1a222135228dc3545de31fa37a..5f73dbdc00099fcc573e6341f51fa5dd059767f0 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 0d10ea4f5dae122b9ed80d5ceef967d4e24787c0..4c962986a02f4fdc527894d6ee54e0943563f4d1 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index f6b92fb7ae135f98f3e9c3a91f246902537bfdb0..942b052fe5859e93b564c1e5539383dd3486907c 100644 (file)
@@ -1,26 +1,26 @@
 package org.apache.maven.repository.reporting;
 
-/* 
- * Copyright 2001-2005 The Apache Software Foundation. 
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
-
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
-import java.util.List;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.metadata.Snapshot;
 
+import java.util.List;
+
 /**
  * The transitive and metadata validation reports will need to query the repository for artifacts.
  */
@@ -29,11 +29,13 @@ public interface RepositoryQueryLayer
     String ROLE = RepositoryQueryLayer.class.getName();
 
     public final static boolean ARTIFACT_FOUND = true;
+
     public final static boolean ARTIFACT_NOT_FOUND = false;
 
     boolean containsArtifact( Artifact artifact );
 
     boolean containsArtifact( Artifact artifact, Snapshot snapshot );
-    
-    List getVersions( Artifact artifact ) throws RepositoryQueryLayerException;
+
+    List getVersions( Artifact artifact )
+        throws RepositoryQueryLayerException;
 }
index bdfd2b368154fdac4877f718ea4df3ecc39ec7b0..ae7f779470b6700e95b824c509f5aec64494155e 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -27,7 +26,7 @@ public class RepositoryQueryLayerException
     {
         super( message, cause );
     }
-    
+
     public RepositoryQueryLayerException( String message )
     {
         super( message );
index e001c32fa195ef03810bc8ff7fa51048bcdcea4a..00f42b30d12d805e9e34b53fb92a076ba79a0213 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 5c8112e0bd942c2c0dd8362d8e591b1229bf688e..f7e3e17cdcdd2d044d52220e2b8fa109333d0a3e 100644 (file)
@@ -1,3 +1,19 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <component-set>
   <components>
     <component>
       </requirements>
     </component>
     <component>
-       <role>org.apache.maven.repository.reporting.ArtifactReportProcessor</role>
-       <role-hint>checksum</role-hint>
-       <implementation>org.apache.maven.repository.reporting.ChecksumArtifactReporter</implementation>
-       <instantiation-strategy>per-lookup</instantiation-strategy>
+      <role>org.apache.maven.repository.reporting.ArtifactReportProcessor</role>
+      <role-hint>checksum</role-hint>
+      <implementation>org.apache.maven.repository.reporting.ChecksumArtifactReporter</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
     </component>
     <component>
-       <role>org.apache.maven.repository.reporting.MetadataReportProcessor</role>
-       <role-hint>checksum-metadata</role-hint>
-       <implementation>org.apache.maven.repository.reporting.ChecksumArtifactReporter</implementation>
-       <instantiation-strategy>per-lookup</instantiation-strategy>
+      <role>org.apache.maven.repository.reporting.MetadataReportProcessor</role>
+      <role-hint>checksum-metadata</role-hint>
+      <implementation>org.apache.maven.repository.reporting.ChecksumArtifactReporter</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
     </component>
     <component>
-       <role>org.apache.maven.repository.reporting.ArtifactReportProcessor</role>
-       <role-hint>artifact-location</role-hint>
-       <implementation>org.apache.maven.repository.reporting.LocationArtifactReportProcessor</implementation>
-       <instantiation-strategy>per-lookup</instantiation-strategy>
-    </component>    
+      <role>org.apache.maven.repository.reporting.ArtifactReportProcessor</role>
+      <role-hint>artifact-location</role-hint>
+      <implementation>org.apache.maven.repository.reporting.LocationArtifactReportProcessor</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+    </component>
     <component>
-       <role>org.apache.maven.repository.reporting.ArtifactReportProcessor</role>
-       <role-hint>invalid-pom</role-hint>
-       <implementation>org.apache.maven.repository.reporting.InvalidPomArtifactReportProcessor</implementation>
-       <instantiation-strategy>per-lookup</instantiation-strategy>
-    </component> 
+      <role>org.apache.maven.repository.reporting.ArtifactReportProcessor</role>
+      <role-hint>invalid-pom</role-hint>
+      <implementation>org.apache.maven.repository.reporting.InvalidPomArtifactReportProcessor</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+    </component>
   </components>
 </component-set>
index 74c823bc89b3ed5d71f6ba3fb4f62453a4d66c86..17e98347c30607bfb8a7cd3048a01a920245dc29 100644 (file)
@@ -1,22 +1,23 @@
 package org.apache.maven.repository.reporting;
 
-/* 
- * Copyright 2001-2005 The Apache Software Foundation. 
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
-
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
+import org.codehaus.plexus.util.FileUtils;
+
 import java.io.BufferedOutputStream;
 import java.io.BufferedReader;
 import java.io.File;
@@ -32,7 +33,6 @@ import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
-import org.codehaus.plexus.util.FileUtils;
 
 /**
  * This class creates the artifact and metadata files used for testing the ChecksumArtifactReporter.
@@ -41,9 +41,9 @@ import org.codehaus.plexus.util.FileUtils;
 public class AbstractChecksumArtifactReporterTest
     extends AbstractRepositoryReportsTestCase
 {
-    protected static final String[] validArtifactChecksumJars = { "validArtifact-1.0" };
+    protected static final String[] validArtifactChecksumJars = {"validArtifact-1.0"};
 
-    protected static final String[] invalidArtifactChecksumJars = { "invalidArtifact-1.0" };
+    protected static final String[] invalidArtifactChecksumJars = {"invalidArtifact-1.0"};
 
     protected static final String metadataChecksumFilename = "maven-metadata-repository";
 
@@ -65,6 +65,7 @@ public class AbstractChecksumArtifactReporterTest
 
     /**
      * Create checksum files.
+     *
      * @param type The type of checksum file to be created.
      * @return
      */
@@ -101,6 +102,7 @@ public class AbstractChecksumArtifactReporterTest
 
     /**
      * Create checksum files for metadata.
+     *
      * @param type The type of checksum to be created. (Valid or invalid)
      * @return
      */
@@ -126,10 +128,11 @@ public class AbstractChecksumArtifactReporterTest
 
     /**
      * Create artifact together with its checksums.
+     *
      * @param relativePath The groupId
-     * @param filename The filename of the artifact to be created.
-     * @param type The file type (JAR)
-     * @param isValid Indicates whether the checksum to be created is valid or not.
+     * @param filename     The filename of the artifact to be created.
+     * @param type         The file type (JAR)
+     * @param isValid      Indicates whether the checksum to be created is valid or not.
      * @return
      */
     private boolean writeChecksumFile( String relativePath, String filename, String type, boolean isValid )
@@ -182,9 +185,13 @@ public class AbstractChecksumArtifactReporterTest
                     OutputStream os = new FileOutputStream( file );
                     OutputStreamWriter osw = new OutputStreamWriter( os );
                     if ( !isValid )
+                    {
                         osw.write( byteArrayToHexStr( md5chk ) + "1" );
+                    }
                     else
+                    {
                         osw.write( byteArrayToHexStr( md5chk ) );
+                    }
                     osw.close();
                 }
 
@@ -194,9 +201,13 @@ public class AbstractChecksumArtifactReporterTest
                     OutputStream os = new FileOutputStream( file );
                     OutputStreamWriter osw = new OutputStreamWriter( os );
                     if ( !isValid )
+                    {
                         osw.write( byteArrayToHexStr( sha1chk ) + "2" );
+                    }
                     else
+                    {
                         osw.write( byteArrayToHexStr( sha1chk ) );
+                    }
                     osw.close();
                 }
             }
@@ -210,10 +221,11 @@ public class AbstractChecksumArtifactReporterTest
 
     /**
      * Create metadata file together with its checksums.
+     *
      * @param relativePath The groupId
-     * @param filename The filename of the artifact to be created.
-     * @param type The file type (JAR)
-     * @param isValid Indicates whether the checksum to be created is valid or not.
+     * @param filename     The filename of the artifact to be created.
+     * @param type         The file type (JAR)
+     * @param isValid      Indicates whether the checksum to be created is valid or not.
      * @return
      */
     private boolean writeMetadataFile( String relativePath, String filename, String type, boolean isValid )
@@ -242,9 +254,13 @@ public class AbstractChecksumArtifactReporterTest
                 OutputStream os = new FileOutputStream( file );
                 OutputStreamWriter osw = new OutputStreamWriter( os );
                 if ( !isValid )
+                {
                     osw.write( byteArrayToHexStr( md5chk ) + "1" );
+                }
                 else
+                {
                     osw.write( byteArrayToHexStr( md5chk ) );
+                }
                 osw.close();
             }
 
@@ -254,9 +270,13 @@ public class AbstractChecksumArtifactReporterTest
                 OutputStream os = new FileOutputStream( file );
                 OutputStreamWriter osw = new OutputStreamWriter( os );
                 if ( !isValid )
+                {
                     osw.write( byteArrayToHexStr( sha1chk ) + "2" );
+                }
                 else
+                {
                     osw.write( byteArrayToHexStr( sha1chk ) );
+                }
                 osw.close();
             }
         }
@@ -271,6 +291,7 @@ public class AbstractChecksumArtifactReporterTest
 
     /**
      * Create the sample file that will be included in the jar.
+     *
      * @param filename
      * @return
      */
@@ -293,7 +314,7 @@ public class AbstractChecksumArtifactReporterTest
 
     /**
      * Create a checksum from the specified metadata file.
-     * 
+     *
      * @param metadataUrl
      * @return
      * @throws FileNotFoundException
@@ -326,6 +347,7 @@ public class AbstractChecksumArtifactReporterTest
     /**
      * Convert an incoming array of bytes into a string that represents each of
      * the bytes as two hex characters.
+     *
      * @param data
      * @return
      */
@@ -341,7 +363,9 @@ public class AbstractChecksumArtifactReporterTest
             tempStr = Integer.toHexString( tempInt );
 
             if ( tempStr.length() == 1 )
+            {
                 tempStr = "0" + tempStr;
+            }
             output = output + tempStr;
         }
 
@@ -350,6 +374,7 @@ public class AbstractChecksumArtifactReporterTest
 
     /**
      * Delete the test directory created in the repository.
+     *
      * @param dirname The directory to be deleted.
      * @return
      */
@@ -377,7 +402,6 @@ public class AbstractChecksumArtifactReporterTest
     }
 
     /**
-     * 
      * @return
      */
     protected boolean deleteChecksumFiles( String type )
@@ -388,29 +412,39 @@ public class AbstractChecksumArtifactReporterTest
         //delete valid checksum files of artifacts created
         for ( int i = 0; i < validArtifactChecksumJars.length; i++ )
         {
-            b = deleteFile( repository.getBasedir() + "checksumTest/" + validArtifactChecksumJars[i].replace( '-', '/' )
-                + "/" + validArtifactChecksumJars[i] + "." + type + ".md5" );
+            b = deleteFile( repository.getBasedir() + "checksumTest/" +
+                validArtifactChecksumJars[i].replace( '-', '/' ) + "/" + validArtifactChecksumJars[i] + "." + type +
+                ".md5" );
             if ( b == false )
+            {
                 return b;
+            }
 
-            b = deleteFile( repository.getBasedir() + "checksumTest/" + validArtifactChecksumJars[i].replace( '-', '/' )
-                + "/" + validArtifactChecksumJars[i] + "." + type + ".sha1" );
+            b = deleteFile( repository.getBasedir() + "checksumTest/" +
+                validArtifactChecksumJars[i].replace( '-', '/' ) + "/" + validArtifactChecksumJars[i] + "." + type +
+                ".sha1" );
             if ( b == false )
+            {
                 return b;
+            }
         }
 
         //delete valid checksum files of metadata file
         for ( int i = 0; i < validArtifactChecksumJars.length; i++ )
         {
-            b = deleteFile( repository.getBasedir() + "checksumTest/" + validArtifactChecksumJars[i].replace( '-', '/' )
-                + "/" + metadataChecksumFilename + ".xml.md5" );
+            b = deleteFile( repository.getBasedir() + "checksumTest/" +
+                validArtifactChecksumJars[i].replace( '-', '/' ) + "/" + metadataChecksumFilename + ".xml.md5" );
             if ( b == false )
+            {
                 return b;
+            }
 
-            b = deleteFile( repository.getBasedir() + "checksumTest/" + validArtifactChecksumJars[i].replace( '-', '/' )
-                + "/" + metadataChecksumFilename + ".xml.sha1" );
+            b = deleteFile( repository.getBasedir() + "checksumTest/" +
+                validArtifactChecksumJars[i].replace( '-', '/' ) + "/" + metadataChecksumFilename + ".xml.sha1" );
             if ( b == false )
+            {
                 return b;
+            }
         }
         return b;
     }
index b1633a826bf6c67c0f75bef42fbb3fb631500df1..79cf227d34bb3b76ba2e0fb92a8bb2355d7f609e 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,18 +16,17 @@ package org.apache.maven.repository.reporting;
  * limitations under the License.
  */
 
-import java.io.File;
-import java.util.List;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.artifact.repository.metadata.Snapshot;
-
 import org.codehaus.plexus.PlexusTestCase;
 
+import java.io.File;
+import java.util.List;
+
 /**
  *
  */
@@ -36,12 +34,13 @@ public abstract class AbstractRepositoryQueryLayerTest
     extends PlexusTestCase
 {
     protected ArtifactFactory artifactFactory;
-    
+
     protected ArtifactRepository repository;
-    
+
     protected CachedRepositoryQueryLayer queryLayer;
-    
-    protected void setUp() throws Exception
+
+    protected void setUp()
+        throws Exception
     {
         super.setUp();
         File repositoryDirectory = getTestFile( "src/test/repository" );
@@ -57,14 +56,14 @@ public abstract class AbstractRepositoryQueryLayerTest
     public void testContainsArtifactTrue()
     {
         Artifact artifact = getArtifact( "groupId", "artifactId", "1.0-alpha-1" );
-        
+
         assertTrue( "check artifact", queryLayer.containsArtifact( artifact ) );
     }
 
     public void testContainsArtifactFalse()
     {
         Artifact artifact = getArtifact( "groupId", "artifactId", "1.0-beta-1" );
-        
+
         assertFalse( "check non-existent artifact", queryLayer.containsArtifact( artifact ) );
     }
 
@@ -73,7 +72,7 @@ public abstract class AbstractRepositoryQueryLayerTest
         Snapshot snapshot = new Snapshot();
         snapshot.setTimestamp( "20050611.202024" );
         snapshot.setBuildNumber( 1 );
-        
+
         Artifact artifact = getArtifact( "groupId", "snapshot-artifact", "1.0-alpha-1-SNAPSHOT" );
         assertTrue( "check for snapshot artifact", queryLayer.containsArtifact( artifact, snapshot ) );
     }
@@ -83,18 +82,18 @@ public abstract class AbstractRepositoryQueryLayerTest
         Snapshot snapshot = new Snapshot();
         snapshot.setTimestamp( "20050611.202024" );
         snapshot.setBuildNumber( 2 );
-        
+
         Artifact artifact = getArtifact( "groupId", "snapshot-artifact", "1.0-alpha-1-SNAPSHOT" );
         assertFalse( "check for non-existent snapshot artifact", queryLayer.containsArtifact( artifact, snapshot ) );
     }
-    
+
     public void testArtifactVersionsTrue()
         throws Exception
     {
         Artifact artifact = getArtifact( "groupId", "artifactId", "ignored" );
-        
+
         List versions = queryLayer.getVersions( artifact );
-        
+
         assertTrue( "check version 1.0-alpha-1", versions.contains( "1.0-alpha-1" ) );
         assertTrue( "check version 1.0-alpha-2", versions.contains( "1.0-alpha-2" ) );
         assertFalse( "check version 1.0-alpha-3", versions.contains( "1.0-alpha-3" ) );
@@ -104,18 +103,18 @@ public abstract class AbstractRepositoryQueryLayerTest
         throws Exception
     {
         Artifact artifact = getArtifact( "groupId", "artifactId", "ignored" );
-        
+
         List versions = queryLayer.getVersions( artifact );
-        
+
         assertTrue( "check version 1.0-alpha-1", versions.contains( "1.0-alpha-1" ) );
         assertTrue( "check version 1.0-alpha-2", versions.contains( "1.0-alpha-2" ) );
         assertFalse( "check version 1.0-alpha-3", versions.contains( "1.0-alpha-3" ) );
     }
-    
+
     public void testArtifactVersionsError()
     {
         Artifact artifact = getArtifact( "groupId", "none", "ignored" );
-        
+
         try
         {
             queryLayer.getVersions( artifact );
@@ -132,7 +131,8 @@ public abstract class AbstractRepositoryQueryLayerTest
         return artifactFactory.createBuildArtifact( groupId, artifactId, version, "pom" );
     }
 
-    protected void tearDown() throws Exception
+    protected void tearDown()
+        throws Exception
     {
         release( artifactFactory );
         super.tearDown();
index 8d71ea4cb454ddfb7fd2c8a9bb71c6555bc6469b..45f12964e61e85bd2087f0ce9fcf5fca8f7f6339 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
-
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -48,7 +47,7 @@ public abstract class AbstractRepositoryReportsTestCase
     protected static final String remoteArtifactType = "jar";
 
     protected static final String remoteRepoId = "remote-repo";
-    
+
     protected void setUp()
         throws Exception
     {
@@ -58,8 +57,8 @@ public abstract class AbstractRepositoryReportsTestCase
         ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
         ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
 
-        repository =
-            factory.createArtifactRepository( "repository", repositoryDirectory.toURL().toString(), layout, null, null );
+        repository = factory.createArtifactRepository( "repository", repositoryDirectory.toURL().toString(), layout,
+                                                       null, null );
     }
 
 }
index ffb915d39b9af7aaceffd399167c8f1636a080f0..cd6bd78698e6c6bfdb42c846bff39c7311fc6394 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,9 +16,9 @@ package org.apache.maven.repository.reporting;
  * limitations under the License.
  */
 
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Dependency;
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Model;
 
 import java.util.Iterator;
 
index a5d3b7094074d9c9833183609c5fae747add88ee..91c9015addc2d63d94af8578bd25dd36ba2337ea 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@ package org.apache.maven.repository.reporting;
  * limitations under the License.
  */
 
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.metadata.Versioning;
 import org.apache.maven.model.Model;
 
index df6fa3bccfb3c0f2656a32e79e3fc4bd5acba4dd..a3368e5a40118b944cbf8e23f33475bc7febefbf 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ import org.apache.maven.artifact.repository.metadata.Versioning;
 import java.util.Iterator;
 
 /**
- * @todo???  should use MetadataXpp3Reader instead ?
+ * @todo??? should use MetadataXpp3Reader instead ?
  */
 public class BadMetadataReportProcessorTest
     extends AbstractRepositoryReportsTestCase
@@ -47,7 +47,7 @@ public class BadMetadataReportProcessorTest
 
         badMetadataReportProcessor = (MetadataReportProcessor) lookup( MetadataReportProcessor.ROLE );
     }
-    
+
     public void testMetadataMissingLastUpdated()
         throws ReportProcessorException
     {
@@ -67,12 +67,10 @@ public class BadMetadataReportProcessorTest
         assertTrue( "check there is a failure", failures.hasNext() );
         RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
         assertEquals( "check metadata", metadata, result.getMetadata() );
-        assertEquals( "check reason", 
-                      "Missing lastUpdated element inside the metadata.",
-                      result.getReason() );
+        assertEquals( "check reason", "Missing lastUpdated element inside the metadata.", result.getReason() );
         assertFalse( "check no more failures", failures.hasNext() );
     }
-    
+
     public void testMetadataValidVersions()
         throws ReportProcessorException
     {
@@ -118,7 +116,7 @@ public class BadMetadataReportProcessorTest
                       result.getReason() );
         assertFalse( "check no more failures", failures.hasNext() );
     }
-    
+
     public void testMetadataInvalidArtifactVersion()
         throws ReportProcessorException
     {
@@ -146,7 +144,7 @@ public class BadMetadataReportProcessorTest
                       result.getReason() );
         assertFalse( "check no more failures", failures.hasNext() );
     }
-    
+
     public void testMoreThanOneMetadataVersionErrors()
         throws ReportProcessorException
     {
@@ -188,13 +186,13 @@ public class BadMetadataReportProcessorTest
         RepositoryMetadata metadata = new GroupRepositoryMetadata( "groupId" );
         metadata.getMetadata().addPlugin( createMetadataPlugin( "artifactId", "default" ) );
         metadata.getMetadata().addPlugin( createMetadataPlugin( "snapshot-artifact", "default2" ) );
-        
+
         badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
-        
+
         Iterator failures = reporter.getRepositoryMetadataFailureIterator();
         assertFalse( "check there are no failures", failures.hasNext() );
     }
-    
+
     public void testMissingMetadataPlugin()
         throws ReportProcessorException
     {
@@ -204,14 +202,15 @@ public class BadMetadataReportProcessorTest
         metadata.getMetadata().addPlugin( createMetadataPlugin( "artifactId", "default" ) );
         metadata.getMetadata().addPlugin( createMetadataPlugin( "snapshot-artifact", "default2" ) );
         metadata.getMetadata().addPlugin( createMetadataPlugin( "missing-plugin", "default3" ) );
-        
+
         badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
 
         Iterator failures = reporter.getRepositoryMetadataFailureIterator();
         assertTrue( "check there is a failure", failures.hasNext() );
         RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
         // TODO: should be more robust
-        assertEquals( "check reason", "Metadata plugin missing-plugin not found in the repository", result.getReason() );
+        assertEquals( "check reason", "Metadata plugin missing-plugin not found in the repository",
+                      result.getReason() );
         assertFalse( "check no more failures", failures.hasNext() );
     }
 
@@ -222,18 +221,19 @@ public class BadMetadataReportProcessorTest
 
         RepositoryMetadata metadata = new GroupRepositoryMetadata( "groupId" );
         metadata.getMetadata().addPlugin( createMetadataPlugin( "artifactId", "default" ) );
-        
+
         badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
 
         Iterator failures = reporter.getRepositoryMetadataFailureIterator();
         assertTrue( "check there is a failure", failures.hasNext() );
         RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
         // TODO: should be more robust
-        assertEquals( "check reason", "Plugin snapshot-artifact is present in the repository but " +
-                    "missing in the metadata.", result.getReason() );
+        assertEquals( "check reason",
+                      "Plugin snapshot-artifact is present in the repository but " + "missing in the metadata.",
+                      result.getReason() );
         assertFalse( "check no more failures", failures.hasNext() );
     }
-    
+
     public void testInvalidPluginArtifactId()
         throws ReportProcessorException
     {
@@ -244,7 +244,7 @@ public class BadMetadataReportProcessorTest
         metadata.getMetadata().addPlugin( createMetadataPlugin( "snapshot-artifact", "default2" ) );
         metadata.getMetadata().addPlugin( createMetadataPlugin( null, "default3" ) );
         metadata.getMetadata().addPlugin( createMetadataPlugin( "", "default4" ) );
-        
+
         badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
 
         Iterator failures = reporter.getRepositoryMetadataFailureIterator();
@@ -258,7 +258,7 @@ public class BadMetadataReportProcessorTest
         assertEquals( "check reason", "Missing or empty artifactId in group metadata.", result.getReason() );
         assertFalse( "check no more failures", failures.hasNext() );
     }
-    
+
     public void testInvalidPluginPrefix()
         throws ReportProcessorException
     {
@@ -267,7 +267,7 @@ public class BadMetadataReportProcessorTest
         RepositoryMetadata metadata = new GroupRepositoryMetadata( "groupId" );
         metadata.getMetadata().addPlugin( createMetadataPlugin( "artifactId", null ) );
         metadata.getMetadata().addPlugin( createMetadataPlugin( "snapshot-artifact", "" ) );
-        
+
         badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
 
         Iterator failures = reporter.getRepositoryMetadataFailureIterator();
@@ -278,10 +278,11 @@ public class BadMetadataReportProcessorTest
         assertTrue( "check there is a 2nd failure", failures.hasNext() );
         result = (RepositoryMetadataResult) failures.next();
         // TODO: should be more robust
-        assertEquals( "check reason", "Missing or empty plugin prefix for artifactId snapshot-artifact.", result.getReason() );
+        assertEquals( "check reason", "Missing or empty plugin prefix for artifactId snapshot-artifact.",
+                      result.getReason() );
         assertFalse( "check no more failures", failures.hasNext() );
     }
-    
+
     public void testDuplicatePluginPrefixes()
         throws ReportProcessorException
     {
@@ -290,7 +291,7 @@ public class BadMetadataReportProcessorTest
         RepositoryMetadata metadata = new GroupRepositoryMetadata( "groupId" );
         metadata.getMetadata().addPlugin( createMetadataPlugin( "artifactId", "default" ) );
         metadata.getMetadata().addPlugin( createMetadataPlugin( "snapshot-artifact", "default" ) );
-        
+
         badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
 
         Iterator failures = reporter.getRepositoryMetadataFailureIterator();
@@ -305,18 +306,18 @@ public class BadMetadataReportProcessorTest
         throws ReportProcessorException
     {
         ArtifactReporter reporter = new MockArtifactReporter();
-        
-        Artifact artifact = artifactFactory.createBuildArtifact( "groupId", "snapshot-artifact", 
-                                                                 "1.0-alpha-1-SNAPSHOT", "type" );
+
+        Artifact artifact =
+            artifactFactory.createBuildArtifact( "groupId", "snapshot-artifact", "1.0-alpha-1-SNAPSHOT", "type" );
 
         Snapshot snapshot = new Snapshot();
         snapshot.setBuildNumber( 1 );
         snapshot.setTimestamp( "20050611.202024" );
 
         RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact, snapshot );
-        
+
         badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
-        
+
         Iterator failures = reporter.getRepositoryMetadataFailureIterator();
         assertFalse( "check there are no failures", failures.hasNext() );
     }
@@ -325,18 +326,18 @@ public class BadMetadataReportProcessorTest
         throws ReportProcessorException
     {
         ArtifactReporter reporter = new MockArtifactReporter();
-        
-        Artifact artifact = artifactFactory.createBuildArtifact( "groupId", "snapshot-artifact", 
-                                                                 "1.0-alpha-1-SNAPSHOT", "type" );
+
+        Artifact artifact =
+            artifactFactory.createBuildArtifact( "groupId", "snapshot-artifact", "1.0-alpha-1-SNAPSHOT", "type" );
 
         Snapshot snapshot = new Snapshot();
         snapshot.setBuildNumber( 2 );
         snapshot.setTimestamp( "20050611.202024" );
 
         RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact, snapshot );
-        
+
         badMetadataReportProcessor.processMetadata( metadata, repository, reporter );
-        
+
         Iterator failures = reporter.getRepositoryMetadataFailureIterator();
         assertTrue( "check there is a failure", failures.hasNext() );
         RepositoryMetadataResult result = (RepositoryMetadataResult) failures.next();
@@ -345,7 +346,7 @@ public class BadMetadataReportProcessorTest
         assertEquals( "check reason", "Snapshot artifact 20050611.202024-2 does not exist.", result.getReason() );
         assertFalse( "check no more failures", failures.hasNext() );
     }
-    
+
     private Plugin createMetadataPlugin( String artifactId, String prefix )
     {
         Plugin plugin = new Plugin();
index deebd0c9bfbaf16e07ecfe90063ca0fe69d0fa21..16698ffdf59078d9442b3764cda6e8683ee14cc0 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -31,19 +30,19 @@ public class CacheTest
     {
         cache = new Cache( 0.5 );
         newCacheObjectTests();
-        
+
         String key = "key";
         String value = "value";
-        for( int ctr=1; ctr<10; ctr++ )
+        for ( int ctr = 1; ctr < 10; ctr++ )
         {
             cache.put( key + ctr, value + ctr );
         }
-        
+
         while ( cache.getHitRate() < 0.75 )
         {
             cache.get( "key2" );
         }
-        cache.put( "key10", "value10");
+        cache.put( "key10", "value10" );
         assertNull( "first key must be expired", cache.get( "key1" ) );
     }
 
@@ -51,15 +50,15 @@ public class CacheTest
     {
         cache = new Cache( 9 );
         newCacheObjectTests();
-        
+
         String key = "key";
         String value = "value";
-        for( int ctr=1; ctr<10; ctr++ )
+        for ( int ctr = 1; ctr < 10; ctr++ )
         {
             cache.put( key + ctr, value + ctr );
         }
-        
-        cache.put( "key10", "value10");
+
+        cache.put( "key10", "value10" );
         assertNull( "first key must be expired", cache.get( "key1" ) );
         assertEquals( "check cache size to be max size", 9, cache.size() );
     }
@@ -68,10 +67,10 @@ public class CacheTest
     {
         cache = new Cache( 0.5, 9 );
         newCacheObjectTests();
-        
+
         String key = "key";
         String value = "value";
-        for( int ctr=1; ctr<5; ctr++ )
+        for ( int ctr = 1; ctr < 5; ctr++ )
         {
             cache.put( key + ctr, value + ctr );
         }
@@ -80,21 +79,21 @@ public class CacheTest
         {
             cache.get( "key3" );
         }
-        
-        cache.put( "key10", "value10");
+
+        cache.put( "key10", "value10" );
         assertNull( "first key must be expired", cache.get( "key1" ) );
 
         while ( cache.getHitRate() >= 0.5 )
         {
             cache.get( "key11" );
         }
-        
-        for( int ctr=5; ctr<10; ctr++ )
+
+        for ( int ctr = 5; ctr < 10; ctr++ )
         {
             cache.put( key + ctr, value + ctr );
         }
-        
-        cache.put( "key11", "value11");
+
+        cache.put( "key11", "value11" );
         assertNull( "second key must be expired", cache.get( "key2" ) );
         assertEquals( "check cache size to be max size", 9, cache.size() );
     }
@@ -103,16 +102,16 @@ public class CacheTest
     {
         cache = new Cache( 0.5, 9 );
         newCacheObjectTests();
-        
+
         String key = "key";
         String value = "value";
-        for( int ctr=1; ctr<10; ctr++ )
+        for ( int ctr = 1; ctr < 10; ctr++ )
         {
             cache.put( key + ctr, value + ctr );
         }
-        
-        cache.put( "key1", "value1");
-        cache.put( "key10", "value10");
+
+        cache.put( "key1", "value1" );
+        cache.put( "key10", "value10" );
         assertNull( "second key must be gone", cache.get( "key2" ) );
         assertEquals( "check cache size to be max size", 9, cache.size() );
     }
index 984f07ddddb91ef1d56761be908ae3c80ee98659..de18378a77740424d93d81af7f6a220f73af8b6a 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -23,13 +22,14 @@ package org.apache.maven.repository.reporting;
 public class CachedRepositoryQueryLayerTest
     extends AbstractRepositoryQueryLayerTest
 {
-    protected void setUp() throws Exception
+    protected void setUp()
+        throws Exception
     {
         super.setUp();
-        
+
         queryLayer = new CachedRepositoryQueryLayer( repository );
     }
-    
+
     public void testUseFileCache()
     {
         testContainsArtifactTrue();
@@ -37,7 +37,7 @@ public class CachedRepositoryQueryLayerTest
         testContainsArtifactTrue();
         assertEquals( 0.50, queryLayer.getCacheHitRate(), 0 );
     }
-    
+
     public void testUseMetadataCache()
         throws Exception
     {
@@ -46,7 +46,7 @@ public class CachedRepositoryQueryLayerTest
         testArtifactVersionsTrue();
         assertEquals( 0.50, queryLayer.getCacheHitRate(), 0 );
     }
-    
+
     public void testUseFileCacheOnSnapshot()
     {
         testContainsSnapshotArtifactTrue();
index 1905769981474a6d14c5ba4d3d9d4724509c12ba..6225dc05ddc068a5591d0a193abe5701e9a04249 100644 (file)
@@ -1,39 +1,36 @@
 package org.apache.maven.repository.reporting;
 
-/* 
- * Copyright 2001-2005 The Apache Software Foundation. 
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
-
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
-import java.io.File;
-import java.util.Iterator;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DefaultArtifact;
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
 import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
 import org.apache.maven.artifact.repository.metadata.GroupRepositoryMetadata;
 import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
 import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
 import org.apache.maven.artifact.versioning.VersionRange;
 
-/** 
- * This class tests the ChecksumArtifactReporter. 
+import java.io.File;
+import java.util.Iterator;
+
+/**
+ * This class tests the ChecksumArtifactReporter.
  * It extends the AbstractChecksumArtifactReporterTest class.
  */
 public class ChecksumArtifactReporterTest
@@ -91,8 +88,8 @@ public class ChecksumArtifactReporterTest
         {
             ArtifactHandler handler = new DefaultArtifactHandler( "jar" );
             VersionRange version = VersionRange.createFromVersion( "1.0" );
-            Artifact artifact = new DefaultArtifact( "checksumTest", "validArtifact", version, "compile", "jar", "",
-                                                     handler );
+            Artifact artifact =
+                new DefaultArtifact( "checksumTest", "validArtifact", version, "compile", "jar", "", handler );
 
             artifactReportProcessor.processArtifact( null, artifact, reporter, repository );
             assertTrue( reporter.getSuccesses() == 2 );
@@ -115,8 +112,8 @@ public class ChecksumArtifactReporterTest
         {
             ArtifactHandler handler = new DefaultArtifactHandler( "jar" );
             VersionRange version = VersionRange.createFromVersion( "1.0" );
-            Artifact artifact = new DefaultArtifact( "checksumTest", "invalidArtifact", version, "compile", "jar", "",
-                                                     handler );
+            Artifact artifact =
+                new DefaultArtifact( "checksumTest", "invalidArtifact", version, "compile", "jar", "", handler );
 
             artifactReportProcessor.processArtifact( null, artifact, reporter, repository );
             assertTrue( reporter.getFailures() == 2 );
@@ -129,7 +126,7 @@ public class ChecksumArtifactReporterTest
     }
 
     /**
-     * Test the valid checksum of a metadata file. 
+     * Test the valid checksum of a metadata file.
      * The reporter should report 2 success validation.
      */
     public void testChecksumMetadataReporterSuccess()
@@ -139,8 +136,8 @@ public class ChecksumArtifactReporterTest
         {
             ArtifactHandler handler = new DefaultArtifactHandler( "jar" );
             VersionRange version = VersionRange.createFromVersion( "1.0" );
-            Artifact artifact = new DefaultArtifact( "checksumTest", "validArtifact", version, "compile", "jar", "",
-                                                     handler );
+            Artifact artifact =
+                new DefaultArtifact( "checksumTest", "validArtifact", version, "compile", "jar", "", handler );
 
             //Version level metadata
             RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact );
@@ -166,7 +163,7 @@ public class ChecksumArtifactReporterTest
     }
 
     /**
-     * Test the corrupted checksum of a metadata file. 
+     * Test the corrupted checksum of a metadata file.
      * The reporter must report 2 failures.
      */
     public void testChecksumMetadataReporterFailure()
@@ -176,8 +173,8 @@ public class ChecksumArtifactReporterTest
         {
             ArtifactHandler handler = new DefaultArtifactHandler( "jar" );
             VersionRange version = VersionRange.createFromVersion( "1.0" );
-            Artifact artifact = new DefaultArtifact( "checksumTest", "invalidArtifact", version, "compile", "jar", "",
-                                                     handler );
+            Artifact artifact =
+                new DefaultArtifact( "checksumTest", "invalidArtifact", version, "compile", "jar", "", handler );
 
             RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact );
             metadataReportProcessor.processMetadata( metadata, repository, reporter );
@@ -198,7 +195,7 @@ public class ChecksumArtifactReporterTest
     /**
      * Test the checksum of an artifact located in a remote location.
      */
- /*   public void testChecksumArtifactRemote()
   /*   public void testChecksumArtifactRemote()
     {
         ArtifactHandler handler = new DefaultArtifactHandler( remoteArtifactType );
         VersionRange version = VersionRange.createFromVersion( remoteArtifactVersion );
@@ -220,7 +217,7 @@ public class ChecksumArtifactReporterTest
     /**
      * Test the checksum of a metadata file located in a remote location.
      */
- /*   public void testChecksumMetadataRemote()
   /*   public void testChecksumMetadataRemote()
     {
 
         try
@@ -280,8 +277,8 @@ public class ChecksumArtifactReporterTest
         {
             ArtifactHandler handler = new DefaultArtifactHandler( "jar" );
             VersionRange version = VersionRange.createFromVersion( "1.0" );
-            Artifact artifact = new DefaultArtifact( "checksumTest", "validArtifact", version, "compile", "jar", "",
-                                                     handler );
+            Artifact artifact =
+                new DefaultArtifact( "checksumTest", "validArtifact", version, "compile", "jar", "", handler );
 
             artifactReportProcessor.processArtifact( null, artifact, reporter, repository );
             //System.out.println( "5 - ART FAILURE ---> " + reporter.getFailures() );
index 89296b8e3ab188747d51296efb50bacc1f936240..eabf37e48ab0beb466c0a038b5570d9b86e33970 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,14 +28,14 @@ import java.util.Iterator;
  *
  */
 public class DefaultArtifactReporterTest
-        extends AbstractRepositoryReportsTestCase
+    extends AbstractRepositoryReportsTestCase
 {
     private ArtifactReporter reporter;
-    
+
     private Artifact artifact;
-    
+
     private RepositoryMetadata metadata;
-    
+
     public void testEmptyArtifactReporter()
     {
         assertEquals( "No failures", 0, reporter.getFailures() );
@@ -48,7 +48,7 @@ public class DefaultArtifactReporterTest
         assertFalse( "No metadata warnings", reporter.getRepositoryMetadataWarningIterator().hasNext() );
         assertFalse( "No metadata successes", reporter.getRepositoryMetadataSuccessIterator().hasNext() );
     }
-    
+
     public void testMetadataSingleFailure()
     {
         reporter.addFailure( metadata, "Single Failure Reason" );
@@ -63,7 +63,7 @@ public class DefaultArtifactReporterTest
         assertEquals( "check failure reason", "Single Failure Reason", result.getReason() );
         assertFalse( "no more failures", results.hasNext() );
     }
-    
+
     public void testMetadataMultipleFailures()
     {
         reporter.addFailure( metadata, "First Failure Reason" );
@@ -98,7 +98,7 @@ public class DefaultArtifactReporterTest
         assertEquals( "check failure reason", "Single Warning Message", result.getReason() );
         assertFalse( "no more failures", results.hasNext() );
     }
-    
+
     public void testMetadataMultipleWarnings()
     {
         reporter.addWarning( metadata, "First Warning" );
@@ -133,14 +133,14 @@ public class DefaultArtifactReporterTest
         assertNull( "check no reason", result.getReason() );
         assertFalse( "no more failures", results.hasNext() );
     }
-    
+
     public void testMetadataMultipleSuccesses()
     {
         Versioning versioning = new Versioning();
         versioning.addVersion( "1.0-beta-1" );
-        versioning.addVersion( "1.0-beta-2" );        
+        versioning.addVersion( "1.0-beta-2" );
         RepositoryMetadata metadata2 = new ArtifactRepositoryMetadata( artifact, versioning );
-        
+
         reporter.addSuccess( metadata );
         reporter.addSuccess( metadata2 );
         assertEquals( "failures count", 0, reporter.getFailures() );
@@ -159,24 +159,26 @@ public class DefaultArtifactReporterTest
         assertFalse( "no more successes", results.hasNext() );
     }
 
-    protected void setUp() throws Exception
+    protected void setUp()
+        throws Exception
     {
         super.setUp();
-        
+
         reporter = new DefaultArtifactReporter();
         ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
         artifact = artifactFactory.createBuildArtifact( "groupId", "artifactId", "1.0-alpha-1", "type" );
 
         Versioning versioning = new Versioning();
         versioning.addVersion( "1.0-alpha-1" );
-        versioning.addVersion( "1.0-alpha-2" );        
+        versioning.addVersion( "1.0-alpha-2" );
         RepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact, versioning );
     }
 
-    protected void tearDown() throws Exception
+    protected void tearDown()
+        throws Exception
     {
         super.tearDown();
-        
+
         reporter = null;
         metadata = null;
     }
index a07034b72d3cb2cf12cdeb579040126e912bac64..9e9bfc759cacd44ec3bf07ebc5f6409649125411 100644 (file)
@@ -1,14 +1,13 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -19,42 +18,46 @@ package org.apache.maven.repository.reporting;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 /**
- *
  * @author Edwin Punzalan
  */
-public class GenericMockObject implements InvocationHandler
+public class GenericMockObject
+    implements InvocationHandler
 {
     Map invocations = new HashMap();
-    
+
     public GenericMockObject()
     {
         //default constructor
     }
-    
+
     public GenericMockObject( Map returnMap )
     {
         invocations = returnMap;
     }
-    
+
     public void setExpectedReturns( Method method, List returnList )
     {
         invocations.put( method, returnList );
     }
 
-    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
     {
-        if ( !invocations.containsKey( method ) ) 
+        if ( !invocations.containsKey( method ) )
+        {
             throw new UnsupportedOperationException( "No expected return values defined." );
-        
+        }
+
         List returnList = (List) invocations.get( method );
-        if ( returnList.size() < 1 ) throw new UnsupportedOperationException( "Too few expected return values defined." );
+        if ( returnList.size() < 1 )
+        {
+            throw new UnsupportedOperationException( "Too few expected return values defined." );
+        }
         return returnList.remove( 0 );
     }
 }
index 2da65de80aff07714ec5f10df4baa457fa7edc50..e03d8f1722e0b41c98f76b575f377076ab76595e 100644 (file)
 package org.apache.maven.repository.reporting;
 
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DefaultArtifact;
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
 import org.apache.maven.artifact.versioning.VersionRange;
 
-/* 
- * Copyright 2001-2005 The Apache Software Foundation. 
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
-
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
- */
-
 /**
  * This class tests the InvalidPomArtifactReportProcessor class.
  */
-public class InvalidPomArtifactReportProcessorTest 
+public class InvalidPomArtifactReportProcessorTest
     extends AbstractRepositoryReportsTestCase
 {
     private ArtifactReportProcessor artifactReportProcessor;
 
     private ArtifactReporter reporter = new MockArtifactReporter();
-    
-    public void setUp() throws Exception{
+
+    public void setUp()
+        throws Exception
+    {
         super.setUp();
         artifactReportProcessor = (ArtifactReportProcessor) lookup( ArtifactReportProcessor.ROLE, "invalid-pom" );
     }
-    
-    public void tearDown() throws Exception{
+
+    public void tearDown()
+        throws Exception
+    {
         super.tearDown();
     }
-    
+
     /**
      * Test the InvalidPomArtifactReportProcessor when the artifact is an invalid pom.
      */
-    public void testInvalidPomArtifactReportProcessorFailure(){
-        
-        try{
+    public void testInvalidPomArtifactReportProcessorFailure()
+    {
+
+        try
+        {
             ArtifactHandler handler = new DefaultArtifactHandler( "pom" );
             VersionRange version = VersionRange.createFromVersion( "1.0-alpha-3" );
-            Artifact artifact = new DefaultArtifact( "org.apache.maven", "artifactId", version, "compile", "pom", "",
-                                                     handler );
-            
-            artifactReportProcessor.processArtifact(null, artifact, reporter, repository);
-            assertTrue(reporter.getFailures() == 1);
+            Artifact artifact =
+                new DefaultArtifact( "org.apache.maven", "artifactId", version, "compile", "pom", "", handler );
+
+            artifactReportProcessor.processArtifact( null, artifact, reporter, repository );
+            assertTrue( reporter.getFailures() == 1 );
             //System.out.println("INVALID POM ARTIFACT FAILURES --->> " + reporter.getFailures());
-            
-        }catch(Exception e){
-            
+
+        }
+        catch ( Exception e )
+        {
+
         }
     }
-    
-    
+
+
     /**
      * Test the InvalidPomArtifactReportProcessor when the artifact is a valid pom.
      */
-    public void testInvalidPomArtifactReportProcessorSuccess(){
-        
-        try{
+    public void testInvalidPomArtifactReportProcessorSuccess()
+    {
+
+        try
+        {
             ArtifactHandler handler = new DefaultArtifactHandler( "pom" );
             VersionRange version = VersionRange.createFromVersion( "1.0-alpha-2" );
-            Artifact artifact = new DefaultArtifact( "groupId", "artifactId", version, "compile", "pom", "",
-                                                     handler );
-            
-            artifactReportProcessor.processArtifact(null, artifact, reporter, repository);
-            assertTrue(reporter.getSuccesses() == 1);
+            Artifact artifact = new DefaultArtifact( "groupId", "artifactId", version, "compile", "pom", "", handler );
+
+            artifactReportProcessor.processArtifact( null, artifact, reporter, repository );
+            assertTrue( reporter.getSuccesses() == 1 );
             //System.out.println("VALID POM ARTIFACT SUCCESS --->> " + reporter.getSuccesses());
-            
-        }catch(Exception e){
-            
+
+        }
+        catch ( Exception e )
+        {
+
         }
     }
-    
-    
+
+
     /**
      * Test the InvalidPomArtifactReportProcessor when the artifact is not a pom.
      */
-    public void testNotAPomArtifactReportProcessorSuccess(){
-        
-        try{
+    public void testNotAPomArtifactReportProcessorSuccess()
+    {
+
+        try
+        {
             ArtifactHandler handler = new DefaultArtifactHandler( "jar" );
             VersionRange version = VersionRange.createFromVersion( "1.0-alpha-1" );
-            Artifact artifact = new DefaultArtifact( "groupId", "artifactId", version, "compile", "jar", "",
-                                                     handler );
-            
-            artifactReportProcessor.processArtifact(null, artifact, reporter, repository);
-            assertTrue(reporter.getWarnings() == 1);
+            Artifact artifact = new DefaultArtifact( "groupId", "artifactId", version, "compile", "jar", "", handler );
+
+            artifactReportProcessor.processArtifact( null, artifact, reporter, repository );
+            assertTrue( reporter.getWarnings() == 1 );
             //System.out.println("NOT A POM ARTIFACT WARNINGS --->> " + reporter.getWarnings());
-            
-        }catch(Exception e){
-            
+
+        }
+        catch ( Exception e )
+        {
+
         }
     }
-    
+
     /**
      * Test the InvalidPomArtifactReportProcessor when the pom is located in 
      * a remote repository.
      */
-   /* public void testRemotePomArtifactReportProcessorSuccess(){
+    /* public void testRemotePomArtifactReportProcessorSuccess(){
         try{
             ArtifactHandler handler = new DefaultArtifactHandler( "pom" );
             VersionRange version = VersionRange.createFromVersion( remoteArtifactVersion );
index 08b9e6576d42fdfd8ffa7124e442287daf095265..fcffd36fad06add9d088ef3298f7c7ec0cdb4c0d 100644 (file)
@@ -1,41 +1,36 @@
 package org.apache.maven.repository.reporting;
 
-/* 
- * Copyright 2001-2005 The Apache Software Foundation. 
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
-
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DefaultArtifact;
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
 /**
  * This class tests the LocationArtifactReportProcessor.
- *
  */
 public class LocationArtifactReportProcessorTest
     extends AbstractRepositoryReportsTestCase
@@ -74,11 +69,11 @@ public class LocationArtifactReportProcessorTest
         {
             ArtifactHandler handler = new DefaultArtifactHandler( "jar" );
             VersionRange version = VersionRange.createFromVersion( "2.0" );
-            Artifact artifact = new DefaultArtifact( "org.apache.maven", "maven-model", version, "compile", "jar", "",
-                                                     handler );
+            Artifact artifact =
+                new DefaultArtifact( "org.apache.maven", "maven-model", version, "compile", "jar", "", handler );
 
-            InputStream is = new FileInputStream( repository.getBasedir()
-                + "org.apache.maven/maven-model/2.0/maven-model-2.0.pom" );
+            InputStream is =
+                new FileInputStream( repository.getBasedir() + "org.apache.maven/maven-model/2.0/maven-model-2.0.pom" );
             Reader reader = new InputStreamReader( is );
             Model model = pomReader.read( reader );
 
@@ -107,8 +102,8 @@ public class LocationArtifactReportProcessorTest
             VersionRange version = VersionRange.createFromVersion( "1.0-alpha-1" );
             Artifact artifact = new DefaultArtifact( "groupId", "artifactId", version, "compile", "jar", "", handler );
 
-            InputStream is = new FileInputStream( repository.getBasedir()
-                + "groupId/artifactId/1.0-alpha-1/artifactId-1.0-alpha-1.pom" );
+            InputStream is = new FileInputStream(
+                repository.getBasedir() + "groupId/artifactId/1.0-alpha-1/artifactId-1.0-alpha-1.pom" );
             Reader reader = new InputStreamReader( is );
             Model model = pomReader.read( reader );
 
@@ -124,7 +119,7 @@ public class LocationArtifactReportProcessorTest
 
     /**
      * Test the LocationArtifactReporter when the artifact is not in the location specified
-     * in the file system pom.  
+     * in the file system pom.
      */
     public void testLocationArtifactReporterFailure()
     {
@@ -137,8 +132,8 @@ public class LocationArtifactReportProcessorTest
             VersionRange version = VersionRange.createFromVersion( "1.0-alpha-2" );
             Artifact artifact = new DefaultArtifact( "groupId", "artifactId", version, "compile", "jar", "", handler );
 
-            InputStream is = new FileInputStream( repository.getBasedir()
-                + "groupId/artifactId/1.0-alpha-2/artifactId-1.0-alpha-2.pom" );
+            InputStream is = new FileInputStream(
+                repository.getBasedir() + "groupId/artifactId/1.0-alpha-2/artifactId-1.0-alpha-2.pom" );
             Reader reader = new InputStreamReader( is );
             Model model = pomReader.read( reader );
 
@@ -165,11 +160,11 @@ public class LocationArtifactReportProcessorTest
         {
             ArtifactHandler handler = new DefaultArtifactHandler( "jar" );
             VersionRange version = VersionRange.createFromVersion( "2.0" );
-            Artifact artifact = new DefaultArtifact( "org.apache.maven", "maven-archiver", version, "compile", "jar",
-                                                     "", handler );
+            Artifact artifact =
+                new DefaultArtifact( "org.apache.maven", "maven-archiver", version, "compile", "jar", "", handler );
 
-            InputStream is = new FileInputStream( repository.getBasedir()
-                + "org.apache.maven/maven-archiver/2.0/maven-archiver-2.0.pom" );
+            InputStream is = new FileInputStream(
+                repository.getBasedir() + "org.apache.maven/maven-archiver/2.0/maven-archiver-2.0.pom" );
             Reader reader = new InputStreamReader( is );
             Model model = pomReader.read( reader );
 
@@ -197,11 +192,11 @@ public class LocationArtifactReportProcessorTest
         {
             ArtifactHandler handler = new DefaultArtifactHandler( "jar" );
             VersionRange version = VersionRange.createFromVersion( "2.1" );
-            Artifact artifact = new DefaultArtifact( "org.apache.maven", "maven-monitor", version, "compile", "jar",
-                                                     "", handler );
+            Artifact artifact =
+                new DefaultArtifact( "org.apache.maven", "maven-monitor", version, "compile", "jar", "", handler );
 
-            InputStream is = new FileInputStream( repository.getBasedir()
-                + "org.apache.maven/maven-monitor/2.1/maven-monitor-2.1.pom" );
+            InputStream is = new FileInputStream(
+                repository.getBasedir() + "org.apache.maven/maven-monitor/2.1/maven-monitor-2.1.pom" );
             Reader reader = new InputStreamReader( is );
             Model model = pomReader.read( reader );
 
@@ -228,11 +223,11 @@ public class LocationArtifactReportProcessorTest
         {
             ArtifactHandler handler = new DefaultArtifactHandler( "jar" );
             VersionRange version = VersionRange.createFromVersion( "2.1" );
-            Artifact artifact = new DefaultArtifact( "org.apache.maven", "maven-project", version, "compile", "jar",
-                                                     "", handler );
+            Artifact artifact =
+                new DefaultArtifact( "org.apache.maven", "maven-project", version, "compile", "jar", "", handler );
 
-            InputStream is = new FileInputStream( repository.getBasedir()
-                + "org.apache.maven/maven-project/2.1/maven-project-2.1.pom" );
+            InputStream is = new FileInputStream(
+                repository.getBasedir() + "org.apache.maven/maven-project/2.1/maven-project-2.1.pom" );
             Reader reader = new InputStreamReader( is );
             Model model = pomReader.read( reader );
 
@@ -249,7 +244,7 @@ public class LocationArtifactReportProcessorTest
     /**
      * Test the LocationArtifactReportProcessor when the artifact is located in the remote repository.
      */
-  /*  public void testRemoteArtifactReportProcessorFailure()
+    /*  public void testRemoteArtifactReportProcessorFailure()
     {
 
         ArtifactHandler handler = new DefaultArtifactHandler( remoteArtifactType );
index e95ec8bc5dc7467e147116b4dce84b65c122d3de..1f2ccbddc778e2ab0f79e9d6a178fb492830d618 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,13 +17,13 @@ package org.apache.maven.repository.reporting;
  */
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
 import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
+import org.apache.maven.artifact.versioning.VersionRange;
 
 import java.io.File;
 import java.util.Collection;
@@ -36,7 +36,9 @@ public class MockArtifact
     implements Artifact
 {
     private String groupId;
+
     private String artifactId;
+
     private String version;
 
     public String getGroupId()
index 3d4d72b96cf7b4d7d2c83dd96da58819aedbeb2e..44abcef9adcb8946780d968e924db32be5be53a6 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@ package org.apache.maven.repository.reporting;
  * limitations under the License.
  */
 
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.versioning.VersionRange;
 
 /**
index c14289bf17b6525c33179dc8ffb288cf89aa7013..38ed0124dc76502e845c92258eba2c847f666b90 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,9 +20,9 @@ import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.model.Model;
 
-import java.util.List;
-import java.util.Iterator;
 import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * 
@@ -39,7 +39,8 @@ public class MockArtifactReportProcessor
         reportConditions = new ArrayList();
     }
 
-    public void processArtifact( Model model, Artifact artifact, ArtifactReporter reporter, ArtifactRepository artifactRepository )
+    public void processArtifact( Model model, Artifact artifact, ArtifactReporter reporter,
+                                 ArtifactRepository artifactRepository )
     {
         if ( iterator == null || !iterator.hasNext() ) // not initialized or reached end of the list. start again
         {
@@ -47,26 +48,26 @@ public class MockArtifactReportProcessor
         }
         if ( !reportConditions.isEmpty() )
         {
-            while(iterator.hasNext())
+            while ( iterator.hasNext() )
             {
                 ReportCondition reportCondition = (ReportCondition) iterator.next();
                 switch ( reportCondition.getResult() )
                 {
                     case ReportCondition.SUCCESS:
-                        {
-                            reporter.addSuccess( reportCondition.getArtifact() );
-                            break;
-                        }
+                    {
+                        reporter.addSuccess( reportCondition.getArtifact() );
+                        break;
+                    }
                     case ReportCondition.WARNING:
-                        {
-                            reporter.addWarning( reportCondition.getArtifact(), reportCondition.getReason() );
-                            break;
-                        }
+                    {
+                        reporter.addWarning( reportCondition.getArtifact(), reportCondition.getReason() );
+                        break;
+                    }
                     case ReportCondition.FAILURE:
-                        {
-                            reporter.addFailure( reportCondition.getArtifact(), reportCondition.getReason() );
-                            break;
-                        }
+                    {
+                        reporter.addFailure( reportCondition.getArtifact(), reportCondition.getReason() );
+                        break;
+                    }
                 }
             }
         }
index 44381223889182ba33e78451245417db88d10a79..93b446fefbe10c1d8da8d7fa7cc6a925947f8f81 100755 (executable)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 543212b5b09791d2fb7e0fb79522df24dacbf36c..abe72552248f379b43b7df8676ca4e3a1f37ecaa 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -71,11 +71,11 @@ public class MockRepositoryQueryLayer
         return containsArtifact( artifact );
     }
 
-    public boolean containsArtifactVersion(Artifact artifact, String version)
+    public boolean containsArtifactVersion( Artifact artifact, String version )
     {
         return false;
     }
-    
+
     public List getVersions( Artifact artifact )
     {
         return null;
index e1d51f1dae853deea99d16d1843f29de7ce2b1c2..6cdfcec6958fc8923ce267f93275c206c72b0b0e 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.reporting;
 
 /*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,11 +24,15 @@ import org.apache.maven.artifact.Artifact;
 public class ReportCondition
 {
     public final static int SUCCESS = 0;
+
     public final static int FAILURE = -1;
+
     public final static int WARNING = 1;
 
     private int result;
+
     private Artifact artifact;
+
     private String reason;
 
     public ReportCondition( int result, Artifact artifact, String reason )
index 6b20d3b4b554181793da9c6e65bf17ad19643203..a8ea6e7e06a861c2c76e6efc3de8636cbbea127b 100644 (file)
@@ -1,11 +1,27 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <metadata>
-  <groupId>groupId</groupId> 
-  <artifactId>artifactId</artifactId> 
-  <version>1.0-alpha-1</version> 
+  <groupId>groupId</groupId>
+  <artifactId>artifactId</artifactId>
+  <version>1.0-alpha-1</version>
   <versioning>
     <versions>
-      <version>1.0-alpha-1</version> 
-      <version>1.0-alpha-2</version> 
+      <version>1.0-alpha-1</version>
+      <version>1.0-alpha-2</version>
     </versions>
   </versioning>
 </metadata>
index 791dac1b5961f3e7a11de47b197d130c4887d799..44c9d51ff3967f314377a8b9b2d4cbc548af7525 100644 (file)
@@ -1 +1,17 @@
-This file is here to make sure that it will not be processed during unit test.
\ No newline at end of file
+This file is here to make sure that it will not be processed during unit <!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+    test.
\ No newline at end of file
index 7fdf6a91abbe89e9f71e7a6d35776908edb6c6b8..9efaee38c3ac040c658b4c34271741a8638a4e0e 100644 (file)
@@ -1,5 +1,21 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <metadata>
-<groupId>checksumTest</groupId>
-<artifactId>invalidArtifact</artifactId>
-<version>1.0</version>
+  <groupId>checksumTest</groupId>
+  <artifactId>invalidArtifact</artifactId>
+  <version>1.0</version>
 </metadata>
diff --git a/pom.xml b/pom.xml
index 9bcb1c09c83fa7ba5a4d13b41975f18a2d4b8d12..bdc1ef322678eb04f81c5f10ed4d9771e1d70feb 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -1,3 +1,19 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
 <project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.apache.maven.repository</groupId>
@@ -6,7 +22,8 @@
   <name>Maven Repository Manager</name>
   <version>1.0-SNAPSHOT</version>
   <description>
-    The Maven Repository Manager is an application for managing one or more remote repositories, including administration, artifact handling,
+    The Maven Repository Manager is an application for managing one or more remote repositories, including
+    administration, artifact handling,
     browsing and searching.
   </description>
   <url>http://maven.apache.org/repository-manager</url>
   </modules>
   <repositories>
     <repository>
-<!--
-      <releases>
-        <enabled>false</enabled>
-      </releases>
--->
+      <!--
+            <releases>
+              <enabled>false</enabled>
+            </releases>
+      -->
       <id>apache.snapshots</id>
       <name>Apache Development Repository</name>
       <url>http://cvs.apache.org/maven-snapshot-repository</url>
     </dependencies>
   </dependencyManagement>
   <distributionManagement>
-<!--
-    <repository>
-      <id>repo1</id>
-      <name>Maven Central Repository</name>
-      <url>scp://repo1.maven.org/home/projects/maven/repository-staging/to-ibiblio/maven2</url>
-    </repository>
--->
+    <!--
+        <repository>
+          <id>repo1</id>
+          <name>Maven Central Repository</name>
+          <url>scp://repo1.maven.org/home/projects/maven/repository-staging/to-ibiblio/maven2</url>
+        </repository>
+    -->
     <snapshotRepository>
       <id>apache.snapshots</id>
       <name>Apache Development Repository</name>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>cobertura-maven-plugin</artifactId>
       </plugin>
-<!--
-      <plugin>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-      </plugin>
--->
+      <!--
+            <plugin>
+              <artifactId>maven-checkstyle-plugin</artifactId>
+            </plugin>
+      -->
       <!-- TODO: should work, even if there are no sources -->
       <plugin>
         <groupId>org.codehaus.mojo</groupId>