aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2006-06-07 05:47:45 +0000
committerBrett Porter <brett@apache.org>2006-06-07 05:47:45 +0000
commit8aad68cfe4edae695c449107d8f1df0b5ea25aee (patch)
tree35f38066a63e1a09ec00bba2d9923d43db233039
parentc36f7f427ccd6d00ef30fc5a69ef34f48782375d (diff)
downloadarchiva-8aad68cfe4edae695c449107d8f1df0b5ea25aee.tar.gz
archiva-8aad68cfe4edae695c449107d8f1df0b5ea25aee.zip
general clean up, addition of copyrights
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@412295 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java8
-rw-r--r--maven-repository-artifact-applet/pom.xml16
-rw-r--r--maven-repository-artifact-applet/src/main/java/org/apache/maven/repository/applet/ChecksumApplet.java83
-rw-r--r--maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java14
-rw-r--r--maven-repository-converter/src/main/java/org/apache/maven/repository/converter/transaction/TransactionEvent.java4
-rw-r--r--maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties1
-rw-r--r--maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java8
-rw-r--r--maven-repository-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom1
-rw-r--r--maven-repository-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom1
-rw-r--r--maven-repository-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom1
-rw-r--r--maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractArtifactDiscoverer.java24
-rw-r--r--maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java18
-rw-r--r--maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java2
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java53
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java18
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java23
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java3
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java2
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java10
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java10
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java57
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchHit.java6
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayer.java7
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java3
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/Query.java9
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/SinglePhraseQuery.java15
-rw-r--r--maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java6
-rw-r--r--maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java36
-rw-r--r--maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java20
-rw-r--r--maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java17
-rw-r--r--maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java30
-rw-r--r--maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/query/QueryTest.java7
-rw-r--r--maven-repository-manager-site/pom.xml19
-rw-r--r--maven-repository-manager-site/src/site/site.xml20
-rw-r--r--maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java4
-rw-r--r--maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java2
-rw-r--r--maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoader.java98
-rw-r--r--maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java2
-rw-r--r--maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ValidationException.java4
-rw-r--r--maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/repository/ProxyRepository.java10
-rw-r--r--maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java24
-rw-r--r--maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/LegacyProxyManagerTest.java4
-rw-r--r--maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoaderTest.java70
-rw-r--r--maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java14
-rw-r--r--maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java4
-rw-r--r--maven-repository-utils/src/main/java/org/apache/maven/repository/ArtifactUtils.java5
-rw-r--r--maven-repository-utils/src/main/java/org/apache/maven/repository/digest/DefaultDigester.java22
-rw-r--r--maven-repository-utils/src/test/java/org/apache/maven/repository/ArtifactUtilsLegacyTest.java16
-rw-r--r--maven-repository-webapp/pom.xml16
-rw-r--r--maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java3
-rw-r--r--maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java16
-rw-r--r--maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java5
-rw-r--r--maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/RepositoryBrowseAction.java43
-rw-r--r--maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java79
-rw-r--r--maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java15
-rw-r--r--maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java22
-rw-r--r--maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java25
-rw-r--r--maven-repository-webapp/src/main/webapp/WEB-INF/decorators.xml16
-rw-r--r--maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp52
-rw-r--r--maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp16
-rw-r--r--maven-repository-webapp/src/main/webapp/WEB-INF/jsp/form.jspf1
-rw-r--r--maven-repository-webapp/src/main/webapp/WEB-INF/jsp/index.jsp16
-rw-r--r--maven-repository-webapp/src/main/webapp/WEB-INF/web.xml16
-rw-r--r--maven-repository-webapp/src/main/webapp/css/maven-base.css16
-rw-r--r--maven-repository-webapp/src/main/webapp/css/maven-theme.css16
-rw-r--r--maven-repository-webapp/src/main/webapp/css/print.css16
-rw-r--r--maven-repository-webapp/src/main/webapp/css/site.css16
-rw-r--r--maven-repository-webapp/src/main/webapp/index.jsp16
68 files changed, 737 insertions, 515 deletions
diff --git a/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java b/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java
index f711a269d..97470feff 100644
--- a/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java
+++ b/maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java
@@ -20,10 +20,10 @@ 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.repository.indexing.ArtifactRepositoryIndex;
+import org.apache.maven.repository.indexing.DefaultRepositoryIndexSearcher;
import org.apache.maven.repository.indexing.RepositoryIndexException;
import org.apache.maven.repository.indexing.RepositoryIndexSearchException;
import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
-import org.apache.maven.repository.indexing.DefaultRepositoryIndexSearcher;
import org.apache.maven.repository.indexing.query.SinglePhraseQuery;
import org.codehaus.classworlds.ClassWorld;
import org.codehaus.plexus.PlexusContainerException;
@@ -40,6 +40,10 @@ import java.net.MalformedURLException;
*/
public class IndexSearcherCli
{
+ private IndexSearcherCli()
+ {
+ }
+
public static void main( String[] args )
throws PlexusContainerException, ComponentLookupException, RepositoryIndexException, MalformedURLException,
RepositoryIndexSearchException
@@ -62,7 +66,7 @@ public class IndexSearcherCli
ArtifactRepositoryIndex index =
indexFactory.createArtifactRepositoryIndex( new File( args[0], ".index" ).getAbsolutePath(), repository );
-
+
DefaultRepositoryIndexSearcher searcher = indexFactory.createDefaultRepositoryIndexSearcher( index );
try
diff --git a/maven-repository-artifact-applet/pom.xml b/maven-repository-artifact-applet/pom.xml
index 144879018..c18b795a9 100644
--- a/maven-repository-artifact-applet/pom.xml
+++ b/maven-repository-artifact-applet/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 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">
<modelVersion>4.0.0</modelVersion>
diff --git a/maven-repository-artifact-applet/src/main/java/org/apache/maven/repository/applet/ChecksumApplet.java b/maven-repository-artifact-applet/src/main/java/org/apache/maven/repository/applet/ChecksumApplet.java
index d89470d6e..635d8edfa 100644
--- a/maven-repository-artifact-applet/src/main/java/org/apache/maven/repository/applet/ChecksumApplet.java
+++ b/maven-repository-artifact-applet/src/main/java/org/apache/maven/repository/applet/ChecksumApplet.java
@@ -14,7 +14,6 @@ package org.apache.maven.repository.applet;
* 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 javax.swing.*;
@@ -56,53 +55,73 @@ public class ChecksumApplet
public String generateMd5( final String file )
throws IOException, NoSuchAlgorithmException
{
- return (String) AccessController.doPrivileged( new PrivilegedAction()
+ Object o = AccessController.doPrivileged( new PrivilegedAction()
{
public Object run()
{
try
{
- MessageDigest digest = MessageDigest.getInstance( "MD5" );
-
- long total = new File( file ).length();
- InputStream fis = new FileInputStream( file );
- try
- {
- long totalRead = 0;
- byte[] buffer = new byte[CHECKSUM_BUFFER_SIZE];
- int numRead;
- do
- {
- numRead = fis.read( buffer );
- if ( numRead > 0 )
- {
- digest.update( buffer, 0, numRead );
- totalRead += numRead;
- progressBar.setValue( (int) ( totalRead * progressBar.getMaximum() / total ) );
- }
- }
- while ( numRead != -1 );
- }
- finally
- {
- fis.close();
- }
-
- return byteArrayToHexStr( digest.digest() );
+ return checksumFile( file );
}
catch ( NoSuchAlgorithmException e )
{
- throw new RuntimeException( e );
+ return e;
}
catch ( IOException e )
{
- throw new RuntimeException( e );
+ return e;
}
}
} );
+
+ //noinspection ChainOfInstanceofChecks
+ if ( o instanceof IOException )
+ {
+ throw (IOException) o;
+ }
+ else if ( o instanceof NoSuchAlgorithmException )
+ {
+ throw (NoSuchAlgorithmException) o;
+ }
+ else
+ {
+ return (String) o;
+ }
+ }
+
+ protected String checksumFile( String file )
+ throws NoSuchAlgorithmException, IOException
+ {
+ MessageDigest digest = MessageDigest.getInstance( "MD5" );
+
+ long total = new File( file ).length();
+ InputStream fis = new FileInputStream( file );
+ try
+ {
+ long totalRead = 0;
+ byte[] buffer = new byte[CHECKSUM_BUFFER_SIZE];
+ int numRead;
+ do
+ {
+ numRead = fis.read( buffer );
+ if ( numRead > 0 )
+ {
+ digest.update( buffer, 0, numRead );
+ totalRead += numRead;
+ progressBar.setValue( (int) ( totalRead * progressBar.getMaximum() / total ) );
+ }
+ }
+ while ( numRead != -1 );
+ }
+ finally
+ {
+ fis.close();
+ }
+
+ return byteArrayToHexStr( digest.digest() );
}
- private static String byteArrayToHexStr( byte[] data )
+ protected static String byteArrayToHexStr( byte[] data )
{
String output = "";
diff --git a/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java b/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java
index ee96ccd00..a14c8016c 100644
--- a/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java
+++ b/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java
@@ -32,6 +32,7 @@ import org.apache.maven.model.Model;
import org.apache.maven.model.Relocation;
import org.apache.maven.model.converter.ArtifactPomRewriter;
import org.apache.maven.model.converter.ModelConverter;
+import org.apache.maven.model.converter.PomTranslationException;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader;
import org.apache.maven.repository.converter.transaction.FileTransaction;
@@ -43,6 +44,7 @@ import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.StringReader;
@@ -213,6 +215,10 @@ public class DefaultRepositoryConverter
fileReader = new FileReader( file );
metadata = reader.read( fileReader );
}
+ catch ( FileNotFoundException e )
+ {
+ throw new RepositoryConversionException( "Error reading target metadata", e );
+ }
catch ( IOException e )
{
throw new RepositoryConversionException( "Error reading target metadata", e );
@@ -443,10 +449,16 @@ public class DefaultRepositoryConverter
reporter.addFailure( artifact, getI18NString( "failure.invalid.source.pom", e.getMessage() ) );
result = false;
}
- catch ( Exception e )
+ catch ( IOException e )
{
throw new RepositoryConversionException( "Unable to write converted POM", e );
}
+ catch ( PomTranslationException e )
+ {
+ // TODO! check handling, fix error message
+ reporter.addFailure( artifact, getI18NString( "failure.invalid.source.pom", e.getMessage() ) );
+ result = false;
+ }
finally
{
IOUtil.close( writer );
diff --git a/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/transaction/TransactionEvent.java b/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/transaction/TransactionEvent.java
index 45b792992..2f8a528e4 100644
--- a/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/transaction/TransactionEvent.java
+++ b/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/transaction/TransactionEvent.java
@@ -1,7 +1,5 @@
package org.apache.maven.repository.converter.transaction;
-import java.io.IOException;
-
/*
* Copyright 2005-2006 The Apache Software Foundation.
*
@@ -18,6 +16,8 @@ import java.io.IOException;
* limitations under the License.
*/
+import java.io.IOException;
+
/**
* Interface for individual events in a transaction.
*
diff --git a/maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties b/maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties
index f6089c1f5..88e4d1f30 100644
--- a/maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties
+++ b/maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties
@@ -23,6 +23,7 @@ warning.missing.pom=The artifact had no POM in the source repository.
exception.repositories.match=Source and target repositories are identical.
+# TODO! update definitions
failure.incorrect.groupMetadata.groupId=The group ID in the source group metadata is incorrect.
failure.incorrect.artifactMetadata.artifactId=The artifact ID in the source artifact metadata is incorrect.
diff --git a/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java b/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java
index 33817594d..3dadd5420 100644
--- a/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java
+++ b/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java
@@ -581,10 +581,10 @@ public class RepositoryConverterTest
File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
- SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+ SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd", Locale.getDefault() );
long origTime = dateFormat.parse( "2006-03-03" ).getTime();
- targetFile.setLastModified( origTime );
- targetPomFile.setLastModified( origTime );
+ targetFile.setLastModified( origTime );
+ targetPomFile.setLastModified( origTime );
sourceFile.setLastModified( dateFormat.parse( "2006-01-01" ).getTime() );
sourcePomFile.setLastModified( dateFormat.parse( "2006-02-02" ).getTime() );
@@ -954,7 +954,7 @@ public class RepositoryConverterTest
}
else if ( file.isDirectory() )
{
- if ( !file.getName().equals( ".svn" ) )
+ if ( !".svn".equals( file.getName() ) )
{
if ( !destination.exists() && !destination.mkdirs() )
{
diff --git a/maven-repository-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom b/maven-repository-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom
index 5f24f98c1..f441c9a46 100644
--- a/maven-repository-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom
+++ b/maven-repository-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom
@@ -12,7 +12,6 @@
~ 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>
diff --git a/maven-repository-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom b/maven-repository-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom
index 6e56d6956..5f347f371 100644
--- a/maven-repository-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom
+++ b/maven-repository-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom
@@ -12,7 +12,6 @@
~ 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>
diff --git a/maven-repository-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom b/maven-repository-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom
index 5182dfaf4..836cc236b 100644
--- a/maven-repository-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom
+++ b/maven-repository-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom
@@ -12,7 +12,6 @@
~ 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>
diff --git a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractArtifactDiscoverer.java b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractArtifactDiscoverer.java
index ea8a01354..167737f63 100644
--- a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractArtifactDiscoverer.java
+++ b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractArtifactDiscoverer.java
@@ -20,9 +20,12 @@ 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.File;
+import java.io.FileNotFoundException;
import java.io.FileReader;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -42,12 +45,12 @@ public abstract class AbstractArtifactDiscoverer
"**/*.MD5", "**/*.sha1", "**/*.SHA1", "**/*snapshot-version", "*/website/**", "*/licenses/**", "*/licences/**",
"**/.htaccess", "**/*.html", "**/*.asc", "**/*.txt", "**/*.xml", "**/README*", "**/CHANGELOG*", "**/KEYS*"};
- protected static final String POM = ".pom";
+ private static final String POM = ".pom";
/**
* Scan the repository for artifact paths.
*/
- protected String[] scanForArtifactPaths( File repositoryBase, String blacklistedPatterns )
+ private String[] scanForArtifactPaths( File repositoryBase, String blacklistedPatterns )
{
return scanForArtifactPaths( repositoryBase, blacklistedPatterns, null, STANDARD_DISCOVERY_EXCLUDES );
}
@@ -114,7 +117,7 @@ public abstract class AbstractArtifactDiscoverer
try
{
Model model = mavenReader.read( new FileReader( filename ) );
- if ( ( pomArtifact != null ) && ( "pom".equals( model.getPackaging() ) ) )
+ if ( pomArtifact != null && "pom".equals( model.getPackaging() ) )
{
if ( includeSnapshots || !pomArtifact.isSnapshot() )
{
@@ -122,10 +125,19 @@ public abstract class AbstractArtifactDiscoverer
}
}
}
- catch ( Exception e )
+ catch ( FileNotFoundException e )
{
- getLogger().info( "error reading file: " + filename );
- e.printStackTrace();
+ // this should never happen
+ getLogger().error( "Error finding file during POM discovery: " + filename, e );
+ }
+ catch ( IOException e )
+ {
+ getLogger().error( "Error reading file during POM discovery: " + filename + ": " + e );
+ }
+ catch ( XmlPullParserException e )
+ {
+ getLogger().error(
+ "Parse error reading file during POM discovery: " + filename + ": " + e.getMessage() );
}
}
}
diff --git a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java
index 9b62af1a2..d2efc3a58 100644
--- a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java
+++ b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java
@@ -1,5 +1,21 @@
package org.apache.maven.repository.discovery;
+/*
+ * 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.factory.ArtifactFactory;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.DirectoryScanner;
@@ -16,7 +32,7 @@ import java.util.List;
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
*/
-public class AbstractDiscoverer
+public abstract class AbstractDiscoverer
extends AbstractLogEnabled
{
private List kickedOutPaths = new ArrayList();
diff --git a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java
index 21d56acf1..20f9d3d87 100644
--- a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java
+++ b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java
@@ -129,7 +129,7 @@ public class DefaultMetadataDiscoverer
//}
Artifact artifact = null;
- if ( metaVersion != null && !metaVersion.equals( "" ) )
+ if ( metaVersion != null && !"".equals( metaVersion ) )
{
artifact = artifactFactory.createBuildArtifact( metaGroupId, metaArtifactId, metaVersion, "jar" );
}
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java
index 08b1a7ba9..32f514a05 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java
@@ -54,10 +54,8 @@ public abstract class AbstractRepositoryIndex
*
* @param indexPath
* @param repository
- * @throws RepositoryIndexException
*/
protected AbstractRepositoryIndex( String indexPath, ArtifactRepository repository )
- throws RepositoryIndexException
{
this.repository = repository;
this.indexPath = indexPath;
@@ -237,11 +235,10 @@ public abstract class AbstractRepositoryIndex
* Check if the index already exists.
*
* @return true if the index already exists
- * @throws IOException
* @throws RepositoryIndexException
*/
protected boolean indexExists()
- throws IOException, RepositoryIndexException
+ throws RepositoryIndexException
{
File indexDir = new File( indexPath );
@@ -332,7 +329,7 @@ public abstract class AbstractRepositoryIndex
return isAdded;
}
- private class ArtifactRepositoryIndexAnalyzer
+ private static class ArtifactRepositoryIndexAnalyzer
extends Analyzer
{
private Analyzer defaultAnalyzer;
@@ -342,7 +339,7 @@ public abstract class AbstractRepositoryIndex
*
* @param defaultAnalyzer the analyzer to use as default for the general fields of the artifact indeces
*/
- public ArtifactRepositoryIndexAnalyzer( Analyzer defaultAnalyzer )
+ ArtifactRepositoryIndexAnalyzer( Analyzer defaultAnalyzer )
{
this.defaultAnalyzer = defaultAnalyzer;
}
@@ -369,33 +366,33 @@ public abstract class AbstractRepositoryIndex
return tokenStream;
}
+ }
+ /**
+ * Class used to tokenize an artifact's version.
+ */
+ private static class VersionTokenizer
+ extends CharTokenizer
+ {
/**
- * Class used to tokenize an artifact's version.
+ * Constructor with the required reader to the index stream
+ *
+ * @param reader the Reader object of the index stream
*/
- private class VersionTokenizer
- extends CharTokenizer
+ VersionTokenizer( Reader reader )
{
- /**
- * Constructor with the required reader to the index stream
- *
- * @param reader the Reader object of the index stream
- */
- VersionTokenizer( Reader reader )
- {
- super( reader );
- }
+ super( reader );
+ }
- /**
- * method that lucene calls to check tokenization of a stream character
- *
- * @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 )
- {
- return character != '.' && character != '-';
- }
+ /**
+ * method that lucene calls to check tokenization of a stream character
+ *
+ * @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 )
+ {
+ return character != '.' && character != '-';
}
}
}
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java
index 23c9a66bb..bb410b815 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java
@@ -47,10 +47,8 @@ public class ArtifactRepositoryIndex
* @param indexPath the path where the lucene index will be created/updated.
* @param repository the repository where the indexed artifacts are located
* @param digester the digester object to generate the checksum strings
- * @throws RepositoryIndexException
*/
public ArtifactRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester )
- throws RepositoryIndexException
{
super( indexPath, repository );
this.digester = digester;
@@ -179,12 +177,9 @@ public class ArtifactRepositoryIndex
*
* @param name the complete path name of the class
* @param packages the packages buffer
- * @return true if the package is successfully added
*/
- private boolean addClassPackage( String name, StringBuffer packages )
+ private void addClassPackage( String name, StringBuffer packages )
{
- boolean isAdded = false;
-
int idx = name.lastIndexOf( '/' );
if ( idx > 0 )
{
@@ -193,10 +188,7 @@ public class ArtifactRepositoryIndex
{
packages.append( packageName ).append( "\n" );
}
- isAdded = true;
}
-
- return isAdded;
}
/**
@@ -204,9 +196,8 @@ public class ArtifactRepositoryIndex
*
* @param entry the zip entry to be added
* @param files the buffer of files to update
- * @return true if the file was successfully added
*/
- private boolean addFile( ZipEntry entry, StringBuffer files )
+ private void addFile( ZipEntry entry, StringBuffer files )
{
String name = entry.getName();
int idx = name.lastIndexOf( '/' );
@@ -215,14 +206,9 @@ public class ArtifactRepositoryIndex
name = name.substring( idx + 1 );
}
- boolean isAdded = false;
-
if ( files.indexOf( name + "\n" ) < 0 )
{
files.append( name ).append( "\n" );
- isAdded = true;
}
-
- return isAdded;
}
}
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java
index 56ae555e9..2b7db9e97 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java
@@ -103,6 +103,10 @@ public class DefaultRepositoryIndexSearcher
Hits hits = searcher.search( luceneQuery );
docs = buildList( hits );
}
+ catch ( MalformedURLException e )
+ {
+ throw new RepositoryIndexSearchException( "Unable to search index: " + e.getMessage(), e );
+ }
catch ( IOException e )
{
throw new RepositoryIndexSearchException( "Unable to search index: " + e.getMessage(), e );
@@ -168,17 +172,15 @@ public class DefaultRepositoryIndexSearcher
protected RepositoryIndexSearchHit createSearchedObjectFromIndexDocument( Document doc )
throws MalformedURLException, IOException, XmlPullParserException
{
- String groupId, artifactId, version, name, packaging;
RepositoryIndexSearchHit searchHit = null;
// the document is of type artifact
if ( doc.get( RepositoryIndex.FLD_DOCTYPE ).equals( RepositoryIndex.ARTIFACT ) )
{
- groupId = doc.get( RepositoryIndex.FLD_GROUPID );
- artifactId = doc.get( RepositoryIndex.FLD_ARTIFACTID );
- version = doc.get( RepositoryIndex.FLD_VERSION );
- name = doc.get( RepositoryIndex.FLD_NAME );
- packaging = doc.get( RepositoryIndex.FLD_PACKAGING );
+ String groupId = doc.get( RepositoryIndex.FLD_GROUPID );
+ String artifactId = doc.get( RepositoryIndex.FLD_ARTIFACTID );
+ String version = doc.get( RepositoryIndex.FLD_VERSION );
+ String packaging = doc.get( RepositoryIndex.FLD_PACKAGING );
Artifact artifact = factory.createBuildArtifact( groupId, artifactId, version, packaging );
artifact.setFile(
@@ -224,7 +226,7 @@ public class DefaultRepositoryIndexSearcher
String metadataFile = (String) it.next();
String tmpDir = (String) it.next();
- String metadataType = "";
+ String metadataType;
if ( tmpDir.equals( doc.get( RepositoryIndex.FLD_VERSION ) ) )
{
metadataType = MetadataRepositoryIndex.SNAPSHOT_METADATA;
@@ -258,16 +260,17 @@ public class DefaultRepositoryIndexSearcher
* @param filename the name of the metadata file
* @param metadataType the type of RepositoryMetadata object to be created (GROUP, ARTIFACT or SNAPSHOT)
* @return RepositoryMetadata
- * @throws MalformedURLException
* @throws IOException
* @throws XmlPullParserException
*/
private RepositoryMetadata getMetadata( String groupId, String artifactId, String version, String filename,
String metadataType )
- throws MalformedURLException, IOException, XmlPullParserException
+ throws IOException, XmlPullParserException
{
RepositoryMetadata repoMetadata = null;
- InputStream is = null;
+
+ // TODO! file handles left open
+ InputStream is;
MetadataXpp3Reader metadataReader = new MetadataXpp3Reader();
//group metadata
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java
index da25294aa..8d38b715a 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java
@@ -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,
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java
index f96c3032e..c54ea9f3c 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java
@@ -67,10 +67,8 @@ public class EclipseRepositoryIndex
* @param indexPath the path where the lucene index will be created/updated.
* @param repository the repository where the indexed artifacts are located
* @param digester the digester object to generate the checksum strings
- * @throws RepositoryIndexException
*/
public EclipseRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester )
- throws RepositoryIndexException
{
super( indexPath, repository );
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java
index e412f6049..ab3981935 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java
@@ -45,10 +45,8 @@ public class MetadataRepositoryIndex
*
* @param indexPath the path to the index
* @param repository the repository where the metadata to be indexed is located
- * @throws RepositoryIndexException
*/
public MetadataRepositoryIndex( String indexPath, ArtifactRepository repository )
- throws RepositoryIndexException
{
super( indexPath, repository );
}
@@ -105,7 +103,7 @@ public class MetadataRepositoryIndex
repoMetadata.getBaseVersion() + "/";
}
- if ( !repoMetadata.getRemoteFilename().equals( "" ) && repoMetadata.getRemoteFilename() != null )
+ if ( !"".equals( repoMetadata.getRemoteFilename() ) && repoMetadata.getRemoteFilename() != null )
{
path = path + repoMetadata.getRemoteFilename();
}
@@ -130,7 +128,7 @@ public class MetadataRepositoryIndex
for ( Iterator iter = plugins.iterator(); iter.hasNext(); )
{
Plugin plugin = (Plugin) iter.next();
- if ( plugin.getPrefix() != null && !plugin.getPrefix().equals( "" ) )
+ if ( plugin.getPrefix() != null && !"".equals( plugin.getPrefix() ) )
{
pluginAppended = plugin.getPrefix() + "\n";
}
@@ -138,7 +136,7 @@ public class MetadataRepositoryIndex
doc.add( Field.Text( FLD_PLUGINPREFIX, pluginAppended ) );
doc.add( Field.Text( FLD_GROUPID, metadata.getGroupId() ) );
- if ( metadata.getArtifactId() != null && !metadata.getArtifactId().equals( "" ) )
+ if ( metadata.getArtifactId() != null && !"".equals( metadata.getArtifactId() ) )
{
doc.add( Field.Text( FLD_ARTIFACTID, metadata.getArtifactId() ) );
}
@@ -147,7 +145,7 @@ public class MetadataRepositoryIndex
doc.add( Field.Text( FLD_ARTIFACTID, "" ) );
}
- if ( metadata.getVersion() != null && !metadata.getVersion().equals( "" ) )
+ if ( metadata.getVersion() != null && !"".equals( metadata.getVersion() ) )
{
doc.add( Field.Text( FLD_VERSION, metadata.getVersion() ) );
}
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java
index 9fe71b568..cca1e72e6 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java
@@ -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,
@@ -31,6 +30,7 @@ import org.apache.maven.repository.digest.Digester;
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.Iterator;
@@ -55,11 +55,9 @@ public class PomRepositoryIndex
* @param repository the repository where objects indexed by this class resides
* @param digester the digester to be used for generating checksums
* @param artifactFactory the factory for building artifact objects
- * @throws RepositoryIndexException
*/
public PomRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester,
ArtifactFactory artifactFactory )
- throws RepositoryIndexException
{
super( indexPath, repository );
this.digester = digester;
@@ -266,6 +264,10 @@ public class PomRepositoryIndex
{
return digester.createChecksum( new File( file ), algorithm );
}
+ catch ( FileNotFoundException e )
+ {
+ throw new RepositoryIndexException( e.getMessage(), e );
+ }
catch ( IOException e )
{
throw new RepositoryIndexException( e.getMessage(), e );
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java
index fd88be533..52064e9d7 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java
@@ -27,59 +27,58 @@ import java.util.List;
*/
public interface RepositoryIndex
{
- static final String POM = "POM";
+ String POM = "POM";
- static final String METADATA = "METADATA";
+ String METADATA = "METADATA";
- static final String ARTIFACT = "ARTIFACT";
+ String ARTIFACT = "ARTIFACT";
- static final String FLD_ID = "id";
+ String FLD_ID = "id";
- static final String FLD_NAME = "name";
+ String FLD_NAME = "name";
- static final String FLD_DOCTYPE = "doctype";
+ String FLD_DOCTYPE = "doctype";
- static final String FLD_GROUPID = "groupId";
+ String FLD_GROUPID = "groupId";
- static final String FLD_ARTIFACTID = "artifactId";
+ String FLD_ARTIFACTID = "artifactId";
- static final String FLD_VERSION = "version";
+ String FLD_VERSION = "version";
- static final String FLD_PACKAGING = "packaging";
+ String FLD_PACKAGING = "packaging";
- static final String FLD_SHA1 = "sha1";
+ String FLD_SHA1 = "sha1";
- static final String FLD_MD5 = "md5";
+ String FLD_MD5 = "md5";
- static final String FLD_LASTUPDATE = "last update";
+ String FLD_LASTUPDATE = "last update";
- static final String FLD_PLUGINPREFIX = "plugin prefix";
+ String FLD_PLUGINPREFIX = "plugin prefix";
- static final String FLD_CLASSES = "class";
+ String FLD_CLASSES = "class";
- static final String FLD_PACKAGES = "package";
+ String FLD_PACKAGES = "package";
- static final String FLD_FILES = "file";
+ String FLD_FILES = "file";
- static final String FLD_LICENSE_URLS = "license url";
+ String FLD_LICENSE_URLS = "license url";
- static final String FLD_DEPENDENCIES = "dependency";
+ String FLD_DEPENDENCIES = "dependency";
- static final String FLD_PLUGINS_BUILD = "build plugin";
+ String FLD_PLUGINS_BUILD = "build plugin";
- static final String FLD_PLUGINS_REPORT = "report plugin";
+ String FLD_PLUGINS_REPORT = "report plugin";
- static final String FLD_PLUGINS_ALL = "plugins_all";
+ String FLD_PLUGINS_ALL = "plugins_all";
- static final String[] FIELDS = {FLD_ID, FLD_NAME, FLD_DOCTYPE, FLD_GROUPID, FLD_ARTIFACTID, FLD_VERSION,
- FLD_PACKAGING, FLD_SHA1, FLD_MD5, FLD_LASTUPDATE, FLD_PLUGINPREFIX, FLD_CLASSES, FLD_PACKAGES, FLD_FILES,
- FLD_LICENSE_URLS, FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL};
+ String[] FIELDS = {FLD_ID, FLD_NAME, FLD_DOCTYPE, FLD_GROUPID, FLD_ARTIFACTID, FLD_VERSION, FLD_PACKAGING, FLD_SHA1,
+ FLD_MD5, FLD_LASTUPDATE, FLD_PLUGINPREFIX, FLD_CLASSES, FLD_PACKAGES, FLD_FILES, FLD_LICENSE_URLS,
+ FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL};
- static final List KEYWORD_FIELDS = Arrays.asList( new String[]{FLD_ID, FLD_PACKAGING, FLD_LICENSE_URLS,
- FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL} );
+ List KEYWORD_FIELDS = Arrays.asList( new String[]{FLD_ID, FLD_PACKAGING, FLD_LICENSE_URLS, FLD_DEPENDENCIES,
+ FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL} );
- static final String[] MODEL_FIELDS =
- {FLD_PACKAGING, FLD_LICENSE_URLS, FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT};
+ String[] MODEL_FIELDS = {FLD_PACKAGING, FLD_LICENSE_URLS, FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT};
/**
* Method used to query the index status
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchHit.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchHit.java
index f28aa1885..c1b00f346 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchHit.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchHit.java
@@ -23,11 +23,11 @@ public class RepositoryIndexSearchHit
{
private Object obj;
- private boolean isHashMap = false;
+ private boolean isHashMap;
- private boolean isMetadata = false;
+ private boolean isMetadata;
- private boolean isModel = false;
+ private boolean isModel;
/**
* Class constructor
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayer.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayer.java
index 4bb633448..eccd574b0 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayer.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayer.java
@@ -18,7 +18,6 @@ package org.apache.maven.repository.indexing;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.License;
import org.apache.maven.model.Model;
@@ -144,7 +143,7 @@ public class RepositoryIndexSearchLayer
else if ( hit.isMetadata() )
{
//@todo what about metadata objects?
- RepositoryMetadata metadata = (RepositoryMetadata) hit.getObject();
+// RepositoryMetadata metadata = (RepositoryMetadata) hit.getObject();
}
}
@@ -212,7 +211,7 @@ public class RepositoryIndexSearchLayer
}
}
- if ( values != null && values.size() > 0 )
+ if ( !values.isEmpty() )
{
resultMap.put( key, values );
}
@@ -351,7 +350,7 @@ public class RepositoryIndexSearchLayer
}
}
- if ( values.size() > 0 && values != null )
+ if ( !values.isEmpty() )
{
map.put( field, values );
}
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java
index a1b3981cc..f1e16b074 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java
@@ -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,
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/Query.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/Query.java
index e86e3ec15..515524121 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/Query.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/Query.java
@@ -1,17 +1,13 @@
package org.apache.maven.repository.indexing.query;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.maven.repository.indexing.RepositoryIndex;
-
/*
- * 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,6 +16,9 @@ import org.apache.maven.repository.indexing.RepositoryIndex;
* limitations under the License.
*/
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.maven.repository.indexing.RepositoryIndex;
+
/**
* Interface to label the query classes
*
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/SinglePhraseQuery.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/SinglePhraseQuery.java
index d41ca82fb..34bd7fc70 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/SinglePhraseQuery.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/SinglePhraseQuery.java
@@ -1,20 +1,13 @@
package org.apache.maven.repository.indexing.query;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.TermQuery;
-import org.apache.maven.repository.indexing.RepositoryIndex;
-
/*
- * 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,6 +16,12 @@ import org.apache.maven.repository.indexing.RepositoryIndex;
* limitations under the License.
*/
+import org.apache.lucene.index.Term;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.TermQuery;
+import org.apache.maven.repository.indexing.RepositoryIndex;
+
/**
* Class to hold a single field search condition
*
diff --git a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java
index c38bc6bcf..403232be8 100644
--- a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java
+++ b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java
@@ -422,7 +422,7 @@ public class ArtifactRepositoryIndexingTest
try
{
Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_VERSION, "~~~~~" );
- List artifacts = repoSearchLayer.searchAdvanced( qry );
+ repoSearchLayer.searchAdvanced( qry );
fail( "Must throw an exception on unparseable query." );
}
catch ( RepositoryIndexSearchException re )
@@ -436,7 +436,7 @@ public class ArtifactRepositoryIndexingTest
try
{
Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_VERSION, "1.0" );
- List artifacts = repoSearchLayer.searchAdvanced( qry );
+ repoSearchLayer.searchAdvanced( qry );
fail( "Must throw an exception on invalid index location." );
}
catch ( RepositoryIndexSearchException re )
@@ -466,7 +466,7 @@ public class ArtifactRepositoryIndexingTest
RepositoryIndexSearcher repoSearcher = factory.createDefaultRepositoryIndexSearcher( indexer );
Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_ID, RepositoryIndex.ARTIFACT + artifact.getId() );
List artifacts = repoSearcher.search( qry );
- assertEquals( artifacts.size(), 0 );
+ assertEquals( 0, artifacts.size() );
}
/**
diff --git a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java
index 132e1f450..39670273f 100644
--- a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java
+++ b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java
@@ -1,5 +1,21 @@
package org.apache.maven.repository.indexing;
+/*
+ * 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.lucene.document.DateField;
import org.apache.lucene.document.Document;
import org.apache.lucene.queryParser.QueryParser;
@@ -17,22 +33,6 @@ import org.codehaus.plexus.util.FileUtils;
import java.io.File;
-/*
- * 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.
- */
-
/**
* @author Edwin Punzalan
*/
@@ -49,6 +49,8 @@ public class EclipseRepositoryIndexTest
private long artifactFileTime;
+ private static final long TIME_DIFFERENCE = 10000L;
+
protected void setUp()
throws Exception
{
@@ -84,7 +86,7 @@ public class EclipseRepositoryIndexTest
indexer.optimize();
indexer.close();
- long historicTime = artifactFileTime - 10000L;
+ long historicTime = artifactFileTime - TIME_DIFFERENCE;
artifact = getArtifact( "org.apache.maven", "maven-model", "2.0" );
artifact.setFile( new File( repository.getBasedir(), repository.pathOf( artifact ) ) );
diff --git a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java
index 80f984fe5..bfc4a54bf 100644
--- a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java
+++ b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java
@@ -52,8 +52,6 @@ public class MetadataRepositoryIndexingTest
private String indexPath;
- private MetadataRepositoryIndex indexer;
-
private ArtifactFactory artifactFactory;
/**
@@ -98,7 +96,7 @@ public class MetadataRepositoryIndexingTest
throws Exception
{
RepositoryIndexingFactory factory = (RepositoryIndexingFactory) lookup( RepositoryIndexingFactory.ROLE );
- indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
+ MetadataRepositoryIndex indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
RepositoryMetadata repoMetadata =
getMetadata( "org.apache.maven", null, null, "maven-metadata.xml", MetadataRepositoryIndex.GROUP_METADATA );
@@ -140,8 +138,7 @@ public class MetadataRepositoryIndexingTest
RepositoryIndexSearchLayer repoSearchLayer = factory.createRepositoryIndexSearchLayer( indexer );
// search last update
- org.apache.maven.repository.indexing.query.Query qry =
- new SinglePhraseQuery( RepositoryIndex.FLD_LASTUPDATE, "20051212044643" );
+ Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_LASTUPDATE, "20051212044643" );
List metadataList = repoSearchLayer.searchAdvanced( qry );
//assertEquals( 1, metadataList.size() );
for ( Iterator iter = metadataList.iterator(); iter.hasNext(); )
@@ -204,7 +201,7 @@ public class MetadataRepositoryIndexingTest
rQry.addQuery( qry2 );
metadataList = repoSearchLayer.searchAdvanced( rQry );
- assertEquals( metadataList.size(), 0 );
+ assertEquals( 0, metadataList.size() );
indexer.close();
}
@@ -219,7 +216,7 @@ public class MetadataRepositoryIndexingTest
{
//test when the object passed in the index(..) method is not a RepositoryMetadata instance
RepositoryIndexingFactory factory = (RepositoryIndexingFactory) lookup( RepositoryIndexingFactory.ROLE );
- indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
+ MetadataRepositoryIndex indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
try
{
Artifact artifact = getArtifact( "org.apache.maven", "maven-artifact", "2.0.1" );
@@ -255,17 +252,16 @@ public class MetadataRepositoryIndexingTest
createTestIndex();
RepositoryIndexingFactory factory = (RepositoryIndexingFactory) lookup( RepositoryIndexingFactory.ROLE );
- indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
+ MetadataRepositoryIndex indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
RepositoryMetadata repoMetadata =
getMetadata( "org.apache.maven", null, null, "maven-metadata.xml", MetadataRepositoryIndex.GROUP_METADATA );
indexer.deleteDocument( RepositoryIndex.FLD_ID, (String) repoMetadata.getKey() );
RepositoryIndexSearcher repoSearcher = factory.createDefaultRepositoryIndexSearcher( indexer );
- org.apache.maven.repository.indexing.query.Query qry =
- new SinglePhraseQuery( RepositoryIndex.FLD_ID, (String) repoMetadata.getKey() );
+ Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_ID, (String) repoMetadata.getKey() );
List metadataList = repoSearcher.search( qry );
- assertEquals( metadataList.size(), 0 );
+ assertEquals( 0, metadataList.size() );
}
/**
@@ -285,7 +281,7 @@ public class MetadataRepositoryIndexingTest
{
RepositoryMetadata repoMetadata = null;
URL url;
- InputStream is = null;
+ InputStream is;
MetadataXpp3Reader metadataReader = new MetadataXpp3Reader();
//group metadata
diff --git a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java
index ee00f73f3..4300be481 100644
--- a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java
+++ b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java
@@ -1,6 +1,6 @@
package org.apache.maven.repository.indexing;
-/**
+/*
* Copyright 2005-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -180,10 +180,6 @@ public class PomRepositoryIndexingTest
SearchResult result = (SearchResult) artifacts.next();
Map map = result.getFieldMatches();
Set mapEntry = map.entrySet();
- for ( Iterator it = mapEntry.iterator(); it.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) it.next();
- }
assertEquals( "jar", (String) map.get( RepositoryIndex.FLD_PACKAGING ) );
}
@@ -212,7 +208,8 @@ public class PomRepositoryIndexingTest
SearchResult result = (SearchResult) artifacts.next();
Map map = result.getFieldMatches();
boolean depFound = false;
- Iterator dependencies = ( (List) map.get( RepositoryIndex.FLD_DEPENDENCIES ) ).iterator();
+ List list = (List) map.get( RepositoryIndex.FLD_DEPENDENCIES );
+ Iterator dependencies = list.iterator();
while ( dependencies.hasNext() )
{
String dep = (String) dependencies.next();
@@ -234,7 +231,8 @@ public class PomRepositoryIndexingTest
{
SearchResult result = (SearchResult) artifacts.next();
Map map = result.getFieldMatches();
- Iterator plugins = ( (List) map.get( RepositoryIndex.FLD_PLUGINS_BUILD ) ).iterator();
+ List list = (List) map.get( RepositoryIndex.FLD_PLUGINS_BUILD );
+ Iterator plugins = list.iterator();
boolean found = false;
while ( plugins.hasNext() )
{
@@ -257,7 +255,8 @@ public class PomRepositoryIndexingTest
{
SearchResult result = (SearchResult) artifacts.next();
Map map = result.getFieldMatches();
- Iterator plugins = ( (List) map.get( RepositoryIndex.FLD_PLUGINS_REPORT ) ).iterator();
+ List list = (List) map.get( RepositoryIndex.FLD_PLUGINS_REPORT );
+ Iterator plugins = list.iterator();
boolean found = false;
while ( plugins.hasNext() )
{
@@ -485,7 +484,7 @@ public class PomRepositoryIndexingTest
RepositoryIndexSearcher repoSearcher = factory.createDefaultRepositoryIndexSearcher( indexer );
Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_ID, RepositoryIndex.POM + pom.getId() );
List artifactList = repoSearcher.search( qry );
- assertEquals( artifactList.size(), 0 );
+ assertEquals( 0, artifactList.size() );
}
private Model getPom( String groupId, String artifactId, String version )
diff --git a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java
index 9121485f1..804165bd3 100644
--- a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java
+++ b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java
@@ -28,8 +28,6 @@ import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryM
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.repository.digest.DefaultDigester;
-import org.apache.maven.repository.digest.Digester;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
@@ -54,8 +52,6 @@ public class RepositoryIndexSearchLayerTest
private ArtifactFactory artifactFactory;
- private Digester digester;
-
private String indexPath;
/**
@@ -72,24 +68,12 @@ public class RepositoryIndexSearchLayerTest
ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
ArtifactRepositoryFactory repoFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
repository = repoFactory.createArtifactRepository( "test", repoDir, layout, null, null );
- digester = new DefaultDigester();
indexPath = "target/index";
FileUtils.deleteDirectory( indexPath );
}
/**
- * Tear down method
- *
- * @throws Exception
- */
- protected void tearDown()
- throws Exception
- {
- super.tearDown();
- }
-
- /**
* Method for creating the index used for testing
*
* @throws Exception
@@ -126,24 +110,24 @@ public class RepositoryIndexSearchLayerTest
MetadataRepositoryIndex metaIndexer = factory.createMetadataRepositoryIndex( indexPath, repository );
RepositoryMetadata repoMetadata =
- getMetadata( "org.apache.maven", null, null, "maven-metadata.xml", metaIndexer.GROUP_METADATA );
+ getMetadata( "org.apache.maven", null, null, "maven-metadata.xml", MetadataRepositoryIndex.GROUP_METADATA );
metaIndexer.index( repoMetadata );
metaIndexer.optimize();
metaIndexer.close();
repoMetadata = getMetadata( "org.apache.maven", "maven-artifact", "2.0.1", "maven-metadata.xml",
- metaIndexer.ARTIFACT_METADATA );
+ MetadataRepositoryIndex.ARTIFACT_METADATA );
metaIndexer.index( repoMetadata );
metaIndexer.optimize();
metaIndexer.close();
repoMetadata = getMetadata( "org.apache.maven", "maven-artifact", "2.0.1", "maven-metadata.xml",
- metaIndexer.SNAPSHOT_METADATA );
+ MetadataRepositoryIndex.SNAPSHOT_METADATA );
metaIndexer.index( repoMetadata );
metaIndexer.optimize();
metaIndexer.close();
- repoMetadata = getMetadata( "test", null, null, "maven-metadata.xml", metaIndexer.GROUP_METADATA );
+ repoMetadata = getMetadata( "test", null, null, "maven-metadata.xml", MetadataRepositoryIndex.GROUP_METADATA );
metaIndexer.index( repoMetadata );
metaIndexer.optimize();
metaIndexer.close();
@@ -345,14 +329,14 @@ public class RepositoryIndexSearchLayerTest
for ( Iterator iter = returnList.iterator(); iter.hasNext(); )
{
SearchResult result = (SearchResult) iter.next();
- assertEquals( result.getArtifact().getGroupId(), "test" );
+ assertEquals( "test", result.getArtifact().getGroupId() );
}
returnList = searchLayer.searchGeneral( "test-artifactId" );
for ( Iterator iter = returnList.iterator(); iter.hasNext(); )
{
SearchResult result = (SearchResult) iter.next();
- assertEquals( result.getArtifact().getArtifactId(), "test-artifactId" );
+ assertEquals( "test-artifactId", result.getArtifact().getArtifactId() );
}
}
@@ -375,7 +359,7 @@ public class RepositoryIndexSearchLayerTest
{
RepositoryMetadata repoMetadata = null;
URL url;
- InputStream is = null;
+ InputStream is;
MetadataXpp3Reader metadataReader = new MetadataXpp3Reader();
//group metadata
diff --git a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/query/QueryTest.java b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/query/QueryTest.java
index 88cae6429..ef81f4799 100644
--- a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/query/QueryTest.java
+++ b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/query/QueryTest.java
@@ -1,16 +1,13 @@
package org.apache.maven.repository.indexing.query;
-import junit.framework.TestCase;
-
/*
- * 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,6 +16,8 @@ import junit.framework.TestCase;
* limitations under the License.
*/
+import junit.framework.TestCase;
+
/**
* @author Edwin Punzalan
*/
diff --git a/maven-repository-manager-site/pom.xml b/maven-repository-manager-site/pom.xml
index 429b99289..debc162f4 100644
--- a/maven-repository-manager-site/pom.xml
+++ b/maven-repository-manager-site/pom.xml
@@ -1,4 +1,21 @@
-<?xml version="1.0"?><project>
+<?xml version="1.0"?>
+<!--
+ ~ 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>
<parent>
<artifactId>maven-repository-manager</artifactId>
<groupId>org.apache.maven.repository</groupId>
diff --git a/maven-repository-manager-site/src/site/site.xml b/maven-repository-manager-site/src/site/site.xml
index c3e0b8044..34bce2117 100644
--- a/maven-repository-manager-site/src/site/site.xml
+++ b/maven-repository-manager-site/src/site/site.xml
@@ -1,18 +1,34 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ~ 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>
<body>
<links>
<item name="Maven" href="http://maven.apache.org/"/>
</links>
- <menu ref="reports" />
+ <menu ref="reports"/>
</body>
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-stylus-skin</artifactId>
</skin>
- <publishDate format="dd MMM yyyy" />
+ <publishDate format="dd MMM yyyy"/>
<bannerLeft>
<name>Maven</name>
<src>http://maven.apache.org/images/apache-maven-project-2.png</src>
diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java
index dda00d569..fa429c5c6 100644
--- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java
+++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java
@@ -89,6 +89,8 @@ public class DefaultProxyManager
*/
private Map failuresCache = new HashMap();
+ private static final int MS_PER_SEC = 1000;
+
public void setConfiguration( ProxyConfiguration config )
{
this.config = config;
@@ -413,7 +415,7 @@ public class DefaultProxyManager
}
else
{
- long repoTimestamp = target.lastModified() + repository.getCachePeriod() * 1000;
+ long repoTimestamp = target.lastModified() + repository.getCachePeriod() * MS_PER_SEC;
wagon.getIfNewer( path, temp, repoTimestamp );
}
diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java
index 68e3e2fa8..aec5ec068 100644
--- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java
+++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java
@@ -29,7 +29,7 @@ import java.io.File;
*/
public interface ProxyManager
{
- static String ROLE = ProxyManager.class.getName();
+ String ROLE = ProxyManager.class.getName();
/**
* Used to retrieve a cached path or retrieve one if the cache does not contain it yet.
diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoader.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoader.java
index 71c76db85..8e336b1c0 100644
--- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoader.java
+++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoader.java
@@ -1,13 +1,13 @@
package org.apache.maven.repository.proxy.configuration;
/*
- * Copyright 2003-2004 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
+ * 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,
@@ -50,70 +50,70 @@ public class MavenProxyPropertyLoader
config.setRepositoryCachePath( getMandatoryProperty( props, REPO_LOCAL_STORE ) );
- {//just get the first proxy and break
- String propertyList = props.getProperty( PROXY_LIST );
- if ( propertyList != null )
+ //just get the first proxy and break
+ String propertyList = props.getProperty( PROXY_LIST );
+ if ( propertyList != null )
+ {
+ StringTokenizer tok = new StringTokenizer( propertyList, "," );
+ while ( tok.hasMoreTokens() )
{
- StringTokenizer tok = new StringTokenizer( propertyList, "," );
- while ( tok.hasMoreTokens() )
+ String key = tok.nextToken();
+ if ( StringUtils.isNotEmpty( key ) )
{
- String key = tok.nextToken();
- if ( StringUtils.isNotEmpty( key ) )
+ String host = getMandatoryProperty( props, "proxy." + key + ".host" );
+ int port = Integer.parseInt( getMandatoryProperty( props, "proxy." + key + ".port" ) );
+
+ // the username and password isn't required
+ String username = props.getProperty( "proxy." + key + ".username" );
+ String password = props.getProperty( "proxy." + key + ".password" );
+
+ if ( StringUtils.isNotEmpty( username ) )
{
- String host = getMandatoryProperty( props, "proxy." + key + ".host" );
- int port = Integer.parseInt( getMandatoryProperty( props, "proxy." + key + ".port" ) );
-
- // the username and password isn't required
- String username = props.getProperty( "proxy." + key + ".username" );
- String password = props.getProperty( "proxy." + key + ".password" );
-
- if ( StringUtils.isNotEmpty( username ) )
- {
- config.setHttpProxy( host, port, username, password );
- }
- else
- {
- config.setHttpProxy( host, port );
- }
-
- //accept only one proxy configuration
- break;
+ config.setHttpProxy( host, port, username, password );
}
+ else
+ {
+ config.setHttpProxy( host, port );
+ }
+
+ //accept only one proxy configuration
+ break;
}
}
}
List repositories = new ArrayList();
- { //get the remote repository list
- String repoList = getMandatoryProperty( props, REPO_LIST );
- StringTokenizer tok = new StringTokenizer( repoList, "," );
- while ( tok.hasMoreTokens() )
- {
- String key = tok.nextToken();
+ //get the remote repository list
+ String repoList = getMandatoryProperty( props, REPO_LIST );
- Properties repoProps = getSubset( props, "repo." + key + "." );
- String url = getMandatoryProperty( props, "repo." + key + ".url" );
- String proxyKey = repoProps.getProperty( "proxy" );
+ StringTokenizer tok = new StringTokenizer( repoList, "," );
+ while ( tok.hasMoreTokens() )
+ {
+ String key = tok.nextToken();
- boolean cacheFailures =
- Boolean.valueOf( repoProps.getProperty( "cache.failures", "false" ) ).booleanValue();
- boolean hardFail = Boolean.valueOf( repoProps.getProperty( "hardfail", "true" ) ).booleanValue();
- long cachePeriod = Long.parseLong( repoProps.getProperty( "cache.period", "0" ) );
+ Properties repoProps = getSubset( props, "repo." + key + "." );
+ String url = getMandatoryProperty( props, "repo." + key + ".url" );
+ String proxyKey = repoProps.getProperty( "proxy" );
- ProxyRepository repository =
- new ProxyRepository( key, url, new DefaultRepositoryLayout(), cacheFailures, cachePeriod );
+ boolean cacheFailures =
+ Boolean.valueOf( repoProps.getProperty( "cache.failures", "false" ) ).booleanValue();
+ boolean hardFail = Boolean.valueOf( repoProps.getProperty( "hardfail", "true" ) ).booleanValue();
+ long cachePeriod = Long.parseLong( repoProps.getProperty( "cache.period", "0" ) );
- repository.setHardfail( hardFail );
+ ProxyRepository repository =
+ new ProxyRepository( key, url, new DefaultRepositoryLayout(), cacheFailures, cachePeriod );
- if ( StringUtils.isNotEmpty( proxyKey ) )
- {
- repository.setProxied( true );
- }
+ repository.setHardfail( hardFail );
- repositories.add( repository );
+ if ( StringUtils.isNotEmpty( proxyKey ) )
+ {
+ repository.setProxied( true );
}
+
+ repositories.add( repository );
}
+
config.setRepositories( repositories );
validateDirectories( config );
@@ -161,7 +161,7 @@ public class MavenProxyPropertyLoader
private String getMandatoryProperty( Properties props, String key )
throws ValidationException
{
- final String value = props.getProperty( key );
+ String value = props.getProperty( key );
if ( value == null )
{
diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java
index b54f02a4f..d873c0af2 100644
--- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java
+++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java
@@ -74,7 +74,7 @@ public class ProxyConfiguration
proxyInfo.setHost( host );
proxyInfo.setPort( port );
- setHttpProxy( proxyInfo );
+ httpProxy = proxyInfo;
}
public void setHttpProxy( String host, int port, String username, String password )
diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ValidationException.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ValidationException.java
index 6f1ca364b..dbd5401f8 100644
--- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ValidationException.java
+++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ValidationException.java
@@ -1,13 +1,13 @@
package org.apache.maven.repository.proxy.configuration;
/*
- * Copyright 2003-2004 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
+ * 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,
diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/repository/ProxyRepository.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/repository/ProxyRepository.java
index 9e2ae73e9..24499f023 100644
--- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/repository/ProxyRepository.java
+++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/repository/ProxyRepository.java
@@ -29,22 +29,22 @@ public class ProxyRepository
extends DefaultArtifactRepository
{
// zero caches forever
- private long cachePeriod = 0;
+ private long cachePeriod;
- private boolean cacheFailures = false;
+ private boolean cacheFailures;
private boolean hardfail = true;
- private boolean proxied = false;
+ private boolean proxied;
public ProxyRepository( String id, String url, ArtifactRepositoryLayout layout, boolean cacheFailures,
long cachePeriod )
{
this( id, url, layout );
- setCacheFailures( cacheFailures );
+ this.cacheFailures = cacheFailures;
- setCachePeriod( cachePeriod );
+ this.cachePeriod = cachePeriod;
}
public ProxyRepository( String id, String url, ArtifactRepositoryLayout layout )
diff --git a/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java b/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java
index f3f8b27ba..a15c595ef 100644
--- a/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java
+++ b/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java
@@ -1,15 +1,5 @@
package org.apache.maven.repository.proxy;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
-import org.apache.maven.repository.proxy.configuration.ProxyConfiguration;
-import org.apache.maven.repository.proxy.repository.ProxyRepository;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-
-import java.io.File;
-
/*
* Copyright 2005-2006 The Apache Software Foundation.
*
@@ -26,6 +16,16 @@ import java.io.File;
* limitations under the License.
*/
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.repository.proxy.configuration.ProxyConfiguration;
+import org.apache.maven.repository.proxy.repository.ProxyRepository;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
+import java.io.File;
+
/**
* @author Edwin Punzalan
*/
@@ -73,11 +73,11 @@ public class DefaultProxyManagerTest
file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );
//test cache
- file = proxy.get( "/commons-logging/commons-logging/1.0/commons-logging-1.0.jar" );
+ proxy.get( "/commons-logging/commons-logging/1.0/commons-logging-1.0.jar" );
try
{
- file = proxy.get( "/commons-logging/commons-logging/2.0/commons-logging-2.0.jar" );
+ proxy.get( "/commons-logging/commons-logging/2.0/commons-logging-2.0.jar" );
fail( "Expected ResourceDoesNotExistException exception not thrown" );
}
catch ( ResourceDoesNotExistException e )
diff --git a/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/LegacyProxyManagerTest.java b/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/LegacyProxyManagerTest.java
index 768e505b8..b0f6d1a7a 100644
--- a/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/LegacyProxyManagerTest.java
+++ b/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/LegacyProxyManagerTest.java
@@ -73,11 +73,11 @@ public class LegacyProxyManagerTest
file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );
//test cache
- file = proxy.get( "/commons-logging/jars/commons-logging-1.0.jar" );
+ proxy.get( "/commons-logging/jars/commons-logging-1.0.jar" );
try
{
- file = proxy.get( "/commons-logging/jars/commons-logging-2.0.jar" );
+ proxy.get( "/commons-logging/jars/commons-logging-2.0.jar" );
fail( "Expected ResourceDoesNotExistException exception not thrown" );
}
catch ( ResourceDoesNotExistException e )
diff --git a/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoaderTest.java b/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoaderTest.java
index 404aed04a..88fee5069 100644
--- a/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoaderTest.java
+++ b/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoaderTest.java
@@ -23,7 +23,6 @@ import org.codehaus.plexus.util.FileUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.util.Iterator;
/**
@@ -32,6 +31,8 @@ import java.util.Iterator;
public class MavenProxyPropertyLoaderTest
extends PlexusTestCase
{
+ private static final int DEFAULT_CACHE_PERIOD = 3600;
+
public void testLoadValidMavenProxyConfiguration()
throws ValidationException, IOException
{
@@ -50,51 +51,34 @@ public class MavenProxyPropertyLoaderTest
assertEquals( "Count repositories", 4, config.getRepositories().size() );
- int idx = 0;
- for ( Iterator repos = config.getRepositories().iterator(); repos.hasNext(); )
- {
- idx++;
-
- ProxyRepository repo = (ProxyRepository) repos.next();
-
- //switch is made to check for ordering
- switch ( idx )
- {
- case 1:
- assertEquals( "Repository name not as expected", "local-repo", repo.getKey() );
- assertEquals( "Repository url does not match its name", "file://target", repo.getUrl() );
- assertEquals( "Repository cache period check failed", 0, repo.getCachePeriod() );
- assertFalse( "Repository failure caching check failed", repo.isCacheFailures() );
- break;
- case 2:
- assertEquals( "Repository name not as expected", "www-ibiblio-org", repo.getKey() );
- assertEquals( "Repository url does not match its name", "http://www.ibiblio.org/maven2",
- repo.getUrl() );
- assertEquals( "Repository cache period check failed", 3600, repo.getCachePeriod() );
- assertTrue( "Repository failure caching check failed", repo.isCacheFailures() );
- break;
- case 3:
- assertEquals( "Repository name not as expected", "dist-codehaus-org", repo.getKey() );
- assertEquals( "Repository url does not match its name", "http://dist.codehaus.org",
- repo.getUrl() );
- assertEquals( "Repository cache period check failed", 3600, repo.getCachePeriod() );
- assertTrue( "Repository failure caching check failed", repo.isCacheFailures() );
- break;
- case 4:
- assertEquals( "Repository name not as expected", "private-example-com", repo.getKey() );
- assertEquals( "Repository url does not match its name", "http://private.example.com/internal",
- repo.getUrl() );
- assertEquals( "Repository cache period check failed", 3600, repo.getCachePeriod() );
- assertFalse( "Repository failure caching check failed", repo.isCacheFailures() );
- break;
- default:
- fail( "Unexpected order count" );
- }
- }
+ ProxyRepository repo = (ProxyRepository) config.getRepositories().get( 0 );
+ assertEquals( "Repository name not as expected", "local-repo", repo.getKey() );
+ assertEquals( "Repository url does not match its name", "file://target", repo.getUrl() );
+ assertEquals( "Repository cache period check failed", 0, repo.getCachePeriod() );
+ assertFalse( "Repository failure caching check failed", repo.isCacheFailures() );
+
+ repo = (ProxyRepository) config.getRepositories().get( 1 );
+ assertEquals( "Repository name not as expected", "www-ibiblio-org", repo.getKey() );
+ assertEquals( "Repository url does not match its name", "http://www.ibiblio.org/maven2", repo.getUrl() );
+ assertEquals( "Repository cache period check failed", DEFAULT_CACHE_PERIOD, repo.getCachePeriod() );
+ assertTrue( "Repository failure caching check failed", repo.isCacheFailures() );
+
+ repo = (ProxyRepository) config.getRepositories().get( 2 );
+ assertEquals( "Repository name not as expected", "dist-codehaus-org", repo.getKey() );
+ assertEquals( "Repository url does not match its name", "http://dist.codehaus.org", repo.getUrl() );
+ assertEquals( "Repository cache period check failed", DEFAULT_CACHE_PERIOD, repo.getCachePeriod() );
+ assertTrue( "Repository failure caching check failed", repo.isCacheFailures() );
+
+ repo = (ProxyRepository) config.getRepositories().get( 3 );
+ assertEquals( "Repository name not as expected", "private-example-com", repo.getKey() );
+ assertEquals( "Repository url does not match its name", "http://private.example.com/internal",
+ repo.getUrl() );
+ assertEquals( "Repository cache period check failed", DEFAULT_CACHE_PERIOD, repo.getCachePeriod() );
+ assertFalse( "Repository failure caching check failed", repo.isCacheFailures() );
}
- //make sure to delete the test directory after tests
finally
{
+ //make sure to delete the test directory after tests
FileUtils.deleteDirectory( "target/remote-repo1" );
}
}
diff --git a/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java b/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java
index 491e8bf19..53f583a98 100644
--- a/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java
+++ b/maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java
@@ -32,6 +32,10 @@ public class ProxyConfigurationTest
{
private ProxyConfiguration config;
+ private static final int DEFAULT_CACHE_PERIOD = 3600;
+
+ private static final int DEFAULT_PORT = 80;
+
protected void setUp()
throws Exception
{
@@ -60,9 +64,9 @@ public class ProxyConfigurationTest
ArtifactRepositoryLayout legacyLayout = new LegacyRepositoryLayout();
ProxyRepository repo2 = new ProxyRepository( "repo2", "http://www.ibiblio.org/maven", legacyLayout );
repo2.setCacheFailures( false );
- repo2.setCachePeriod( 3600 );
+ repo2.setCachePeriod( DEFAULT_CACHE_PERIOD );
repo2.setProxied( true );
- config.setHttpProxy( "some.local.proxy", 80, "username", "password" );
+ config.setHttpProxy( "some.local.proxy", DEFAULT_PORT, "username", "password" );
config.addRepository( repo2 );
assertEquals( 2, config.getRepositories().size() );
@@ -80,14 +84,14 @@ public class ProxyConfigurationTest
assertEquals( "http://www.ibiblio.org/maven", repo.getUrl() );
assertFalse( repo.isCacheFailures() );
assertTrue( repo.isHardfail() );
- assertEquals( 3600, repo.getCachePeriod() );
+ assertEquals( DEFAULT_CACHE_PERIOD, repo.getCachePeriod() );
assertEquals( repo2, repo );
assertTrue( repo.isProxied() );
ProxyInfo proxyInfo = config.getHttpProxy();
assertNotNull( proxyInfo );
assertEquals( "some.local.proxy", proxyInfo.getHost() );
- assertEquals( 80, proxyInfo.getPort() );
+ assertEquals( DEFAULT_PORT, proxyInfo.getPort() );
assertEquals( "username", proxyInfo.getUserName() );
assertEquals( "password", proxyInfo.getPassword() );
@@ -96,7 +100,7 @@ public class ProxyConfigurationTest
repositories.add( new ProxyRepository( "repo", "url", defLayout ) );
fail( "Expected UnsupportedOperationException not thrown." );
}
- catch ( java.lang.UnsupportedOperationException e )
+ catch ( UnsupportedOperationException e )
{
assertTrue( true );
}
diff --git a/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java b/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java
index 02809c60e..1c894d6af 100644
--- a/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java
+++ b/maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java
@@ -132,7 +132,7 @@ public class Cache
* @param key the object to map the valued object
* @param value the object to cache
*/
- public Object put( Object key, Object value )
+ public void put( Object key, Object value )
{
Object old = null;
@@ -148,8 +148,6 @@ public class Cache
}
manageCache();
-
- return old;
}
/**
diff --git a/maven-repository-utils/src/main/java/org/apache/maven/repository/ArtifactUtils.java b/maven-repository-utils/src/main/java/org/apache/maven/repository/ArtifactUtils.java
index e4d7d6602..26ff14da5 100644
--- a/maven-repository-utils/src/main/java/org/apache/maven/repository/ArtifactUtils.java
+++ b/maven-repository-utils/src/main/java/org/apache/maven/repository/ArtifactUtils.java
@@ -37,6 +37,10 @@ import java.util.StringTokenizer;
*/
public class ArtifactUtils
{
+ private ArtifactUtils()
+ {
+ }
+
/**
* Method used to build an artifact and then set its repository and file fields with the proper values
*
@@ -245,6 +249,7 @@ public class ArtifactUtils
// contains artifactId, version, classifier, and extension.
String avceGlob = tokens.nextToken();
+ //noinspection CollectionDeclaredAsConcreteClass
LinkedList avceTokenList = new LinkedList();
StringTokenizer avceTokenizer = new StringTokenizer( avceGlob, "-" );
diff --git a/maven-repository-utils/src/main/java/org/apache/maven/repository/digest/DefaultDigester.java b/maven-repository-utils/src/main/java/org/apache/maven/repository/digest/DefaultDigester.java
index f138a67e2..4974fb05d 100644
--- a/maven-repository-utils/src/main/java/org/apache/maven/repository/digest/DefaultDigester.java
+++ b/maven-repository-utils/src/main/java/org/apache/maven/repository/digest/DefaultDigester.java
@@ -1,16 +1,5 @@
package org.apache.maven.repository.digest;
-import org.codehaus.plexus.util.IOUtil;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
/*
* Copyright 2005-2006 The Apache Software Foundation.
*
@@ -27,6 +16,17 @@ import java.util.regex.Pattern;
* limitations under the License.
*/
+import org.codehaus.plexus.util.IOUtil;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
/**
* Create a digest for a file.
*
diff --git a/maven-repository-utils/src/test/java/org/apache/maven/repository/ArtifactUtilsLegacyTest.java b/maven-repository-utils/src/test/java/org/apache/maven/repository/ArtifactUtilsLegacyTest.java
index 6c0576723..8a1359f41 100644
--- a/maven-repository-utils/src/test/java/org/apache/maven/repository/ArtifactUtilsLegacyTest.java
+++ b/maven-repository-utils/src/test/java/org/apache/maven/repository/ArtifactUtilsLegacyTest.java
@@ -1,5 +1,21 @@
package org.apache.maven.repository;
+/*
+ * 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.factory.ArtifactFactory;
import org.codehaus.plexus.PlexusTestCase;
diff --git a/maven-repository-webapp/pom.xml b/maven-repository-webapp/pom.xml
index cad86049f..6e275db52 100644
--- a/maven-repository-webapp/pom.xml
+++ b/maven-repository-webapp/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 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">
<modelVersion>4.0.0</modelVersion>
diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java
index e05cf20b4..fe4a615a6 100644
--- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java
+++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java
@@ -17,8 +17,8 @@ package org.apache.maven.repository.manager.web.action;
*/
import com.opensymphony.xwork.Action;
-import org.apache.maven.repository.manager.web.job.DiscovererScheduler;
import org.apache.maven.repository.manager.web.execution.DiscovererExecution;
+import org.apache.maven.repository.manager.web.job.DiscovererScheduler;
/**
* This is the Action class of index.jsp, which is the initial page of the web application.
@@ -53,6 +53,7 @@ public class BaseAction
}
catch ( Exception e )
{
+ // TODO: better exception handling!
e.printStackTrace();
return ERROR;
}
diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java
index 5b182cc84..459a8d408 100644
--- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java
+++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java
@@ -1,5 +1,21 @@
package org.apache.maven.repository.manager.web.action;
+/*
+ * 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 com.opensymphony.xwork.Action;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java
index a5e916085..409dcc179 100644
--- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java
+++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java
@@ -20,14 +20,13 @@ import com.opensymphony.xwork.Action;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.repository.indexing.ArtifactRepositoryIndex;
-import org.apache.maven.repository.indexing.DefaultRepositoryIndexSearcher;
+import org.apache.maven.repository.indexing.RepositoryIndex;
import org.apache.maven.repository.indexing.RepositoryIndexException;
import org.apache.maven.repository.indexing.RepositoryIndexSearchException;
-import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
import org.apache.maven.repository.indexing.RepositoryIndexSearchLayer;
+import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
import org.apache.maven.repository.indexing.query.SinglePhraseQuery;
import org.apache.maven.repository.manager.web.job.Configuration;
-import org.apache.maven.repository.indexing.RepositoryIndex;
import java.io.File;
import java.net.MalformedURLException;
diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/RepositoryBrowseAction.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/RepositoryBrowseAction.java
index 62d223d98..870fe06fd 100644
--- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/RepositoryBrowseAction.java
+++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/RepositoryBrowseAction.java
@@ -1,5 +1,21 @@
package org.apache.maven.repository.manager.web.action;
+/*
+ * 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 com.opensymphony.xwork.Action;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -11,6 +27,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.TreeMap;
/**
@@ -38,15 +55,15 @@ public class RepositoryBrowseAction
private String group;
- private TreeMap artifactMap;
+ private Map artifactMap;
private String folder;
private int idx;
public String execute()
- throws Exception
{
+ // TODO! fix hardcoded path
String path = "E:/jeprox/maven-repository-manager/trunk/maven-repository-discovery/src/test/repository";
ArtifactRepository repository =
@@ -58,21 +75,19 @@ public class RepositoryBrowseAction
artifactMap = new TreeMap();
- String groupId;
-
while ( iterator.hasNext() )
{
Artifact artifact = (Artifact) iterator.next();
- groupId = artifact.getGroupId();
+ String groupId = artifact.getGroupId();
String key = groupId.replace( '.', '/' ) + "/" + artifact.getArtifactId() + "/" + artifact.getVersion();
- ArrayList artifactList;
+ List artifactList;
if ( artifactMap.containsKey( key ) )
{
- artifactList = (ArrayList) artifactMap.get( key );
+ artifactList = (List) artifactMap.get( key );
}
else
{
@@ -87,28 +102,28 @@ public class RepositoryBrowseAction
}
//set the index for folder level to be displayed
- setIdx( 1 );
+ idx = 1;
- setFolder( "" );
+ folder = "";
return SUCCESS;
}
+ // TODO! is this method needed?
public String doEdit()
- throws Exception
{
- setIdx( getIdx() + 1 );
+ idx = idx + 1;
//set folder to "" if we are at the root directory
- if ( getIdx() == 1 )
+ if ( idx == 1 )
{
- setFolder( "" );
+ folder = "";
}
return SUCCESS;
}
- public TreeMap getArtifactMap()
+ public Map getArtifactMap()
{
return artifactMap;
}
diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java
index 7b3de21a3..465ebe412 100644
--- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java
+++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java
@@ -16,29 +16,29 @@ package org.apache.maven.repository.manager.web.execution;
* limitations under the License.
*/
+import org.apache.lucene.index.IndexReader;
+import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.repository.indexing.RepositoryIndexException;
+import org.apache.maven.model.Model;
+import org.apache.maven.repository.discovery.ArtifactDiscoverer;
+import org.apache.maven.repository.discovery.MetadataDiscoverer;
import org.apache.maven.repository.indexing.ArtifactRepositoryIndex;
import org.apache.maven.repository.indexing.MetadataRepositoryIndex;
import org.apache.maven.repository.indexing.PomRepositoryIndex;
+import org.apache.maven.repository.indexing.RepositoryIndexException;
import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
import org.apache.maven.repository.manager.web.job.Configuration;
-import org.apache.maven.repository.discovery.ArtifactDiscoverer;
-import org.apache.maven.repository.discovery.MetadataDiscoverer;
-import org.apache.maven.model.Model;
-import org.apache.lucene.index.IndexReader;
import org.codehaus.plexus.logging.AbstractLogEnabled;
-import java.util.List;
-import java.util.Iterator;
-import java.util.Properties;
import java.io.File;
import java.net.MalformedURLException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
/**
* This is the class that executes the discoverer and indexer.
@@ -80,8 +80,6 @@ public class DiscovererExecution
private ArtifactRepositoryLayout layout;
- private Properties props;
-
private String indexPath;
private String blacklistedPatterns;
@@ -101,24 +99,16 @@ public class DiscovererExecution
public void executeDiscovererIfIndexDoesNotExist()
throws MalformedURLException, RepositoryIndexException
{
- props = config.getProperties();
+ Properties props = config.getProperties();
indexPath = props.getProperty( "index.path" );
File indexDir = new File( indexPath );
- boolean isExisting;
+ boolean isExisting = false;
if ( IndexReader.indexExists( indexDir ) )
{
isExisting = true;
}
- else if ( !indexDir.exists() )
- {
- isExisting = false;
- }
- else
- {
- isExisting = false;
- }
if ( !isExisting )
{
@@ -132,12 +122,12 @@ public class DiscovererExecution
public void executeDiscoverer()
throws MalformedURLException, RepositoryIndexException
{
- props = config.getProperties();
+ Properties props = config.getProperties();
indexPath = props.getProperty( "index.path" );
layout = config.getLayout();
blacklistedPatterns = props.getProperty( "blacklist.patterns" );
- includeSnapshots = new Boolean( props.getProperty( "include.snapshots" ) ).booleanValue();
- convertSnapshots = new Boolean( props.getProperty( "convert.snapshots" ) ).booleanValue();
+ includeSnapshots = Boolean.valueOf( props.getProperty( "include.snapshots" ) ).booleanValue();
+ convertSnapshots = Boolean.valueOf( props.getProperty( "convert.snapshots" ) ).booleanValue();
try
{
@@ -149,11 +139,11 @@ public class DiscovererExecution
}
getLogger().info( "[DiscovererExecution] Started discovery and indexing.." );
- if ( props.getProperty( "layout" ).equals( "default" ) )
+ if ( "default".equals( props.getProperty( "layout" ) ) )
{
executeDiscovererInDefaultRepo();
}
- else if ( props.getProperty( "layout" ).equals( "legacy" ) )
+ else if ( "legacy".equals( props.getProperty( "layout" ) ) )
{
executeDiscovererInLegacyRepo();
}
@@ -210,17 +200,7 @@ public class DiscovererExecution
for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
{
Artifact artifact = (Artifact) iter.next();
- try
- {
- artifactIndex.indexArtifact( artifact );
- }
- catch ( Exception e )
- {
- if ( e instanceof RepositoryIndexException )
- {
- throw (RepositoryIndexException) e;
- }
- }
+ artifactIndex.indexArtifact( artifact );
if ( artifactIndex.isOpen() )
{
@@ -248,17 +228,8 @@ public class DiscovererExecution
for ( Iterator iter = metadataList.iterator(); iter.hasNext(); )
{
RepositoryMetadata repoMetadata = (RepositoryMetadata) iter.next();
- try
- {
- metadataIndex.index( repoMetadata );
- }
- catch ( Exception e )
- {
- if ( e instanceof RepositoryIndexException )
- {
- throw (RepositoryIndexException) e;
- }
- }
+ metadataIndex.index( repoMetadata );
+
if ( metadataIndex.isOpen() )
{
metadataIndex.optimize();
@@ -281,17 +252,7 @@ public class DiscovererExecution
for ( Iterator iter = models.iterator(); iter.hasNext(); )
{
Model model = (Model) iter.next();
- try
- {
- pomIndex.indexPom( model );
- }
- catch ( Exception e )
- {
- if ( e instanceof RepositoryIndexException )
- {
- throw (RepositoryIndexException) e;
- }
- }
+ pomIndex.indexPom( model );
if ( pomIndex.isOpen() )
{
diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java
index c0fe67f79..0e147321c 100644
--- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java
+++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java
@@ -1,12 +1,5 @@
package org.apache.maven.repository.manager.web.job;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
-import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
-
-import java.util.Properties;
/*
* Copyright 2005-2006 The Apache Software Foundation.
*
@@ -23,6 +16,14 @@ import java.util.Properties;
* limitations under the License.
*/
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+
+import java.util.Properties;
+
/**
* This class contains the configuration values to be used by the scheduler
*/
diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java
index f7a27ce5d..9a93a115b 100644
--- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java
+++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java
@@ -16,32 +16,14 @@ package org.apache.maven.repository.manager.web.job;
* limitations under the License.
*/
-import org.apache.maven.artifact.Artifact;
-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.RepositoryMetadata;
-import org.apache.maven.model.Model;
-import org.apache.maven.repository.discovery.ArtifactDiscoverer;
-import org.apache.maven.repository.discovery.DefaultArtifactDiscoverer;
-import org.apache.maven.repository.discovery.DefaultMetadataDiscoverer;
-import org.apache.maven.repository.discovery.LegacyArtifactDiscoverer;
-import org.apache.maven.repository.discovery.MetadataDiscoverer;
-import org.apache.maven.repository.indexing.ArtifactRepositoryIndex;
-import org.apache.maven.repository.indexing.MetadataRepositoryIndex;
-import org.apache.maven.repository.indexing.PomRepositoryIndex;
import org.apache.maven.repository.indexing.RepositoryIndexException;
-import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
import org.apache.maven.repository.manager.web.execution.DiscovererExecution;
import org.codehaus.plexus.scheduler.AbstractJob;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
-import java.io.File;
import java.net.MalformedURLException;
-import java.util.Iterator;
-import java.util.List;
/**
* This class is the discoverer job that is executed by the scheduler.
@@ -53,7 +35,7 @@ public class DiscovererJob
{
public static final String ROLE = DiscovererJob.class.getName();
- public static String MAP_DISCOVERER_EXECUTION = "EXECUTION";
+ public static final String MAP_DISCOVERER_EXECUTION = "EXECUTION";
/**
* Execute the discoverer and the indexer.
@@ -76,10 +58,12 @@ public class DiscovererJob
}
catch ( RepositoryIndexException e )
{
+ // TODO!
e.printStackTrace();
}
catch ( MalformedURLException me )
{
+ // TODO!
me.printStackTrace();
}
diff --git a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java
index bc708234c..8d66dfe0d 100644
--- a/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java
+++ b/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java
@@ -16,26 +16,18 @@ package org.apache.maven.repository.manager.web.job;
* limitations under the License.
*/
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.text.ParseException;
-import java.util.Properties;
-
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory;
-import org.apache.maven.repository.discovery.ArtifactDiscoverer;
-import org.apache.maven.repository.discovery.MetadataDiscoverer;
-import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
import org.apache.maven.repository.manager.web.execution.DiscovererExecution;
import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.scheduler.AbstractJob;
import org.codehaus.plexus.scheduler.Scheduler;
import org.quartz.CronTrigger;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.SchedulerException;
+import java.text.ParseException;
+import java.util.Properties;
+
/**
* This class sets the job to be executed in the plexus-quartz scheduler
*
@@ -54,8 +46,6 @@ public class DiscovererScheduler
*/
private Scheduler scheduler;
- private Properties props;
-
/**
* @plexus.requirement
*/
@@ -64,17 +54,16 @@ public class DiscovererScheduler
/**
* Method that sets the schedule in the plexus-quartz scheduler
*
- * @throws IOException
* @throws ParseException
* @throws SchedulerException
*/
public void setSchedule()
- throws IOException, ParseException, SchedulerException
+ throws ParseException, SchedulerException
{
- props = config.getProperties();
+ Properties props = config.getProperties();
JobDetail jobDetail = new JobDetail( "discovererJob", "DISCOVERER", DiscovererJob.class );
JobDataMap dataMap = new JobDataMap();
- dataMap.put( DiscovererJob.LOGGER, getLogger() );
+ dataMap.put( AbstractJob.LOGGER, getLogger() );
dataMap.put( DiscovererJob.MAP_DISCOVERER_EXECUTION, execution );
jobDetail.setJobDataMap( dataMap );
diff --git a/maven-repository-webapp/src/main/webapp/WEB-INF/decorators.xml b/maven-repository-webapp/src/main/webapp/WEB-INF/decorators.xml
index 6838e8ed0..03131ae9f 100644
--- a/maven-repository-webapp/src/main/webapp/WEB-INF/decorators.xml
+++ b/maven-repository-webapp/src/main/webapp/WEB-INF/decorators.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.
+ -->
+
<decorators defaultdir="/WEB-INF/jsp/decorators">
<decorator name="default" page="default.jsp">
<pattern>/*</pattern>
diff --git a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp
index bf950fd65..a07fe5948 100644
--- a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp
+++ b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp
@@ -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.
+ --%>
+
<%@ taglib uri="webwork" prefix="ww" %>
<html>
@@ -7,24 +23,24 @@
<body>
<h3><a href="<ww:url value="browse!edit.action"><ww:param name="idx" value="0"/></ww:url>">basedir</a> /
- <ww:set name="previousFolder" value="''"/>
- <ww:set name="counter" value="0"/>
+ <ww:set name="previousFolder" value="''" />
+ <ww:set name="counter" value="0" />
<ww:if test="folder != ''">
- <ww:set name="folderHeader" value="folder.split('/')"/>
+ <ww:set name="folderHeader" value="folder.split('/')" />
<ww:iterator value="#folderHeader">
- <ww:set name="counter" value="#counter + 1"/>
+ <ww:set name="counter" value="#counter + 1" />
<ww:if test="#previousFolder == ''">
- <ww:set name="previousFolder" value="top"/>
+ <ww:set name="previousFolder" value="top" />
</ww:if>
<ww:else>
- <ww:set name="previousFolder" value="#previousFolder + '/' + top"/>
+ <ww:set name="previousFolder" value="#previousFolder + '/' + top" />
</ww:else>
<ww:if test="idx > (#counter + 1)"><a href="<ww:url value="browse!edit.action"><ww:param name="idx"><ww:property
- value="#counter"/></ww:param><ww:param name="folder"></ww:param></ww:url>"></ww:if><ww:property/></a> /
+ value="#counter" /></ww:param><ww:param name="folder"></ww:param></ww:url>"></ww:if><ww:property /></a> /
</ww:iterator>
</ww:if>
</h3>
-<br/>
+<br />
<ww:set name="previousFolder" value="'the previous folder'"/>
<ww:set name="in" value="idx" scope="page"/>
@@ -33,14 +49,18 @@
<ww:if test="idx == 1 || (folder != '' and #groupName.startsWith(folder))">
<%
+
int ctr = 1;
+
%>
<ww:set name="groupFolder" value="#groupName.split('/')"/>
<ww:iterator value="#groupFolder">
<%
+
if (ctr == ((Integer)pageContext.getAttribute("in")).intValue()) {
+
%>
<ww:if test="top != #previousFolder">
<ww:set name="previousFolder" value="top"/>
@@ -57,32 +77,32 @@ if (ctr == ((Integer)pageContext.getAttribute("in")).intValue()) {
</ww:iterator>
<ww:if test="folder != ''">
- <ww:set name="previousFolder" value="''"/>
- <ww:set name="artifactList" value="artifactMap.get(folder)"/>
+ <ww:set name="previousFolder" value="''" />
+ <ww:set name="artifactList" value="artifactMap.get(folder)" />
<ww:iterator value="#artifactList">
<table border="1">
<tr align="left">
<th>Group ID</th>
- <td><ww:property value="groupId"/></td>
+ <td><ww:property value="groupId" /></td>
</tr>
<tr align="left">
<th>Artifact ID</th>
- <td><ww:property value="artifactId"/></td>
+ <td><ww:property value="artifactId" /></td>
</tr>
<tr align="left">
<th>Version</th>
- <td><ww:property value="version"/></td>
+ <td><ww:property value="version" /></td>
</tr>
<tr align="left">
<th>Derivatives</th>
- <td><ww:property value="groupId"/></td>
+ <td><ww:property value="groupId" /></td>
</tr>
<tr align="left">
<th>Parent</th>
- <td><ww:property value="folder"/></td>
+ <td><ww:property value="folder" /></td>
</tr>
</table>
- <br/>
+ <br />
</ww:iterator>
</ww:if>
</body>
diff --git a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
index c4818db2d..23a934220 100644
--- a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
+++ b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
@@ -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.
+ --%>
+
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<html>
<head>
diff --git a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/form.jspf b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/form.jspf
index 158fe9f61..6049fe788 100644
--- a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/form.jspf
+++ b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/form.jspf
@@ -12,7 +12,6 @@
~ 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.
- ~
--%>
<script type="text/javascript">
diff --git a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/index.jsp b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/index.jsp
index 202871712..0ae0ab768 100644
--- a/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/index.jsp
+++ b/maven-repository-webapp/src/main/webapp/WEB-INF/jsp/index.jsp
@@ -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.
+ --%>
+
<%@ taglib uri="webwork" prefix="ww" %>
<html>
<head>
diff --git a/maven-repository-webapp/src/main/webapp/WEB-INF/web.xml b/maven-repository-webapp/src/main/webapp/WEB-INF/web.xml
index 5a46febfc..847a49e3d 100644
--- a/maven-repository-webapp/src/main/webapp/WEB-INF/web.xml
+++ b/maven-repository-webapp/src/main/webapp/WEB-INF/web.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.
+ -->
+
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
diff --git a/maven-repository-webapp/src/main/webapp/css/maven-base.css b/maven-repository-webapp/src/main/webapp/css/maven-base.css
index 8adb0098b..9dc7da470 100644
--- a/maven-repository-webapp/src/main/webapp/css/maven-base.css
+++ b/maven-repository-webapp/src/main/webapp/css/maven-base.css
@@ -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.
+ */
+
body {
margin: 0px;
padding: 0px;
diff --git a/maven-repository-webapp/src/main/webapp/css/maven-theme.css b/maven-repository-webapp/src/main/webapp/css/maven-theme.css
index 886d4fc0f..d52c16512 100644
--- a/maven-repository-webapp/src/main/webapp/css/maven-theme.css
+++ b/maven-repository-webapp/src/main/webapp/css/maven-theme.css
@@ -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.
+ */
+
body {
padding: 0px 0px 10px 0px;
}
diff --git a/maven-repository-webapp/src/main/webapp/css/print.css b/maven-repository-webapp/src/main/webapp/css/print.css
index 5695a5ac0..9a6106d2d 100644
--- a/maven-repository-webapp/src/main/webapp/css/print.css
+++ b/maven-repository-webapp/src/main/webapp/css/print.css
@@ -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.
+ */
+
#banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks, #leftColumn, #navColumn {
display: none !important;
}
diff --git a/maven-repository-webapp/src/main/webapp/css/site.css b/maven-repository-webapp/src/main/webapp/css/site.css
index d13661b87..8f0702b3a 100644
--- a/maven-repository-webapp/src/main/webapp/css/site.css
+++ b/maven-repository-webapp/src/main/webapp/css/site.css
@@ -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.
+ */
+
#sidebar {
float: right;
font-size: small;
diff --git a/maven-repository-webapp/src/main/webapp/index.jsp b/maven-repository-webapp/src/main/webapp/index.jsp
index 66a198330..867a05e78 100644
--- a/maven-repository-webapp/src/main/webapp/index.jsp
+++ b/maven-repository-webapp/src/main/webapp/index.jsp
@@ -1 +1,17 @@
+<%--
+ ~ 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.
+ --%>
+
<%response.sendRedirect( request.getContextPath() + "/index.action" );%> \ No newline at end of file