mirror of https://github.com/apache/archiva.git
* 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 @@ import java.util.Map;
|
|||
*
|
||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @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"
|
||||
*/
|
||||
public class ArtifactMissingChecksumsConsumer extends AbstractMonitoredConsumer
|
||||
|
|
|
@ -40,7 +40,8 @@ import java.util.List;
|
|||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @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"
|
||||
*/
|
||||
public class AutoRemoveConsumer
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.maven.archiva.model.ArchivaRepository;
|
|||
import org.codehaus.plexus.util.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
@ -38,7 +39,8 @@ import java.util.Map;
|
|||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @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"
|
||||
*/
|
||||
public class AutoRenameConsumer
|
||||
|
@ -55,6 +57,8 @@ public class AutoRenameConsumer
|
|||
*/
|
||||
private String description;
|
||||
|
||||
private static final String RENAME_FAILURE = "rename_failure";
|
||||
|
||||
private File repositoryDir;
|
||||
|
||||
private List includes = new ArrayList();
|
||||
|
@ -125,7 +129,18 @@ public class AutoRenameConsumer
|
|||
String extension = (String) itExtensions.next();
|
||||
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 @@ import java.util.List;
|
|||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @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"
|
||||
*/
|
||||
public class ValidateChecksumConsumer extends AbstractMonitoredConsumer
|
||||
|
|
|
@ -49,7 +49,8 @@ import java.util.Map;
|
|||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @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"
|
||||
*/
|
||||
public class ArtifactUpdateDatabaseConsumer
|
||||
|
|
|
@ -46,7 +46,8 @@ import java.util.List;
|
|||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||
* @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"
|
||||
*/
|
||||
public class IndexContentConsumer
|
||||
|
|
|
@ -36,4 +36,13 @@
|
|||
<module>archiva-lucene-consumers</module>
|
||||
<module>archiva-signature-consumers</module>
|
||||
</modules>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
Loading…
Reference in New Issue