Okey dokey, thanks a lot Dario!  :-)

-Deng

Dário Oliveros wrote:
Good to hear from you.

I had made some code changes before getting your response back and
surprisingly I was on the right track by working on pretty much the same
steps as you've suggested in the first place. The only difference was
regarding the UnprocessedArtifactPredicate to where I added a new condition
for checking whether whenProcessed date is before lastModified instead of
using snapshot verification. Besides I changed the else statement of
ArtifactsProcessedConstraint by adding the same verification as shown
previously:
whereClause = "whenProcessed == null || (whenProcessed != null &&
whenProcessed < lastModified)";
In your third step, I went for the date checking instead of checksum.

Anyway it looks like your second solution is better since it tends to be
cleaner than the first one.
I will take a look and let you know as soon as I can. Once I fix the issue,
I will post the patch for your analysis.

Thank you so much for your support.



Maria Odea Ching-2 wrote:
Hi Dario,

I think the solution you've proposed would work.. to implement it, these are probably what you need to change in Archiva:

1. update the UnprocessedArtifactPredicate
- add the constraint to get the SNAPSHOT artifacts as you've mentioned (there is a 'snapshot' field in the ArchivaArtifactModel which flags whether the artifact is a snapshot or not, though using this would return all snapshots -- unique & non-unique)

2. update UnprocessedArtifactPredicate
- add check if artifact isProcessed() OR isSnapshot() for the condition the artifact needs to satisfy

3. update ProjectModelToDatabaseConsumer
- in the statement if( hasProjectModelInDatabase(...) ) is satisfied, the project model/pom file should be verified against the existing project model (in the db) if there were updates or changes made to it (maybe via the lastModified date or via its checksum). If there are changes, then the existing project model must be removed from the db and the new project model shall be added.


I've also thought of another way to tackle this issue..

You could just update the DatabaseCleanupRemoveProjectModelConsumer to add checking for changes in the project models/pom files of those artifacts that have already been processed. If the project model has been changed, just remove the project model from the db and update the ArchivaArtifactModel's "whenProcessed" field to NULL so that it would qualify in the UnProcessedArtifactPredicate(false) constraint. The other thing that needs to be done is to update the JdoDatabaseUpdater's update() method -- just switch the lines updateAllUnprocessed() and updateAllProcessed() inside it. updateAllProcessed() should be executed first before updateAllUnprocessed() in order to capture the updates performed in DatabaseCleanupRemoveProjectModelConsumer.

More thoughts/suggestions anyone? :-)

Thanks,
Deng


Dário Oliveros wrote:
Hi all,

I would like to understand why a processed artifact does not have
update-db-project consumer in case of a non-unique SNAPSHOT project
(please
refer to http://jira.codehaus.org/browse/MRM-622 for more information).

The reason for bringing this up is that the database is not being updated
accordingly when a non-unique SNAPSHOT project with dependency version
changes is deployed once again to Archiva repository. Even though it
contains differences compared to the previous one, it's considered
processed
already and therefore not updated. It looks like a bug in my opinion and
I
would like to contribute for this fix.

Should I change the query constraint for unprocessed artifacts
(ArtifactsProcessedConstraint(false)) so it also retrieves the non-unique
SNAPSHOT projects or add a new consumer to processed artifacts for
database
update ?

Any tips or pointers would be appreciated.

Thanks,
Dário







Reply via email to