diff options
author | Joakim Erdfelt <joakime@apache.org> | 2007-04-19 12:25:11 +0000 |
---|---|---|
committer | Joakim Erdfelt <joakime@apache.org> | 2007-04-19 12:25:11 +0000 |
commit | 8b0319bf628d8ba366d2c12791db67c340dc0076 (patch) | |
tree | 06240146f2f875508c60b11908f5d7c4fdc597c4 /archiva-base/archiva-consumers/archiva-database-consumers/src | |
parent | 346583093493614302e3761b3de1c2d8ff67a806 (diff) | |
download | archiva-8b0319bf628d8ba366d2c12791db67c340dc0076.tar.gz archiva-8b0319bf628d8ba366d2c12791db67c340dc0076.zip |
Refactoring of reporting. One step closer to an end-to-end compile.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@530395 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-base/archiva-consumers/archiva-database-consumers/src')
-rw-r--r-- | archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java index 7eae0bf6e..2d011c2a4 100644 --- a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java +++ b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java @@ -20,6 +20,7 @@ package org.apache.maven.archiva.consumers.database; */ import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.ConfigurationNames; import org.apache.maven.archiva.configuration.FileType; import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; import org.apache.maven.archiva.consumers.ConsumerException; @@ -29,6 +30,7 @@ import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.model.ArchivaArtifact; import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; +import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory; import org.apache.maven.archiva.repository.layout.LayoutException; import org.codehaus.plexus.digest.Digester; import org.codehaus.plexus.digest.DigesterException; @@ -41,7 +43,6 @@ import java.io.File; import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.Map; /** * ArtifactUpdateDatabaseConsumer - Take an artifact off of disk and put it into the repository. @@ -84,9 +85,9 @@ public class ArtifactUpdateDatabaseConsumer private ArchivaConfiguration configuration; /** - * @plexus.requirement role="org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout" + * @plexus.requirement */ - private Map bidirectionalLayoutMap; + private BidirectionalRepositoryLayoutFactory layoutFactory; /** * @plexus.requirement role-hint="sha1" @@ -104,8 +105,6 @@ public class ArtifactUpdateDatabaseConsumer private BidirectionalRepositoryLayout layout; - private List propertyNameTriggers = new ArrayList(); - private List includes = new ArrayList(); public String getId() @@ -144,15 +143,14 @@ public class ArtifactUpdateDatabaseConsumer this.repository = repository; this.repositoryDir = new File( repository.getUrl().getPath() ); - String layoutName = repository.getModel().getLayoutName(); - if ( !bidirectionalLayoutMap.containsKey( layoutName ) ) + try { - throw new ConsumerException( "Unable to process repository with layout [" + layoutName - + "] as there is no coresponding " + BidirectionalRepositoryLayout.class.getName() - + " implementation available." ); + this.layout = layoutFactory.getLayout( repository.getModel().getLayoutName() ); + } + catch ( LayoutException e ) + { + throw new ConsumerException( e.getMessage(), e ); } - - this.layout = (BidirectionalRepositoryLayout) bidirectionalLayoutMap.get( layoutName ); } public void processFile( String path ) @@ -209,7 +207,7 @@ public class ArtifactUpdateDatabaseConsumer public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue ) { - if ( propertyNameTriggers.contains( propertyName ) ) + if ( ConfigurationNames.isRepositoryScanning( propertyName ) ) { initIncludes(); } @@ -234,13 +232,6 @@ public class ArtifactUpdateDatabaseConsumer public void initialize() throws InitializationException { - propertyNameTriggers = new ArrayList(); - propertyNameTriggers.add( "repositoryScanning" ); - propertyNameTriggers.add( "fileTypes" ); - propertyNameTriggers.add( "fileType" ); - propertyNameTriggers.add( "patterns" ); - propertyNameTriggers.add( "pattern" ); - configuration.addChangeListener( this ); initIncludes(); |