You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jd...@apache.org on 2005/04/26 03:32:09 UTC
svn commit: r164705 [1/2] - in
/maven/components/trunk/sandbox/repoclean/src/main: bash/
java/org/apache/maven/tools/repoclean/
java/org/apache/maven/tools/repoclean/artifact/handler/
java/org/apache/maven/tools/repoclean/artifact/layout/
java/org/apache/maven/tools/repoclean/artifact/metadata/
java/org/apache/maven/tools/repoclean/digest/
java/org/apache/maven/tools/repoclean/discover/
java/org/apache/maven/tools/repoclean/index/
java/org/apache/maven/tools/repoclean/report/
java/org/apache/maven/tools/repoclean/rewrite/
java/org/apache/maven/tools/repoclean/transaction/
java/org/apache/maven/tools/repoclean/translate/ resources/META-INF/plexus/
Author: jdcasey
Date: Mon Apr 25 18:32:07 2005
New Revision: 164705
URL: http://svn.apache.org/viewcvs?rev=164705&view=rev
Log:
o fixed conditions under which error emails should be sent
o fixed emailing to contain a link to the report
o reformatted using IDEA
o removed directory tracking from transactions, b/c undo order is too tricky for now
o adjusted code to maven-artifact (post maven-project creation) changes.
Modified:
maven/components/trunk/sandbox/repoclean/src/main/bash/repoclean.sh
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/Main.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleanerConfiguration.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/DtdHandler.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/EarHandler.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/JarDistroHandler.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/LegacyPluginHandler.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/RarHandler.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/SarHandler.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/TgzDistroHandler.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/TldHandler.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/ZipDistroHandler.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/layout/AlphaBridgingRepositoryLayout.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/metadata/ProjectMetadata.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestException.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerificationException.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerifier.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/Digestor.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/AbstractArtifactDiscoverer.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/ArtifactDiscoverer.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/DefaultArtifactDiscoverer.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/LegacyArtifactDiscoverer.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/index/ArtifactIndexer.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/FileReporter.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/PathLister.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/ReportWriteException.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/ArtifactPomRewriter.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/V3PomRewriter.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/V4PomRewriter.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/transaction/RewriteTransaction.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/transaction/RollbackException.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/translate/PomTranslationException.java
maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/translate/PomV3ToV4Translator.java
maven/components/trunk/sandbox/repoclean/src/main/resources/META-INF/plexus/components.xml
Modified: maven/components/trunk/sandbox/repoclean/src/main/bash/repoclean.sh
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/bash/repoclean.sh?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/bash/repoclean.sh (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/bash/repoclean.sh Mon Apr 25 18:32:07 2005
@@ -17,7 +17,7 @@
CP=$mydir/lib/repoclean-1.0-SNAPSHOT.jar
-for lib in `ls -1 ./lib | grep -v 'repoclean'`
+for lib in `ls -1 $mydir/lib | grep -v 'repoclean'`
do
CP=$CP:$mydir/lib/$lib
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/Main.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/Main.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/Main.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/Main.java Mon Apr 25 18:32:07 2005
@@ -30,14 +30,14 @@
*/
public class Main
{
-
+
public static final String FORCE_ARG = "--force";
public static void main( String[] args )
{
boolean force = false;
String configFile = null;
-
+
if ( args.length < 1 )
{
printUsage();
@@ -56,21 +56,21 @@
// up the ante, and let's try to see if there's a --force option.
else if ( args.length == 2 )
{
- if(FORCE_ARG.equals(args[0]))
+ if ( FORCE_ARG.equals( args[0] ) )
{
force = true;
configFile = args[1];
}
- else if(FORCE_ARG.equals(args[1]))
+ else if ( FORCE_ARG.equals( args[1] ) )
{
force = true;
configFile = args[0];
}
else
{
- System.out.println("Invalid argument list: \'" + args[0] + " " + args[1]);
+ System.out.println( "Invalid argument list: \'" + args[0] + " " + args[1] );
printUsage();
- System.exit(1);
+ System.exit( 1 );
}
}
else
@@ -81,22 +81,23 @@
try
{
RepositoryCleanerConfiguration config = buildConfig( configFile );
-
- config.setForce(force);
+
+ config.setForce( force );
launch( config );
-
+
System.exit( 0 );
}
catch ( Exception e )
{
e.printStackTrace();
-
+
System.exit( 1 );
}
}
- public static void launch( RepositoryCleanerConfiguration config ) throws Exception
+ public static void launch( RepositoryCleanerConfiguration config )
+ throws Exception
{
Embedder embedder = new Embedder();
embedder.start( new ClassWorld() );
@@ -142,60 +143,39 @@
config.setBlacklistedPatterns( props.getProperty( "blacklistedPatterns" ) );
config.setReportOnly( Boolean.valueOf( props.getProperty( "reportOnly" ) ).booleanValue() );
- config.setMailErrorReport( Boolean.valueOf( props.getProperty( "errorReport.mailOnError", "false") ).booleanValue() );
+ config.setMailErrorReport(
+ Boolean.valueOf( props.getProperty( "errorReport.mailOnError", "false" ) ).booleanValue() );
config.setErrorReportFromAddress( props.getProperty( "errorReport.fromAddress" ) );
config.setErrorReportFromName( props.getProperty( "errorReport.fromName" ) );
config.setErrorReportSubject( props.getProperty( "errorReport.subject" ) );
config.setErrorReportToAddress( props.getProperty( "errorReport.toAddress" ) );
config.setErrorReportToName( props.getProperty( "errorReport.toName" ) );
+ config.setErrorReportLink( props.getProperty( "errorReport.link" ) );
return config;
}
private static void printHelp()
{
- System.out.println( "repoclean: Repository Cleaner/Converter.\n\n"
- + "Usage: repoclean -h|-template|<configuration-properties-file>\n\n"
- + "---------------------------------------------------------------------------\n"
- + " Use the '-template' option to see sample configuration file options.\n"
- + "\n" );
+ System.out.println( "repoclean: Repository Cleaner/Converter.\n\n" +
+ "Usage: repoclean -h|-template|<configuration-properties-file>\n\n" +
+ "---------------------------------------------------------------------------\n" +
+ " Use the '-template' option to see sample configuration file options.\n" + "\n" );
}
private static void printTemplate()
{
- System.out.println( "# ---------------------------------------------------------------------------\n"
- + "# repoclean: Repository Cleaner/Converter.\n"
- + "# This configuration auto-generated on: " + new java.util.Date() + "\n"
- + "# ---------------------------------------------------------------------------\n\n"
- + "# [REQUIRED OPTIONS]\n"
- + "sourceRepositoryPath=/path/to/repository/root\n"
- + "targetRepositoryPath=/path/to/repository/root\n"
- + "reportsPath=/path/to/reports/directory\n"
- + "reportOnly=[true|false]\n"
- + "\n"
- + "errorReport.mailOnError=[true|false]\n"
- + "errorReport.fromAddress=admin@somewhere.com\n"
- + "errorReport.fromName=Admin\n"
- + "errorReport.subject=[REPOCLEAN] Error!\n"
- + "errorReport.toAddress=dev@somewhere.com\n"
- + "errorReport.toName=Developers List\n"
- + "\n"
- + "# [DEFAULT VALUE: legacy]\n"
- + "#sourceRepositoryLayout=[legacy|default]\n\n"
- + "# [DEFAULT VALUE: v3]\n"
- + "#sourcePomType=[v3|v4]\n\n"
- + "# [DEFAULT VALUE: default]\n"
- + "#targetRepositoryLayout=[legacy|default]\n"
- + "# [DEFAULT VALUE: localhost]\n"
- + "#errorReport.smtpHost=<hostname>\n"
- + "\n" );
+ System.out.println( "# ---------------------------------------------------------------------------\n" +
+ "# repoclean: Repository Cleaner/Converter.\n" + "# This configuration auto-generated on: " + new java.util.Date() + "\n" +
+ "# ---------------------------------------------------------------------------\n\n" +
+ "# [REQUIRED OPTIONS]\n" + "sourceRepositoryPath=/path/to/repository/root\n" + "targetRepositoryPath=/path/to/repository/root\n" + "reportsPath=/path/to/reports/directory\n" + "reportOnly=[true|false]\n" + "\n" + "errorReport.mailOnError=[true|false]\n" + "errorReport.fromAddress=admin@somewhere.com\n" + "errorReport.fromName=Admin\n" + "errorReport.subject=[REPOCLEAN] Error!\n" + "errorReport.toAddress=dev@somewhere.com\n" + "errorReport.toName=Developers List\n" + "\n" + "# [DEFAULT VALUE: legacy]\n" + "#sourceRepositoryLayout=[legacy|default]\n\n" + "# [DEFAULT VALUE: v3]\n" + "#sourcePomType=[v3|v4]\n\n" + "# [DEFAULT VALUE: default]\n" + "#targetRepositoryLayout=[legacy|default]\n" + "# [DEFAULT VALUE: localhost]\n" + "#errorReport.smtpHost=<hostname>\n" + "\n" );
}
private static void printUsage()
{
- System.out.println( "Required input is missing.\n\n" + "Usage:\n"
- + "--------------------------------------------------\n\n"
- + "repoclean -h|-template|<configuration-properties-file>\n" );
+ System.out.println( "Required input is missing.\n\n" + "Usage:\n" +
+ "--------------------------------------------------\n\n" +
+ "repoclean -h|-template|<configuration-properties-file>\n" );
}
}
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java Mon Apr 25 18:32:07 2005
@@ -1,14 +1,14 @@
package org.apache.maven.tools.repoclean;
/*
- * ====================================================================
+ * ====================================================================
* Copyright 2001-2004 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
@@ -16,7 +16,6 @@
*/
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.construction.ArtifactConstructionSupport;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
@@ -39,6 +38,7 @@
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.mailsender.MailMessage;
import org.codehaus.plexus.mailsender.MailSender;
+import org.codehaus.plexus.mailsender.MailSenderException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import org.codehaus.plexus.util.IOUtil;
@@ -47,7 +47,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -59,9 +58,7 @@
/**
* @author jdcasey
*/
-public class RepositoryCleaner
- extends AbstractLogEnabled
- implements Contextualizable
+public class RepositoryCleaner extends AbstractLogEnabled implements Contextualizable
{
public static final String ROLE = RepositoryCleaner.class.getName();
@@ -76,10 +73,10 @@
private ArtifactIndexer artifactIndexer;
- private ArtifactConstructionSupport artifactConstructionSupport = new ArtifactConstructionSupport();
-
private PlexusContainer container;
+ private String dateSubdir;
+
public void cleanRepository( RepositoryCleanerConfiguration configuration )
throws Exception
{
@@ -89,8 +86,6 @@
File targetRepositoryBase = normalizeTargetRepositoryBase( configuration.getTargetRepositoryPath() );
- boolean mailReport = false;
-
// do not proceed if we cannot produce reports, or if the repository is
// invalid.
if ( reportsBase != null && sourceRepositoryBase != null && targetRepositoryBase != null )
@@ -105,14 +100,14 @@
ArtifactDiscoverer artifactDiscoverer = null;
List artifacts = null;
-
+
PathLister kickoutLister = null;
PathLister excludeLister = null;
-
+
try
{
- artifactDiscoverer = (ArtifactDiscoverer) container.lookup( ArtifactDiscoverer.ROLE, configuration
- .getSourceRepositoryLayout() );
+ artifactDiscoverer = (ArtifactDiscoverer) container.lookup( ArtifactDiscoverer.ROLE,
+ configuration.getSourceRepositoryLayout() );
if ( logger.isInfoEnabled() )
{
@@ -121,14 +116,15 @@
try
{
- File kickoutsList = new File(reportsBase, "kickouts.txt");
- File excludesList = new File(reportsBase, "excludes.txt");
-
- kickoutLister = new PathLister(kickoutsList);
- excludeLister = new PathLister(excludesList);
+ File kickoutsList = new File( reportsBase, "kickouts.txt" );
+ File excludesList = new File( reportsBase, "excludes.txt" );
+
+ kickoutLister = new PathLister( kickoutsList );
+ excludeLister = new PathLister( excludesList );
artifacts = artifactDiscoverer.discoverArtifacts( sourceRepositoryBase, repoReporter,
- configuration.getBlacklistedPatterns(), excludeLister, kickoutLister );
+ configuration.getBlacklistedPatterns(),
+ excludeLister, kickoutLister );
}
catch ( Exception e )
{
@@ -142,9 +138,16 @@
{
container.release( artifactDiscoverer );
}
-
- excludeLister.close();
- kickoutLister.close();
+
+ if ( excludeLister != null )
+ {
+ excludeLister.close();
+ }
+
+ if ( kickoutLister != null )
+ {
+ kickoutLister.close();
+ }
}
if ( artifacts != null )
@@ -154,18 +157,18 @@
try
{
sourceLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE,
- configuration
- .getSourceRepositoryLayout() );
+ configuration.getSourceRepositoryLayout() );
- ArtifactRepository sourceRepo = new ArtifactRepository( "source", "file://"
- + sourceRepositoryBase.getAbsolutePath(), sourceLayout );
+ ArtifactRepository sourceRepo = new ArtifactRepository( "source", "file://" +
+ sourceRepositoryBase.getAbsolutePath(),
+ sourceLayout );
targetLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE,
- configuration
- .getTargetRepositoryLayout() );
+ configuration.getTargetRepositoryLayout() );
- ArtifactRepository targetRepo = new ArtifactRepository( "target", "file://"
- + targetRepositoryBase.getAbsolutePath(), targetLayout );
+ ArtifactRepository targetRepo = new ArtifactRepository( "target", "file://" +
+ targetRepositoryBase.getAbsolutePath(),
+ targetLayout );
if ( logger.isInfoEnabled() )
{
@@ -198,13 +201,8 @@
if ( repoReporter.hasWarning() && logger.isWarnEnabled() )
{
- logger
- .warn( "Warning encountered while rewriting one or more artifacts from source repository to target repository." );
- }
-
- if ( repoReporter.hasError() )
- {
- mailReport = true;
+ logger.warn(
+ "Warning encountered while rewriting one or more artifacts from source repository to target repository." );
}
}
finally
@@ -215,51 +213,43 @@
}
}
- if ( mailReport && configuration.mailErrorReport() )
+ // if we wrote a repository report, and the configuration says to email the report, then do it.
+ if ( repoReporter.hasError() && configuration.mailErrorReport() )
{
- String reportContents = readReportFile( repoReporter.getReportFile() );
+ logger.info( "Sending error report to " + configuration.getErrorReportToName() + " via email." );
MailMessage message = new MailMessage();
- message.setContent( reportContents );
+
+ StringBuffer contentBuffer = new StringBuffer();
+
+ contentBuffer.append( "Errors occurred while performing maven-1 to maven-2 repository conversion.\n\n" +
+ "For more details, see:\n\n" );
+
+ contentBuffer.append( configuration.getErrorReportLink().replaceAll("#date", dateSubdir) );
+
+ message.setContent( contentBuffer.toString() );
message.setSubject( configuration.getErrorReportSubject() );
message.setFrom( configuration.getErrorReportFromName(), configuration.getErrorReportFromAddress() );
message.setSendDate( new Date() );
message.addTo( configuration.getErrorReportToName(), configuration.getErrorReportToAddress() );
- mailSender.send( message );
+ try
+ {
+ mailSender.send( message );
+ }
+ catch ( MailSenderException e )
+ {
+ logger.error( "An error occurred while trying to email repoclean report.", e );
+ }
}
}
}
- private String readReportFile( File reportFile )
- throws IOException
- {
- FileReader reader = null;
- try
- {
- reader = new FileReader( reportFile );
-
- StringBuffer reportContent = new StringBuffer();
- char[] buffer = new char[512];
- int read = -1;
-
- while ( ( read = reader.read( buffer ) ) > -1 )
- {
- reportContent.append( buffer, 0, read );
- }
-
- return reportContent.toString();
- }
- finally
- {
- IOUtil.close( reader );
- }
- }
-
private void rewriteArtifactsAndPoms( List artifacts, ArtifactRepository sourceRepo, ArtifactRepository targetRepo,
- RepositoryCleanerConfiguration configuration, File reportsBase,
- File sourceRepositoryBase, File targetRepositoryBase, FileReporter repoReporter )
+ RepositoryCleanerConfiguration configuration, File reportsBase,
+ File sourceRepositoryBase, File targetRepositoryBase,
+ FileReporter repoReporter )
throws Exception
{
Logger logger = getLogger();
@@ -268,8 +258,8 @@
try
{
- logger.info( "Rewriting up to " + artifacts.size() + " artifacts (Should be " + ( artifacts.size() * 2 )
- + " rewrites including POMs)." );
+ logger.info( "Rewriting up to " + artifacts.size() + " artifacts (Should be " + ( artifacts.size() * 2 ) +
+ " rewrites including POMs)." );
int actualRewriteCount = 0;
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
@@ -288,14 +278,15 @@
boolean errorOccurred = false;
File artifactSource = new File( sourceRepo.getBasedir(), sourceRepo.pathOf( artifact ) );
- File artifactTarget = new File( targetRepo.getBasedir(), targetRepo.pathOf( artifact ).replace('+', '-') );
+ File artifactTarget = new File( targetRepo.getBasedir(), targetRepo.pathOf( artifact ).replace(
+ '+', '-' ) );
transaction.addFile( artifactTarget );
artifact.setFile( artifactSource );
- boolean targetMissingOrOlder = !artifactTarget.exists()
- || artifactTarget.lastModified() < artifactSource.lastModified();
+ boolean targetMissingOrOlder = !artifactTarget.exists() ||
+ artifactTarget.lastModified() < artifactSource.lastModified();
if ( artifactSource.exists() && ( configuration.force() || targetMissingOrOlder ) )
{
@@ -316,15 +307,13 @@
File targetParent = artifactTarget.getParentFile();
if ( !targetParent.exists() )
{
- transaction.addFile( targetParent );
-
targetParent.mkdirs();
}
if ( logger.isDebugEnabled() )
{
- logger.debug( "Copying artifact[" + artifact.getId() + "] from \'" + artifactSource
- + "\' to \'" + artifactTarget + "\'." );
+ logger.debug( "Copying artifact[" + artifact.getId() + "] from \'" +
+ artifactSource + "\' to \'" + artifactTarget + "\'." );
}
copyArtifact( artifact, artifactTarget, artifactReporter );
@@ -332,22 +321,22 @@
}
catch ( Exception e )
{
- repoReporter.error( "Error transferring artifact[" + artifact.getId()
- + "] to the target repository.", e );
+ repoReporter.error( "Error transferring artifact[" + artifact.getId() +
+ "] to the target repository.", e );
throw e;
}
if ( logger.isDebugEnabled() )
{
- logger.debug( "working on digest for artifact[" + artifact.getId() + "] with groupId: \'"
- + artifact.getGroupId() + "\'" );
+ logger.debug( "working on digest for artifact[" + artifact.getId() + "] with groupId: \'" +
+ artifact.getGroupId() + "\'" );
}
try
{
- digestVerifier.verifyDigest( artifactSource, artifactTarget, transaction,
- artifactReporter, configuration.reportOnly() );
+ digestVerifier.verifyDigest( artifactSource, artifactTarget, transaction, artifactReporter,
+ configuration.reportOnly() );
}
catch ( Exception e )
{
@@ -359,16 +348,17 @@
ArtifactMetadata pom = new ProjectMetadata( artifact );
artifactPomRewriter = (ArtifactPomRewriter) container.lookup( ArtifactPomRewriter.ROLE,
- configuration
- .getSourcePomVersion() );
+ configuration.getSourcePomVersion() );
File sourcePom = new File( sourceRepositoryBase, sourceRepo.pathOfMetadata( pom ) );
- File targetPom = new File( targetRepositoryBase, targetRepo.pathOfMetadata( pom ).replace('+', '-') );
+ File targetPom = new File( targetRepositoryBase,
+ targetRepo.pathOfMetadata( pom ).replace( '+', '-' ) );
transaction.addFile( targetPom );
- File bridgedTargetPom = new File( targetRepositoryBase, bridgingLayout.pathOfMetadata( pom ).replace('+', '-') );
+ File bridgedTargetPom = new File( targetRepositoryBase, bridgingLayout.pathOfMetadata( pom ).replace(
+ '+', '-' ) );
transaction.addFile( bridgedTargetPom );
@@ -378,44 +368,47 @@
configuration.reportOnly() );
boolean wroteBridge = bridgePomLocations( targetPom, bridgedTargetPom, artifactReporter );
-
- digestVerifier.verifyDigest( sourcePom, targetPom, transaction,
- artifactReporter, configuration.reportOnly() );
-
- if(wroteBridge)
+
+ digestVerifier.verifyDigest( sourcePom, targetPom, transaction, artifactReporter,
+ configuration.reportOnly() );
+
+ if ( wroteBridge )
{
digestVerifier.verifyDigest( sourcePom, bridgedTargetPom, transaction,
- artifactReporter, configuration.reportOnly() );
+ artifactReporter, configuration.reportOnly() );
}
-
+
}
catch ( Exception e )
{
- repoReporter.error( "Error rewriting POM for artifact[" + artifact.getId()
- + "] into the target repository.\n Error message: " + e.getMessage() );
+ repoReporter.error( "Error rewriting POM for artifact[" + artifact.getId() +
+ "] into the target repository.\n Error message: " + e.getMessage() );
+
+ throw e;
}
}
else if ( !targetMissingOrOlder )
{
- artifactReporter.warn( "Target file for artifact is present and not stale. (Artifact: \'"
- + artifact.getId() + "\' in path: \'" + artifactSource + "\' with target path: "
- + artifactTarget + ")." );
+ artifactReporter.warn( "Target file for artifact is present and not stale. (Artifact: \'" +
+ artifact.getId() + "\' in path: \'" + artifactSource +
+ "\' with target path: " + artifactTarget + ")." );
}
else
{
- artifactReporter.error( "Cannot find source file for artifact: \'" + artifact.getId()
- + "\' under path: \'" + artifactSource + "\'" );
+ artifactReporter.error( "Cannot find source file for artifact: \'" + artifact.getId() +
+ "\' under path: \'" + artifactSource + "\'" );
}
if ( artifactReporter.hasError() )
{
- repoReporter.warn( "Error(s) occurred while rewriting artifact: \'" + artifact.getId()
- + "\' or its POM." );
+ repoReporter.warn( "Error(s) occurred while rewriting artifact: \'" + artifact.getId() +
+ "\' or its POM." );
}
}
catch ( Exception e )
{
+ repoReporter.warn( "Rolling back conversion for: " + artifact );
if ( !configuration.force() )
{
try
@@ -428,8 +421,8 @@
}
}
- artifactReporter.error( "Error while rewriting file or POM for artifact: \'" + artifact.getId()
- + "\'. See report at: \'" + artifactReportPath + "\'.", e );
+ artifactReporter.error( "Error while rewriting file or POM for artifact: \'" + artifact.getId() +
+ "\'. See report at: \'" + artifactReportPath + "\'.", e );
}
finally
{
@@ -440,8 +433,8 @@
}
}
- logger.info( "Actual number of artifacts rewritten: " + actualRewriteCount + " ("
- + ( actualRewriteCount * 2 ) + " including POMs)." );
+ logger.info( "Actual number of artifacts rewritten: " + actualRewriteCount + " (" +
+ ( actualRewriteCount * 2 ) + " including POMs)." );
}
finally
{
@@ -457,9 +450,9 @@
{
if ( targetPom.equals( bridgedTargetPom ) )
{
- reporter.warn( "Cannot create legacy-compatible copy of POM at: " + targetPom
- + "; legacy-compatible path is the same as the converted POM itself." );
-
+ reporter.warn( "Cannot create legacy-compatible copy of POM at: " + targetPom +
+ "; legacy-compatible path is the same as the converted POM itself." );
+
return false;
}
@@ -478,16 +471,20 @@
IOUtil.close( in );
IOUtil.close( out );
}
-
+
return true;
}
private String buildArtifactReportPath( Artifact artifact )
{
String classifier = artifact.getClassifier();
+ String groupId = artifact.getGroupId().replace( '.', '/' );
+ String artifactId = artifact.getArtifactId();
+ String type = artifact.getType();
+ String version = artifact.getVersion();
- return artifact.getGroupId().replace( '.', '/' ) + "/" + artifact.getArtifactId() + "/" + artifact.getType()
- + "/" + ( ( classifier != null ) ? ( classifier + "-" ) : ( "" ) ) + artifact.getVersion() + ".report.txt";
+ return groupId + "/" + artifactId + "/" + type + "/" +
+ ( ( classifier != null ) ? ( classifier + "-" ) : ( "" ) ) + version + ".report.txt";
}
private void copyArtifact( Artifact artifact, File artifactTarget, FileReporter reporter )
@@ -541,8 +538,8 @@
}
else if ( !targetRepositoryBase.isDirectory() )
{
- logger.error( "Cannot write to target repository \'" + targetRepositoryBase
- + "\' because it is not a directory." );
+ logger.error( "Cannot write to target repository \'" + targetRepositoryBase +
+ "\' because it is not a directory." );
targetRepositoryBase = null;
}
@@ -580,11 +577,11 @@
SimpleDateFormat dateFormat = new SimpleDateFormat( REPORTS_DIR_DATE_FORMAT );
- String subdir = dateFormat.format( new Date() );
+ this.dateSubdir = dateFormat.format( new Date() );
File allReportsBase = new File( reportsPath );
- File reportsBase = new File( allReportsBase, subdir );
+ File reportsBase = new File( allReportsBase, dateSubdir );
if ( reportsBase.exists() && !reportsBase.isDirectory() )
{
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleanerConfiguration.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleanerConfiguration.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleanerConfiguration.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleanerConfiguration.java Mon Apr 25 18:32:07 2005
@@ -47,8 +47,10 @@
private String errorReportToAddress;
+ private String errorReportLink;
+
private boolean mailErrorReport;
-
+
private boolean force;
private String blacklistedPatterns;
@@ -197,9 +199,20 @@
{
this.blacklistedPatterns = blacklistedPatterns;
}
-
+
public String getBlacklistedPatterns()
{
return blacklistedPatterns;
}
+
+ public String getErrorReportLink()
+ {
+ return errorReportLink;
+ }
+
+ public void setErrorReportLink( String errorReportLink )
+ {
+ this.errorReportLink = errorReportLink;
+ }
+
}
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/DtdHandler.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/DtdHandler.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/DtdHandler.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/DtdHandler.java Mon Apr 25 18:32:07 2005
@@ -22,8 +22,7 @@
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
-public class DtdHandler
- extends AbstractArtifactHandler
+public class DtdHandler extends AbstractArtifactHandler
{
public String directory()
{
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/EarHandler.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/EarHandler.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/EarHandler.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/EarHandler.java Mon Apr 25 18:32:07 2005
@@ -22,8 +22,7 @@
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
-public class EarHandler
- extends JarHandler
+public class EarHandler extends JarHandler
{
public String directory()
{
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/JarDistroHandler.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/JarDistroHandler.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/JarDistroHandler.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/JarDistroHandler.java Mon Apr 25 18:32:07 2005
@@ -2,12 +2,12 @@
/*
* Copyright 2001-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
@@ -19,8 +19,7 @@
/**
* @author jdcasey
*/
-public class JarDistroHandler
- extends AbstractArtifactHandler
+public class JarDistroHandler extends AbstractArtifactHandler
{
public String directory()
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/LegacyPluginHandler.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/LegacyPluginHandler.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/LegacyPluginHandler.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/LegacyPluginHandler.java Mon Apr 25 18:32:07 2005
@@ -22,13 +22,12 @@
/**
* @author jdcasey
*/
-public class LegacyPluginHandler
- extends AbstractArtifactHandler
+public class LegacyPluginHandler extends AbstractArtifactHandler
{
public String directory()
{
return "plugins";
}
-
+
}
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/RarHandler.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/RarHandler.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/RarHandler.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/RarHandler.java Mon Apr 25 18:32:07 2005
@@ -22,8 +22,7 @@
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
-public class RarHandler
- extends JarHandler
+public class RarHandler extends JarHandler
{
public String directory()
{
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/SarHandler.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/SarHandler.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/SarHandler.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/SarHandler.java Mon Apr 25 18:32:07 2005
@@ -22,14 +22,13 @@
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
-public class SarHandler
- extends JarHandler
+public class SarHandler extends JarHandler
{
public String directory()
{
return "sars";
}
-
+
public String extension()
{
return "sar";
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/TgzDistroHandler.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/TgzDistroHandler.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/TgzDistroHandler.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/TgzDistroHandler.java Mon Apr 25 18:32:07 2005
@@ -2,12 +2,12 @@
/*
* Copyright 2001-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
@@ -19,8 +19,7 @@
/**
* @author jdcasey
*/
-public class TgzDistroHandler
- extends AbstractArtifactHandler
+public class TgzDistroHandler extends AbstractArtifactHandler
{
public String directory()
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/TldHandler.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/TldHandler.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/TldHandler.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/TldHandler.java Mon Apr 25 18:32:07 2005
@@ -22,8 +22,7 @@
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
-public class TldHandler
- extends AbstractArtifactHandler
+public class TldHandler extends AbstractArtifactHandler
{
public String directory()
{
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/ZipDistroHandler.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/ZipDistroHandler.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/ZipDistroHandler.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/handler/ZipDistroHandler.java Mon Apr 25 18:32:07 2005
@@ -2,12 +2,12 @@
/*
* Copyright 2001-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
@@ -19,8 +19,7 @@
/**
* @author jdcasey
*/
-public class ZipDistroHandler
- extends AbstractArtifactHandler
+public class ZipDistroHandler extends AbstractArtifactHandler
{
public String directory()
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/layout/AlphaBridgingRepositoryLayout.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/layout/AlphaBridgingRepositoryLayout.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/layout/AlphaBridgingRepositoryLayout.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/layout/AlphaBridgingRepositoryLayout.java Mon Apr 25 18:32:07 2005
@@ -21,8 +21,7 @@
* limitations under the License.
*/
-public class AlphaBridgingRepositoryLayout
- extends DefaultRepositoryLayout
+public class AlphaBridgingRepositoryLayout extends DefaultRepositoryLayout
{
public String pathOfMetadata( ArtifactMetadata metadata )
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/metadata/ProjectMetadata.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/metadata/ProjectMetadata.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/metadata/ProjectMetadata.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/artifact/metadata/ProjectMetadata.java Mon Apr 25 18:32:07 2005
@@ -28,21 +28,20 @@
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/
-public class ProjectMetadata
- implements ArtifactMetadata
+public class ProjectMetadata implements ArtifactMetadata
{
private final Artifact artifact;
- public ProjectMetadata( Artifact artifact)
+ public ProjectMetadata( Artifact artifact )
{
this.artifact = artifact;
}
-
+
public Artifact getArtifact()
{
return artifact;
}
-
+
public String getFilename()
{
return getArtifact().getArtifactId() + "-" + getArtifact().getVersion() + ".pom";
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestException.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestException.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestException.java Mon Apr 25 18:32:07 2005
@@ -20,8 +20,7 @@
/**
* @author jdcasey
*/
-public class DigestException
- extends Exception
+public class DigestException extends Exception
{
public DigestException( String message )
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerificationException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerificationException.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerificationException.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerificationException.java Mon Apr 25 18:32:07 2005
@@ -20,8 +20,7 @@
/**
* @author jdcasey
*/
-public class DigestVerificationException
- extends Exception
+public class DigestVerificationException extends Exception
{
public DigestVerificationException()
@@ -42,5 +41,5 @@
{
super( cause );
}
-
+
}
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerifier.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerifier.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerifier.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/DigestVerifier.java Mon Apr 25 18:32:07 2005
@@ -34,22 +34,23 @@
public static final String ROLE = DigestVerifier.class.getName();
private Digestor artifactDigestor;
-
- public void setArtifactDigestor(Digestor artifactDigestor)
+
+ public void setArtifactDigestor( Digestor artifactDigestor )
{
this.artifactDigestor = artifactDigestor;
}
- public void verifyDigest( File source, File target, RewriteTransaction transaction, Reporter reporter, boolean reportOnly )
+ public void verifyDigest( File source, File target, RewriteTransaction transaction, Reporter reporter,
+ boolean reportOnly )
throws DigestException, ReportWriteException, IOException
{
verifyDigestFile( source, target, transaction, reporter, reportOnly, ".md5", Digestor.MD5 );
-
+
verifyDigestFile( source, target, transaction, reporter, reportOnly, ".sha1", Digestor.SHA );
}
- private void verifyDigestFile( File artifactSource, File artifactTarget, RewriteTransaction transaction, Reporter reporter, boolean reportOnly,
- String digestExt, String digestAlgorithm )
+ private void verifyDigestFile( File artifactSource, File artifactTarget, RewriteTransaction transaction,
+ Reporter reporter, boolean reportOnly, String digestExt, String digestAlgorithm )
throws DigestException, ReportWriteException, IOException
{
// create the digest source file from which to copy/verify.
@@ -57,7 +58,7 @@
// create the digest target file from which to copy/create.
File digestTargetFile = new File( artifactTarget + digestExt );
-
+
transaction.addFile( digestTargetFile );
boolean verified = false;
@@ -77,8 +78,8 @@
}
catch ( IOException e )
{
- reporter.error( "Cannot copy digest file for path [" + artifactSource
- + "] from source to target for digest algorithm: \'" + digestAlgorithm + "\'.", e );
+ reporter.error( "Cannot copy digest file for path [" + artifactSource +
+ "] from source to target for digest algorithm: \'" + digestAlgorithm + "\'.", e );
throw e;
}
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/Digestor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/Digestor.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/Digestor.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/digest/Digestor.java Mon Apr 25 18:32:07 2005
@@ -68,8 +68,8 @@
}
catch ( IOException e )
{
- throw new DigestException( "Cannot verify digest for artifact file: \'" + artifactFile
- + "\' against digest file: \'" + digestFile + "\' using algorithm: \'" + algorithm + "\'", e );
+ throw new DigestException( "Cannot verify digest for artifact file: \'" + artifactFile +
+ "\' against digest file: \'" + digestFile + "\' using algorithm: \'" + algorithm + "\'", e );
}
finally
{
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/AbstractArtifactDiscoverer.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/AbstractArtifactDiscoverer.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/AbstractArtifactDiscoverer.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/AbstractArtifactDiscoverer.java Mon Apr 25 18:32:07 2005
@@ -23,12 +23,11 @@
* limitations under the License.
*/
-public abstract class AbstractArtifactDiscoverer
- extends AbstractLogEnabled
- implements ArtifactDiscoverer
+public abstract class AbstractArtifactDiscoverer extends AbstractLogEnabled implements ArtifactDiscoverer
{
- protected String[] scanForArtifactPaths( File repositoryBase, String blacklistedPatterns, PathLister excludesLister )
+ protected String[] scanForArtifactPaths( File repositoryBase, String blacklistedPatterns,
+ PathLister excludesLister )
throws ReportWriteException
{
String[] blacklisted = null;
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/ArtifactDiscoverer.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/ArtifactDiscoverer.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/ArtifactDiscoverer.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/ArtifactDiscoverer.java Mon Apr 25 18:32:07 2005
@@ -8,12 +8,12 @@
/*
* Copyright 2001-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
@@ -27,30 +27,15 @@
{
public static final String ROLE = ArtifactDiscoverer.class.getName();
- public static final String[] STANDARD_DISCOVERY_EXCLUDES = {
- "bin/**",
- "reports/**",
- ".maven/**",
- "**/poms/*.pom",
- "**/*.md5",
- "**/*.MD5",
- "**/*.sha1",
- "**/*.SHA1",
- "**/*snapshot-version",
- "*/website/**",
- "*/licenses/**",
- "*/licences/**",
- "**/.htaccess",
- "**/*.html",
- "**/*.asc",
- "**/*.txt",
- "**/*.xml",
- "**/README*",
- "**/CHANGELOG*",
- "**/KEYS*" };
+ public static final String[] STANDARD_DISCOVERY_EXCLUDES = {"bin/**", "reports/**", ".maven/**", "**/poms/*.pom",
+ "**/*.md5", "**/*.MD5", "**/*.sha1", "**/*.SHA1",
+ "**/*snapshot-version", "*/website/**",
+ "*/licenses/**", "*/licences/**", "**/.htaccess",
+ "**/*.html", "**/*.asc", "**/*.txt", "**/*.xml",
+ "**/README*", "**/CHANGELOG*", "**/KEYS*"};
List discoverArtifacts( File repositoryBase, Reporter reporter, String blacklistedPatterns,
- PathLister excludeLister, PathLister kickoutLister )
+ PathLister excludeLister, PathLister kickoutLister )
throws Exception;
}
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/DefaultArtifactDiscoverer.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/DefaultArtifactDiscoverer.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/DefaultArtifactDiscoverer.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/DefaultArtifactDiscoverer.java Mon Apr 25 18:32:07 2005
@@ -1,26 +1,25 @@
package org.apache.maven.tools.repoclean.discover;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.construction.ArtifactConstructionSupport;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.tools.repoclean.report.PathLister;
import org.apache.maven.tools.repoclean.report.Reporter;
-import org.codehaus.plexus.util.IOUtil;
import java.io.File;
-import java.io.FileReader;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
+import java.util.StringTokenizer;
/*
* Copyright 2001-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
@@ -30,19 +29,19 @@
/**
* @author jdcasey
*/
-public class DefaultArtifactDiscoverer
- extends AbstractArtifactDiscoverer
+public class DefaultArtifactDiscoverer extends AbstractArtifactDiscoverer
{
- private ArtifactConstructionSupport artifactConstructionSupport = new ArtifactConstructionSupport();
+ private ArtifactFactory artifactFactory;
- public List discoverArtifacts( File repositoryBase, Reporter reporter, String blacklistedPatterns, PathLister excludeLister, PathLister kickoutLister )
+ public List discoverArtifacts( File repositoryBase, Reporter reporter, String blacklistedPatterns,
+ PathLister excludeLister, PathLister kickoutLister )
throws Exception
{
List artifacts = new ArrayList();
String[] artifactPaths = scanForArtifactPaths( repositoryBase, blacklistedPatterns, excludeLister );
-
+
for ( int i = 0; i < artifactPaths.length; i++ )
{
String path = artifactPaths[i];
@@ -63,41 +62,50 @@
{
Artifact result = null;
- int lastDot = path.lastIndexOf( '.' );
-
- if ( lastDot < 0 )
+ List pathParts = new ArrayList();
+ StringTokenizer st = new StringTokenizer( path, "/" );
+ while ( st.hasMoreTokens() )
{
- kickoutLister.addPath(path);
+ pathParts.add( st.nextToken() );
}
- else
+
+ Collections.reverse( pathParts );
+
+ int currentPart = 0;
+
+ //discard the actual artifact filename.
+ pathParts.remove( 0 );
+
+ // the next one is the version.
+ String version = (String) pathParts.get( 0 );
+ pathParts.remove( 0 );
+
+ // the next one is the artifactId.
+ String artifactId = (String) pathParts.get( 0 );
+ pathParts.remove( 0 );
+
+ // the remaining are the groupId.
+ StringBuffer groupBuffer = new StringBuffer();
+
+ boolean firstPart = true;
+ for ( Iterator it = pathParts.iterator(); it.hasNext(); )
{
- String pomPath = path.substring( 0, lastDot ) + ".pom";
+ String part = (String) it.next();
- File pomFile = new File( repositoryBase, pomPath );
- if ( pomFile.exists() )
+ groupBuffer.append( part );
+
+ if ( firstPart )
{
- FileReader pomReader = null;
- try
- {
- pomReader = new FileReader( pomFile );
- MavenXpp3Reader modelReader = new MavenXpp3Reader();
-
- Model model = modelReader.read( pomReader );
-
- result = artifactConstructionSupport.createArtifact( model.getGroupId(), model.getArtifactId(),
- model.getVersion(), Artifact.SCOPE_RUNTIME,
- model.getPackaging() );
- }
- finally
- {
- IOUtil.close( pomReader );
- }
+ firstPart = false;
}
- else
+ else if ( it.hasNext() )
{
- kickoutLister.addPath(path);
+ groupBuffer.append( "." );
}
}
+
+ result = artifactFactory.createArtifact( groupBuffer.toString(), artifactId, version, Artifact.SCOPE_RUNTIME,
+ "jar" );
return result;
}
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/LegacyArtifactDiscoverer.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/LegacyArtifactDiscoverer.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/LegacyArtifactDiscoverer.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/LegacyArtifactDiscoverer.java Mon Apr 25 18:32:07 2005
@@ -2,12 +2,12 @@
/*
* Copyright 2001-2005 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
@@ -15,7 +15,7 @@
*/
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.construction.ArtifactConstructionSupport;
+import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.tools.repoclean.report.PathLister;
import org.apache.maven.tools.repoclean.report.Reporter;
@@ -30,14 +30,13 @@
/**
* @author jdcasey
*/
-public class LegacyArtifactDiscoverer
- extends AbstractArtifactDiscoverer
+public class LegacyArtifactDiscoverer extends AbstractArtifactDiscoverer
{
- private ArtifactConstructionSupport artifactConstructionSupport = new ArtifactConstructionSupport();
+ private ArtifactFactory artifactFactory;
public List discoverArtifacts( File repositoryBase, Reporter reporter, String blacklistedPatterns,
- PathLister excludeLister, PathLister kickoutLister )
+ PathLister excludeLister, PathLister kickoutLister )
throws Exception
{
List artifacts = new ArrayList();
@@ -69,7 +68,7 @@
if ( numberOfTokens != 3 )
{
- kickoutLister.addPath(path);
+ kickoutLister.addPath( path );
return null;
}
@@ -127,20 +126,20 @@
}
else
{
- kickoutLister.addPath(path);
+ kickoutLister.addPath( path );
return null;
}
}
}
- String validVersionParts = "([Dd][Ee][Vv][_.0-9]*)|" + "([Ss][Nn][Aa][Pp][Ss][Hh][Oo][Tt])|"
- + "([0-9][_.0-9a-zA-Z]*)|" + "([Gg]?[_.0-9ab]*([Pp][Rr][Ee]|[Rr][Cc]|[Gg]|[Mm])[_.0-9]*)|"
- + "([Aa][Ll][Pp][Hh][Aa][_.0-9]*)|" + "([Bb][Ee][Tt][Aa][_.0-9]*)|" + "([Rr][Cc][_.0-9]*)|"
- + "([Tt][Ee][Ss][Tt][_.0-9]*)|" + "([Dd][Ee][Bb][Uu][Gg][_.0-9]*)|"
- + "([Uu][Nn][Oo][Ff][Ff][Ii][Cc][Ii][Aa][Ll][_.0-9]*)|" + "([Cc][Uu][Rr][Rr][Ee][Nn][Tt])|"
- + "([Ll][Aa][Tt][Ee][Ss][Tt])|" + "([Ff][Cc][Ss])|" + "([Rr][Ee][Ll][Ee][Aa][Ss][Ee][_.0-9]*)|"
- + "([Nn][Ii][Gg][Hh][Tt][Ll][Yy])";
+ String validVersionParts = "([Dd][Ee][Vv][_.0-9]*)|" + "([Ss][Nn][Aa][Pp][Ss][Hh][Oo][Tt])|" +
+ "([0-9][_.0-9a-zA-Z]*)|" + "([Gg]?[_.0-9ab]*([Pp][Rr][Ee]|[Rr][Cc]|[Gg]|[Mm])[_.0-9]*)|" +
+ "([Aa][Ll][Pp][Hh][Aa][_.0-9]*)|" + "([Bb][Ee][Tt][Aa][_.0-9]*)|" + "([Rr][Cc][_.0-9]*)|" +
+ "([Tt][Ee][Ss][Tt][_.0-9]*)|" + "([Dd][Ee][Bb][Uu][Gg][_.0-9]*)|" +
+ "([Uu][Nn][Oo][Ff][Ff][Ii][Cc][Ii][Aa][Ll][_.0-9]*)|" + "([Cc][Uu][Rr][Rr][Ee][Nn][Tt])|" +
+ "([Ll][Aa][Tt][Ee][Ss][Tt])|" + "([Ff][Cc][Ss])|" + "([Rr][Ee][Ll][Ee][Aa][Ss][Ee][_.0-9]*)|" +
+ "([Nn][Ii][Gg][Hh][Tt][Ll][Yy])";
// let's discover the version, and whatever's leftover will be either
// a classifier, or part of the artifactId, depending on position.
@@ -197,17 +196,15 @@
tokensIterated++;
}
- getLogger().debug(
- "After parsing loop, state of buffers:\no Version Buffer: \'" + versionBuffer
- + "\'\no Classifier Buffer: \'" + classifierBuffer
- + "\'\no Number of Tokens Iterated: " + tokensIterated );
+ getLogger().debug( "After parsing loop, state of buffers:\no Version Buffer: \'" + versionBuffer +
+ "\'\no Classifier Buffer: \'" + classifierBuffer +
+ "\'\no Number of Tokens Iterated: " + tokensIterated );
// Now, restore the proper ordering so we can build the artifactId.
Collections.reverse( avceTokenList );
- getLogger().debug(
- "Before repairing bad version and/or cleaning up used tokens, avce token list is:\n"
- + avceTokenList );
+ getLogger().debug( "Before repairing bad version and/or cleaning up used tokens, avce token list is:\n" +
+ avceTokenList );
// if we didn't find a version, then punt. Use the last token
// as the version, and set the classifier empty.
@@ -223,9 +220,8 @@
else
{
getLogger().warn( "Cannot parse version from artifact path: \'" + path + "\'." );
- getLogger().info(
- "artifact-version-classifier-extension remaining tokens is: \'" + avceTokenList
- + "\'" );
+ getLogger().info( "artifact-version-classifier-extension remaining tokens is: \'" + avceTokenList +
+ "\'" );
}
classifierBuffer.setLength( 0 );
@@ -236,7 +232,8 @@
// if everything is kosher, then pop off all the classifier and
// version tokens, leaving the naked artifact id in the list.
- avceTokenList = new LinkedList( avceTokenList.subList( 0, avceTokenList.size() - ( tokensIterated ) ) );
+ avceTokenList =
+ new LinkedList( avceTokenList.subList( 0, avceTokenList.size() - ( tokensIterated ) ) );
}
getLogger().debug( "Now, remainder of avce token list is:\n" + avceTokenList );
@@ -275,11 +272,10 @@
version = null;
}
- getLogger().debug(
- "Extracted artifact information from path:\n" + "groupId: \'" + groupId + "\'\n"
- + "artifactId: \'" + artifactId + "\'\n" + "type: \'" + type + "\'\n"
- + "version: \'" + version + "\'\n" + "classifier: \'" + classifierBuffer.toString()
- + "\'" );
+ getLogger().debug( "Extracted artifact information from path:\n" + "groupId: \'" + groupId + "\'\n" +
+ "artifactId: \'" + artifactId + "\'\n" + "type: \'" + type + "\'\n" +
+ "version: \'" + version + "\'\n" + "classifier: \'" + classifierBuffer.toString() +
+ "\'" );
Artifact result = null;
@@ -287,19 +283,17 @@
{
getLogger().debug( "Creating artifact with classifier." );
- result = artifactConstructionSupport.createArtifactWithClassifier( groupId, artifactId, version,
- Artifact.SCOPE_RUNTIME, type,
- classifierBuffer.toString() );
+ result = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version,
+ Artifact.SCOPE_RUNTIME, type,
+ classifierBuffer.toString() );
}
else
{
- result = artifactConstructionSupport.createArtifact( groupId, artifactId, version,
- Artifact.SCOPE_RUNTIME, type );
+ result = artifactFactory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME, type );
}
- getLogger().debug(
- "Resulting artifact is: " + result.getId() + " and has classifier of: "
- + result.getClassifier() + "\n\n" );
+ getLogger().debug( "Resulting artifact is: " + result.getId() + " and has classifier of: " +
+ result.getClassifier() + "\n\n" );
return result;
}
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/index/ArtifactIndexer.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/index/ArtifactIndexer.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/index/ArtifactIndexer.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/index/ArtifactIndexer.java Mon Apr 25 18:32:07 2005
@@ -32,8 +32,7 @@
/**
* @author jdcasey
*/
-public class ArtifactIndexer
- extends AbstractLogEnabled
+public class ArtifactIndexer extends AbstractLogEnabled
{
public static final String ROLE = ArtifactIndexer.class.getName();
@@ -65,8 +64,7 @@
}
}
- private static final class ArtifactIdComparator
- implements Comparator
+ private static final class ArtifactIdComparator implements Comparator
{
public int compare( Object first, Object second )
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/FileReporter.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/FileReporter.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/FileReporter.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/FileReporter.java Mon Apr 25 18:32:07 2005
@@ -48,7 +48,7 @@
private boolean hasWarning = false;
private Writer writer;
-
+
public FileReporter( File reportsBase, String reportPath )
{
this.reportsFile = new File( reportsBase, reportPath );
@@ -61,12 +61,12 @@
if ( !parentDir.isDirectory() )
{
- throw new IllegalArgumentException( "path: \'" + parentDir.getAbsolutePath()
- + "\' refers to a file, not a directory.\n" + "Cannot write report file: \'"
- + reportsFile.getAbsolutePath() + "\'." );
+ throw new IllegalArgumentException( "path: \'" + parentDir.getAbsolutePath() +
+ "\' refers to a file, not a directory.\n" + "Cannot write report file: \'" +
+ reportsFile.getAbsolutePath() + "\'." );
}
}
-
+
public File getReportFile()
{
return reportsFile;
@@ -122,19 +122,22 @@
return hasError;
}
- public void warn( String message ) throws ReportWriteException
+ public void warn( String message )
+ throws ReportWriteException
{
hasWarning = true;
write( new AppendingList( 2 ).append( WARN_LEVEL ).append( message ) );
}
- public void error( String message, Throwable error ) throws ReportWriteException
+ public void error( String message, Throwable error )
+ throws ReportWriteException
{
hasError = true;
write( new AppendingList( 3 ).append( ERROR_LEVEL ).append( message ).append( error ) );
}
- public void error( String message ) throws ReportWriteException
+ public void error( String message )
+ throws ReportWriteException
{
hasError = true;
write( new AppendingList( 2 ).append( ERROR_LEVEL ).append( message ) );
@@ -167,8 +170,7 @@
return sWriter.toString();
}
- private static class AppendingList
- extends ArrayList
+ private static class AppendingList extends ArrayList
{
public AppendingList()
{
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/PathLister.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/PathLister.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/PathLister.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/PathLister.java Mon Apr 25 18:32:07 2005
@@ -25,23 +25,24 @@
public class PathLister
{
-
+
private final File listFile;
-
+
private Writer writer;
public PathLister( File listFile )
{
this.listFile = listFile;
}
-
- private synchronized void checkOpen() throws ReportWriteException
+
+ private synchronized void checkOpen()
+ throws ReportWriteException
{
- if(writer == null)
+ if ( writer == null )
{
try
{
- writer = new FileWriter(listFile);
+ writer = new FileWriter( listFile );
}
catch ( IOException e )
{
@@ -49,16 +50,17 @@
}
}
}
-
+
public void close()
{
IOUtil.close( writer );
}
-
- public void addPath( String path ) throws ReportWriteException
+
+ public void addPath( String path )
+ throws ReportWriteException
{
checkOpen();
-
+
try
{
writer.write( path + "\n" );
@@ -69,10 +71,11 @@
}
}
- public void addPath( File path ) throws ReportWriteException
+ public void addPath( File path )
+ throws ReportWriteException
{
checkOpen();
-
+
try
{
writer.write( path + "\n" );
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/ReportWriteException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/ReportWriteException.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/ReportWriteException.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/report/ReportWriteException.java Mon Apr 25 18:32:07 2005
@@ -16,8 +16,7 @@
* limitations under the License.
*/
-public class ReportWriteException
- extends Exception
+public class ReportWriteException extends Exception
{
public ReportWriteException( String message, Throwable cause )
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/ArtifactPomRewriter.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/ArtifactPomRewriter.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/ArtifactPomRewriter.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/ArtifactPomRewriter.java Mon Apr 25 18:32:07 2005
@@ -27,9 +27,10 @@
*/
public interface ArtifactPomRewriter
{
-
+
public static final String ROLE = ArtifactPomRewriter.class.getName();
-
- void rewrite( Artifact artifact, File from, File to, FileReporter reporter, boolean reportOnly ) throws Exception;
+
+ void rewrite( Artifact artifact, File from, File to, FileReporter reporter, boolean reportOnly )
+ throws Exception;
}
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/V3PomRewriter.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/V3PomRewriter.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/V3PomRewriter.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/V3PomRewriter.java Mon Apr 25 18:32:07 2005
@@ -33,8 +33,7 @@
/**
* @author jdcasey
*/
-public class V3PomRewriter
- implements ArtifactPomRewriter
+public class V3PomRewriter implements ArtifactPomRewriter
{
private PomV3ToV4Translator translator;
@@ -60,11 +59,11 @@
catch ( Exception e )
{
reporter.error( "Invalid v3 POM at: \'" + from + "\'. Cannot read.", e );
-
+
throw e;
}
- if(v3Model != null)
+ if ( v3Model != null )
{
v4Model = translator.translate( v3Model, reporter );
}
@@ -76,13 +75,13 @@
}
else
{
- reporter.warn( "POM for artifact[" + artifact.getId()
- + "] does not exist in source repository. We will create a skeletal one here." );
-
+ reporter.warn( "POM for artifact[" + artifact.getId() +
+ "] does not exist in source repository. We will create a skeletal one here." );
+
v4Model = new Model();
}
- if(v4Model != null)
+ if ( v4Model != null )
{
validateV4Basics( v4Model, artifact, reporter );
Modified: maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/V4PomRewriter.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/V4PomRewriter.java?rev=164705&r1=164704&r2=164705&view=diff
==============================================================================
--- maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/V4PomRewriter.java (original)
+++ maven/components/trunk/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/rewrite/V4PomRewriter.java Mon Apr 25 18:32:07 2005
@@ -19,8 +19,8 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Model;
-import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.tools.repoclean.report.FileReporter;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
@@ -32,8 +32,7 @@
/**
* @author jdcasey
*/
-public class V4PomRewriter
- implements ArtifactPomRewriter
+public class V4PomRewriter implements ArtifactPomRewriter
{
public void rewrite( Artifact artifact, File from, File to, FileReporter reporter, boolean reportOnly )
throws Exception
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org