mirror of
https://github.com/apache/archiva.git
synced 2025-02-08 11:06:03 +00:00
* Adding role names to help plexus:descriptors work.
* Correcting auto-rename consumer to operate on path. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@525984 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
769fe91fc3
commit
f068e90b01
@ -45,7 +45,8 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @plexus.component role-hint="create-missing-checksums"
|
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||||
|
* role-hint="create-missing-checksums"
|
||||||
* instantiation-strategy="per-lookup"
|
* instantiation-strategy="per-lookup"
|
||||||
*/
|
*/
|
||||||
public class ArtifactMissingChecksumsConsumer extends AbstractMonitoredConsumer
|
public class ArtifactMissingChecksumsConsumer extends AbstractMonitoredConsumer
|
||||||
|
@ -40,7 +40,8 @@
|
|||||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
*
|
||||||
* @plexus.component role-hint="auto-remove"
|
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||||
|
* role-hint="auto-remove"
|
||||||
* instantiation-strategy="per-lookup"
|
* instantiation-strategy="per-lookup"
|
||||||
*/
|
*/
|
||||||
public class AutoRemoveConsumer
|
public class AutoRemoveConsumer
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -38,7 +39,8 @@
|
|||||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
*
|
||||||
* @plexus.component role-hint="auto-remove"
|
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||||
|
* role-hint="auto-remove"
|
||||||
* instantiation-strategy="per-lookup"
|
* instantiation-strategy="per-lookup"
|
||||||
*/
|
*/
|
||||||
public class AutoRenameConsumer
|
public class AutoRenameConsumer
|
||||||
@ -55,6 +57,8 @@ public class AutoRenameConsumer
|
|||||||
*/
|
*/
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
private static final String RENAME_FAILURE = "rename_failure";
|
||||||
|
|
||||||
private File repositoryDir;
|
private File repositoryDir;
|
||||||
|
|
||||||
private List includes = new ArrayList();
|
private List includes = new ArrayList();
|
||||||
@ -125,7 +129,18 @@ public void processFile( String path )
|
|||||||
String extension = (String) itExtensions.next();
|
String extension = (String) itExtensions.next();
|
||||||
if ( path.endsWith( extension ) )
|
if ( path.endsWith( extension ) )
|
||||||
{
|
{
|
||||||
// TODO: FileUtils.rename( from, to )
|
String fixedExtension = (String) this.extensionRenameMap.get( extension );
|
||||||
|
String correctedPath = path.substring( 0, path.length() - extension.length() ) + fixedExtension;
|
||||||
|
File to = new File( this.repositoryDir, correctedPath );
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileUtils.rename( file, to );
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
triggerConsumerWarning( RENAME_FAILURE, "Unable to rename " + path + " to " + correctedPath
|
||||||
|
+ ": " + e.getMessage() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,8 @@
|
|||||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
*
|
||||||
* @plexus.component role-hint="validate-checksums"
|
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||||
|
* role-hint="validate-checksums"
|
||||||
* instantiation-strategy="per-lookup"
|
* instantiation-strategy="per-lookup"
|
||||||
*/
|
*/
|
||||||
public class ValidateChecksumConsumer extends AbstractMonitoredConsumer
|
public class ValidateChecksumConsumer extends AbstractMonitoredConsumer
|
||||||
|
@ -49,7 +49,8 @@
|
|||||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
*
|
||||||
* @plexus.component role-hint="update-db-artifact"
|
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||||
|
* role-hint="update-db-artifact"
|
||||||
* instantiation-strategy="per-lookup"
|
* instantiation-strategy="per-lookup"
|
||||||
*/
|
*/
|
||||||
public class ArtifactUpdateDatabaseConsumer
|
public class ArtifactUpdateDatabaseConsumer
|
||||||
|
@ -46,7 +46,8 @@
|
|||||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
*
|
||||||
* @plexus.component role-hint="index-content"
|
* @plexus.component role="org.apache.maven.archiva.consumers.RepositoryContentConsumer"
|
||||||
|
* role-hint="index-content"
|
||||||
* instantiation-strategy="per-lookup"
|
* instantiation-strategy="per-lookup"
|
||||||
*/
|
*/
|
||||||
public class IndexContentConsumer
|
public class IndexContentConsumer
|
||||||
|
@ -36,4 +36,13 @@
|
|||||||
<module>archiva-lucene-consumers</module>
|
<module>archiva-lucene-consumers</module>
|
||||||
<module>archiva-signature-consumers</module>
|
<module>archiva-signature-consumers</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
<artifactId>plexus-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user