Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-4912] Created new action base class for maven aggregation.
  • Loading branch information
uhafner committed May 11, 2011
1 parent ddebf45 commit fcc344e
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions src/main/java/hudson/plugins/dry/DryMavenResultAction.java
@@ -0,0 +1,78 @@
package hudson.plugins.dry;

import hudson.maven.MavenAggregatedReport;
import hudson.maven.MavenBuild;
import hudson.maven.MavenModule;
import hudson.maven.MavenModuleSet;
import hudson.maven.MavenModuleSetBuild;
import hudson.model.Action;
import hudson.plugins.analysis.core.HealthDescriptor;
import hudson.plugins.analysis.core.MavenResultAction;
import hudson.plugins.analysis.core.ParserResult;

import java.util.List;
import java.util.Map;

/**
* A {@link DryResultAction} for native Maven jobs. This action
* additionally provides result aggregation for sub-modules and for the main
* project.
*
* @author Ulli Hafner
*/
public class DryMavenResultAction extends MavenResultAction<DryResult> {
/**
* Creates a new instance of {@link DryMavenResultAction}. This instance
* will have no result set in the beginning. The result will be set
* successively after each of the modules are build.
*
* @param owner
* the associated build of this action
* @param healthDescriptor
* health descriptor to use
* @param defaultEncoding
* the default encoding to be used when reading and parsing files
*/
public DryMavenResultAction(final MavenModuleSetBuild owner, final HealthDescriptor healthDescriptor,
final String defaultEncoding) {
super(new DryResultAction(owner, healthDescriptor), defaultEncoding);
}

/**
* Creates a new instance of {@link DryMavenResultAction}.
*
* @param owner
* the associated build of this action
* @param healthDescriptor
* health descriptor to use
* @param defaultEncoding
* the default encoding to be used when reading and parsing files
* @param result
* the result in this build
*/
public DryMavenResultAction(final MavenBuild owner, final HealthDescriptor healthDescriptor,
final String defaultEncoding, final DryResult result) {
super(new DryResultAction(owner, healthDescriptor, result), defaultEncoding);
}

/** {@inheritDoc} */
public MavenAggregatedReport createAggregatedAction(final MavenModuleSetBuild build, final Map<MavenModule, List<MavenBuild>> moduleBuilds) {
return new DryMavenResultAction(build, getHealthDescriptor(), getDisplayName());
}

/** {@inheritDoc} */
public Action getProjectAction(final MavenModuleSet moduleSet) {
return new DryProjectAction(moduleSet);
}

@Override
public Class<? extends MavenResultAction<DryResult>> getIndividualActionType() {
return DryMavenResultAction.class;
}

@Override
protected DryResult createResult(final DryResult existingResult, final ParserResult aggregatedAnnotations) {
return new DryResult(getOwner(), existingResult.getDefaultEncoding(), aggregatedAnnotations);
}
}

0 comments on commit fcc344e

Please sign in to comment.