Class AbstractPipelineMavenPluginDaoDecorator
java.lang.Object
org.jenkinsci.plugins.pipeline.maven.dao.AbstractPipelineMavenPluginDaoDecorator
- All Implemented Interfaces:
Closeable
,AutoCloseable
,PipelineMavenPluginDao
- Direct Known Subclasses:
CustomTypePipelineMavenPluginDaoDecorator
,MonitoringPipelineMavenPluginDaoDecorator
public abstract class AbstractPipelineMavenPluginDaoDecorator
extends Object
implements PipelineMavenPluginDao
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
PipelineMavenPluginDao.Builder
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Routine task to cleanup the database and reclaim disk space (if possible in the underlying database).void
close()
void
deleteBuild
(String jobFullName, int buildNumber) Sync database when a build is deleted (seeRunListener.onDeleted(Run)
)void
Sync database when a job is deleted (seeItemListener.onDeleted(Item)
)getGeneratedArtifacts
(String jobFullName, int buildNumber) Return the artifacts generated by the given build.boolean
Indicates if the underlying database is production grade enough for the workload.listDependencies
(String jobFullName, int buildNumber) Return the dependencies registered by the given build.listDownstreamJobs
(String jobFullName, int buildNumber) List the downstream jobs who have a dependency on an artifact that has been generated by the given build (build identified by the givenjobFullName
,buildNumber
).listDownstreamJobs
(String groupId, String artifactId, String version, String baseVersion, String type, String classifier) List the downstream jobs who have a dependency on the given artifact.listDownstreamJobsByArtifact
(String jobFullName, int buildNumber) List the downstream jobs who have a dependency on an artifact that has been generated by the given build (build identified by the givenjobFullName
,buildNumber
).listTransitiveUpstreamJobs
(String jobFullName, int buildNumber) List the upstream jobs who generate an artifact that the given build depends on, including transitive dependencies (build identified by the givenjobFullName
,buildNumber
)listTransitiveUpstreamJobs
(String jobFullName, int buildNumber, UpstreamMemory upstreamMemory) List the upstream jobs who generate an artifact that the given build depends on, including transitive dependencies (build identified by the givenjobFullName
,buildNumber
) Use a memory for already known upstreams to boost performancelistUpstreamJobs
(String jobFullName, int buildNumber) List the upstream jobs who generate an artifact that the given build depends on (build identified by the givenjobFullName
,buildNumber
) Doesn't return the passed job in case where a pipeline consumes an artifact it also producesvoid
recordBuildUpstreamCause
(String upstreamJobName, int upstreamBuildNumber, String downstreamJobName, int downstreamBuildNumber) TODO addMavenArtifact
as org.jenkinsci.plugins.pipeline.maven.cause.MavenDependencyUpstreamCause gives these detailsvoid
recordDependency
(String jobFullName, int buildNumber, String groupId, String artifactId, String version, String type, String scope, boolean ignoreUpstreamTriggers, String classifier) Record a Maven dependency of a build.void
recordGeneratedArtifact
(String jobFullName, int buildNumber, String groupId, String artifactId, String version, String type, String baseVersion, String repositoryUrl, boolean skipDownstreamTriggers, String extension, String classifier) Record a Maven artifact generated in a build.void
recordParentProject
(String jobFullName, int buildNumber, String parentGroupId, String parentArtifactId, String parentVersion, boolean ignoreUpstreamTriggers) Record a Maven parent project of a pom processed by this build of a build.void
Sync database when a job is renamed (seeItemListener.onRenamed(Item, String, String)
)Human readable toStringvoid
updateBuildOnCompletion
(String jobFullName, int buildNumber, int buildResultOrdinal, long startTimeInMillis, long durationInMillis) Update the database with build result details.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
getDefaultJdbcUrl, listDownstreamJobs
-
Field Details
-
delegate
-
-
Constructor Details
-
AbstractPipelineMavenPluginDaoDecorator
-
-
Method Details
-
getDescription
- Specified by:
getDescription
in interfacePipelineMavenPluginDao
-
getBuilder
- Specified by:
getBuilder
in interfacePipelineMavenPluginDao
-
recordDependency
public void recordDependency(@NonNull String jobFullName, int buildNumber, @NonNull String groupId, @NonNull String artifactId, @NonNull String version, @NonNull String type, @NonNull String scope, boolean ignoreUpstreamTriggers, String classifier) Description copied from interface:PipelineMavenPluginDao
Record a Maven dependency of a build.- Specified by:
recordDependency
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
buildNumber
- seeRun.getNumber()
groupId
- Maven dependency groupIdartifactId
- Maven dependency artifactIdversion
- Maven dependency versiontype
- Maven dependency type (e.g. "jar", "war", "pom", hpi"...)scope
- Maven dependency scope ("compile", "test", "provided"...)ignoreUpstreamTriggers
- see PipelineGraphPublisher#isIgnoreUpstreamTriggers()classifier
- Maven dependency classifier
-
recordParentProject
public void recordParentProject(@NonNull String jobFullName, int buildNumber, @NonNull String parentGroupId, @NonNull String parentArtifactId, @NonNull String parentVersion, boolean ignoreUpstreamTriggers) Description copied from interface:PipelineMavenPluginDao
Record a Maven parent project of a pom processed by this build of a build.- Specified by:
recordParentProject
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
buildNumber
- seeRun.getNumber()
parentGroupId
- Maven dependency groupIdparentArtifactId
- Maven dependency artifactIdparentVersion
- Maven dependency versionignoreUpstreamTriggers
- see PipelineGraphPublisher#isIgnoreUpstreamTriggers()
-
recordGeneratedArtifact
public void recordGeneratedArtifact(@NonNull String jobFullName, int buildNumber, @NonNull String groupId, @NonNull String artifactId, @NonNull String version, @NonNull String type, @NonNull String baseVersion, @Nullable String repositoryUrl, boolean skipDownstreamTriggers, String extension, String classifier) Description copied from interface:PipelineMavenPluginDao
Record a Maven artifact generated in a build.- Specified by:
recordGeneratedArtifact
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
buildNumber
- seeRun.getNumber()
groupId
- Maven artifact groupIdartifactId
- Maven artifact artifactIdversion
- Maven artifact version, the "expanded version" for snapshots who have been "mvn deploy" or equivalent (e.g. "1.1-20170808.155524-66" for "1.1-SNAPSHOT" deployed to a repo)type
- Maven artifact type (e.g. "jar", "war", "pom", hpi"...)baseVersion
- Maven artifact version, the NOT "expanded version" for snapshots who have been "mvn deploy" or equivalent (e.g. baseVersion is "1.1-SNAPSHOT" for a "1.1-SNAPSHOT" artifact that has been deployed to a repo and expanded to "1.1-20170808.155524-66")repositoryUrl
- URL of the Maven repository on which the artifact is deployed ("mvn deploy").null
if the artifact was not deployedskipDownstreamTriggers
- see PipelineGraphPublisher#isSkipDownstreamTriggers()
-
recordBuildUpstreamCause
public void recordBuildUpstreamCause(String upstreamJobName, int upstreamBuildNumber, String downstreamJobName, int downstreamBuildNumber) Description copied from interface:PipelineMavenPluginDao
TODO addMavenArtifact
as org.jenkinsci.plugins.pipeline.maven.cause.MavenDependencyUpstreamCause gives these details- Specified by:
recordBuildUpstreamCause
in interfacePipelineMavenPluginDao
- Parameters:
upstreamJobName
- Job that triggered the build. SeeItem.getFullName()
.upstreamBuildNumber
- Job that triggered the build. SeeRun.getNumber()
.downstreamJobName
- Job that is triggered. SeeItem.getFullName()
.downstreamBuildNumber
- Job that is triggered. SeeRun.getNumber()
.
-
listDependencies
@NonNull public List<MavenDependency> listDependencies(@NonNull String jobFullName, int buildNumber) Description copied from interface:PipelineMavenPluginDao
Return the dependencies registered by the given build.- Specified by:
listDependencies
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
buildNumber
- seeRun.getNumber()
- Returns:
- sorted list of maven artifacts.
- See Also:
-
getGeneratedArtifacts
@NonNull public List<MavenArtifact> getGeneratedArtifacts(@NonNull String jobFullName, int buildNumber) Description copied from interface:PipelineMavenPluginDao
Return the artifacts generated by the given build.- Specified by:
getGeneratedArtifacts
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
buildNumber
- seeRun.getNumber()
- Returns:
- sorted list of generated maven artifacts.
-
renameJob
Description copied from interface:PipelineMavenPluginDao
Sync database when a job is renamed (seeItemListener.onRenamed(Item, String, String)
)- Specified by:
renameJob
in interfacePipelineMavenPluginDao
- Parameters:
oldFullName
- seeItem.getFullName()
newFullName
- seeItem.getFullName()
- See Also:
-
deleteJob
Description copied from interface:PipelineMavenPluginDao
Sync database when a job is deleted (seeItemListener.onDeleted(Item)
)- Specified by:
deleteJob
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
- See Also:
-
deleteBuild
Description copied from interface:PipelineMavenPluginDao
Sync database when a build is deleted (seeRunListener.onDeleted(Run)
)- Specified by:
deleteBuild
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
- See Also:
-
listDownstreamJobs
Description copied from interface:PipelineMavenPluginDao
List the downstream jobs who have a dependency on an artifact that has been generated by the given build (build identified by the givenjobFullName
,buildNumber
). Doesn't return the passed job in case where a pipeline consumes an artifact it also produces- Specified by:
listDownstreamJobs
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
buildNumber
- seeRun.getNumber()
- Returns:
- list of job full names (see
Item.getFullName()
) - See Also:
-
listDownstreamJobsByArtifact
@NonNull public Map<MavenArtifact,SortedSet<String>> listDownstreamJobsByArtifact(@NonNull String jobFullName, int buildNumber) Description copied from interface:PipelineMavenPluginDao
List the downstream jobs who have a dependency on an artifact that has been generated by the given build (build identified by the givenjobFullName
,buildNumber
). Doesn't return the passed job in case where a pipeline consumes an artifact it also produces- Specified by:
listDownstreamJobsByArtifact
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
buildNumber
- seeRun.getNumber()
- Returns:
- list of job full names (see
Item.getFullName()
) byMavenArtifact
- See Also:
-
listDownstreamJobs
@NonNull public SortedSet<String> listDownstreamJobs(@NonNull String groupId, @NonNull String artifactId, @NonNull String version, @Nullable String baseVersion, @NonNull String type, @Nullable String classifier) Description copied from interface:PipelineMavenPluginDao
List the downstream jobs who have a dependency on the given artifact.- Specified by:
listDownstreamJobs
in interfacePipelineMavenPluginDao
- Parameters:
groupId
- Maven artifact group ID (see Artifact#getArtifactId())artifactId
- Maven artifact id (see Artifact#getArtifactId())version
- Maven artifact version (see Artifact#getVersion())baseVersion
- Maven artifact (see Artifact#getBaseVersion())type
- Maven artifact type (see Artifact#getType())classifier
- Maven artifact classifier (see Artifact#getClassifier())- Returns:
- list of job full names (see
Item.getFullName()
) byMavenArtifact
- See Also:
-
listUpstreamJobs
Description copied from interface:PipelineMavenPluginDao
List the upstream jobs who generate an artifact that the given build depends on (build identified by the givenjobFullName
,buildNumber
) Doesn't return the passed job in case where a pipeline consumes an artifact it also produces- Specified by:
listUpstreamJobs
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
buildNumber
- seeRun.getNumber()
- Returns:
- list of builds : key
Item.getFullName()
, value:Run.getNumber()
- See Also:
-
listTransitiveUpstreamJobs
@NonNull public Map<String,Integer> listTransitiveUpstreamJobs(@NonNull String jobFullName, int buildNumber) Description copied from interface:PipelineMavenPluginDao
List the upstream jobs who generate an artifact that the given build depends on, including transitive dependencies (build identified by the givenjobFullName
,buildNumber
)- Specified by:
listTransitiveUpstreamJobs
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
buildNumber
- seeRun.getNumber()
- Returns:
- list of job full names (see
Item.getFullName()
) - See Also:
-
listTransitiveUpstreamJobs
public Map<String,Integer> listTransitiveUpstreamJobs(String jobFullName, int buildNumber, UpstreamMemory upstreamMemory) Description copied from interface:PipelineMavenPluginDao
List the upstream jobs who generate an artifact that the given build depends on, including transitive dependencies (build identified by the givenjobFullName
,buildNumber
) Use a memory for already known upstreams to boost performance- Specified by:
listTransitiveUpstreamJobs
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
buildNumber
- seeRun.getNumber()
upstreamMemory
- seeUpstreamMemory
- if called for several jobs in a loop we save the already known upstreams- Returns:
- list of job full names (see
Item.getFullName()
) - See Also:
-
cleanup
public void cleanup()Description copied from interface:PipelineMavenPluginDao
Routine task to cleanup the database and reclaim disk space (if possible in the underlying database).- Specified by:
cleanup
in interfacePipelineMavenPluginDao
-
toPrettyString
Description copied from interface:PipelineMavenPluginDao
Human readable toString- Specified by:
toPrettyString
in interfacePipelineMavenPluginDao
-
updateBuildOnCompletion
public void updateBuildOnCompletion(@NonNull String jobFullName, int buildNumber, int buildResultOrdinal, long startTimeInMillis, long durationInMillis) Description copied from interface:PipelineMavenPluginDao
Update the database with build result details.- Specified by:
updateBuildOnCompletion
in interfacePipelineMavenPluginDao
- Parameters:
jobFullName
- seeItem.getFullName()
buildNumber
- seeRun.getNumber()
buildResultOrdinal
- seeResult.ordinal
startTimeInMillis
- seeRun.getStartTimeInMillis()
durationInMillis
- seeRun.getDuration()
-
isEnoughProductionGradeForTheWorkload
public boolean isEnoughProductionGradeForTheWorkload()Description copied from interface:PipelineMavenPluginDao
Indicates if the underlying database is production grade enough for the workload. H2 database is not enough for production grade workloads of the pipeline-maven-plugin.- Specified by:
isEnoughProductionGradeForTheWorkload
in interfacePipelineMavenPluginDao
- Returns:
false
if the underlying database is not production grade enough for the workload
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-