Brett Porter wrote:
Hi Deng,
On 15/10/2007, at 7:16 PM, [EMAIL PROTECTED] wrote:
[MRM-37 and MRM-527]
- added code for cleaning up the database of artifacts that are no
longer existing in the repository
(DatabaseCleanupRemoveArtifactConsumer and
DatabaseCleanupRemoveProjectConsumer)
- created tests for database cleanup of removed artifacts
- updated some of the test cases (in archiva-database and
archiva-scheduled modules) to reflect the changes in thedb cleanup
consumers
Cool - looks good. A couple of quick questions :)
+ /**
+ * @plexus.requirement
+ */
+ private BidirectionalRepositoryLayoutFactory layoutFactory;
+
+ /**
+ * @plexus.requirement
+ */
+ private RepositoryContentFactory repositoryFactory;
+
I'm probably wrong, but I understood the content factory should be
used instead of the layoutFactory - does it provide a way to do this
instead, or did I misunderstand?
I think the content factory only provides the repository configuration
while the layout factory provides a means of getting the layout
(BidirectionalRepositoryLayout) of the repository where the artifact is
located and converting the path from the given artifact. I needed the
content factory to get the repository url and the layout factory for the
artifact path so I could get the absolute path to the actual artifact
and check if it still exists. :)
Modified:
maven/archiva/trunk/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumer.java
URL:
http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumer.java?rev=584735&r1=584734&r2=584735&view=diff
==============================================================================
---
maven/archiva/trunk/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumer.java
(original)
+++
maven/archiva/trunk/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumer.java
Mon Oct 15 04:16:38 2007
@@ -19,17 +19,31 @@
* under the License.
*/
...
+ catch ( RepositoryException re )
+ {
+ re.printStackTrace();
+ throw new ConsumerException( "Can't run database cleanup remove
artifact consumer: " +
+ re.getMessage() );
+ }
+ catch ( ArchivaDatabaseException e )
+ {
+ e.printStackTrace();
+ throw new ConsumerException( e.getMessage() );
+ }
+
}
Couple of printStackTraces got left behind :)
Ooops, sorry about that :) I forgot to remove them.
Cheers,
Brett
--
Brett Porter - [EMAIL PROTECTED]
Blog: http://www.devzuz.org/blogs/bporter/
Thanks,
Deng