Class AbstractPipelineMavenPluginDao

java.lang.Object
org.jenkinsci.plugins.pipeline.maven.db.AbstractPipelineMavenPluginDao
All Implemented Interfaces:
Closeable, AutoCloseable, org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
Direct Known Subclasses:
PipelineMavenPluginH2Dao, PipelineMavenPluginMySqlDao, PipelineMavenPluginPostgreSqlDao

public abstract class AbstractPipelineMavenPluginDao extends Object implements org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
Author:
Cyrille Le Clerc
  • Field Details

    • LOGGER

      protected final Logger LOGGER
  • Constructor Details

    • AbstractPipelineMavenPluginDao

      protected AbstractPipelineMavenPluginDao()
    • AbstractPipelineMavenPluginDao

      public AbstractPipelineMavenPluginDao(@NonNull DataSource ds)
  • Method Details

    • acceptNoCredentials

      protected boolean acceptNoCredentials()
    • getBuilder

      public org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao.Builder getBuilder()
      Specified by:
      getBuilder in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • registerJdbcDriver

      protected abstract void registerJdbcDriver()
    • recordDependency

      public void recordDependency(String jobFullName, int buildNumber, String groupId, String artifactId, String version, String type, String scope, boolean ignoreUpstreamTriggers, String classifier)
      Specified by:
      recordDependency in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • listDependencies

      @NonNull public List<org.jenkinsci.plugins.pipeline.maven.MavenDependency> listDependencies(@NonNull String jobFullName, int buildNumber)
      Specified by:
      listDependencies in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • recordParentProject

      public void recordParentProject(@NonNull String jobFullName, int buildNumber, @NonNull String parentGroupId, @NonNull String parentArtifactId, @NonNull String parentVersion, boolean ignoreUpstreamTriggers)
      Specified by:
      recordParentProject in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • recordGeneratedArtifact

      public void recordGeneratedArtifact(String jobFullName, int buildNumber, String groupId, String artifactId, String version, String type, String baseVersion, String repositoryUrl, boolean skipDownstreamTriggers, String extension, String classifier)
      Specified by:
      recordGeneratedArtifact in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • recordBuildUpstreamCause

      public void recordBuildUpstreamCause(String upstreamJobName, int upstreamBuildNumber, String downstreamJobName, int downstreamBuildNumber)
      Specified by:
      recordBuildUpstreamCause in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • renameJob

      public void renameJob(String oldFullName, String newFullName)
      Specified by:
      renameJob in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • deleteJob

      public void deleteJob(String jobFullName)
      Specified by:
      deleteJob in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • deleteBuild

      public void deleteBuild(String jobFullName, int buildNumber)
      Specified by:
      deleteBuild in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • cleanup

      public void cleanup()
      Specified by:
      cleanup in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • getOrCreateBuildPrimaryKey

      protected long getOrCreateBuildPrimaryKey(String jobFullName, int buildNumber)
    • getGeneratedPrimaryKey

      protected Long getGeneratedPrimaryKey(PreparedStatement stmt, String column) throws SQLException
      Throws:
      SQLException
    • getOrCreateArtifactPrimaryKey

      protected long getOrCreateArtifactPrimaryKey(@NonNull String groupId, @NonNull String artifactId, @NonNull String version, @NonNull String type, @Nullable String classifier)
    • initializeDatabase

      protected void initializeDatabase()
    • handleDatabaseInitialisationException

      protected void handleDatabaseInitialisationException(SQLException e)
    • getJdbcScheme

      public abstract String getJdbcScheme()
      Returns:
      "h2", "mysql"...
    • getSchemaVersion

      protected int getSchemaVersion(Connection cnn) throws SQLException
      Throws:
      SQLException
    • testDatabase

      protected void testDatabase() throws RuntimeSqlException
      Basic tests to ensure that the database is not corrupted
      Throws:
      RuntimeSqlException
    • listDownstreamJobs

      @NonNull @Deprecated public List<String> listDownstreamJobs(@NonNull String jobFullName, int buildNumber)
      Deprecated.
      Specified by:
      listDownstreamJobs in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • listDownstreamJobsByArtifact

      @NonNull public Map<org.jenkinsci.plugins.pipeline.maven.MavenArtifact,SortedSet<String>> listDownstreamJobsByArtifact(@NonNull String jobFullName, int buildNumber)
      Specified by:
      listDownstreamJobsByArtifact in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • listDownstreamJobs

      @NonNull public SortedSet<String> listDownstreamJobs(@NonNull String groupId, @NonNull String artifactId, @NonNull String version, @Nullable String baseVersion, @NonNull String type, @Nullable String classifier)
      Specified by:
      listDownstreamJobs in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • listDownstreamPipelinesBasedOnMavenDependencies

      protected SortedSet<String> listDownstreamPipelinesBasedOnMavenDependencies(@NonNull String groupId, @NonNull String artifactId, @NonNull String version, @NonNull String type, @Nullable String classifier)
    • listDownstreamPipelinesBasedOnMavenDependencies

      @Deprecated protected List<String> listDownstreamPipelinesBasedOnMavenDependencies(@NonNull String jobFullName, int buildNumber)
      Deprecated.
    • listDownstreamJobsByArtifactBasedOnMavenDependencies

      protected Map<org.jenkinsci.plugins.pipeline.maven.MavenArtifact,SortedSet<String>> listDownstreamJobsByArtifactBasedOnMavenDependencies(@NonNull String jobFullName, int buildNumber)
    • listDownstreamPipelinesBasedOnParentProjectDependencies

      @Deprecated protected List<String> listDownstreamPipelinesBasedOnParentProjectDependencies(@NonNull String jobFullName, int buildNumber)
      Deprecated.
    • listDownstreamJobsByArtifactBasedOnParentProjectDependencies

      protected Map<org.jenkinsci.plugins.pipeline.maven.MavenArtifact,SortedSet<String>> listDownstreamJobsByArtifactBasedOnParentProjectDependencies(String jobFullName, int buildNumber)
    • listUpstreamJobs

      @NonNull public Map<String,Integer> listUpstreamJobs(@NonNull String jobFullName, int buildNumber)
      Specified by:
      listUpstreamJobs in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • listUpstreamPipelinesBasedOnMavenDependencies

      protected Map<String,Integer> listUpstreamPipelinesBasedOnMavenDependencies(@NonNull String downstreamJobFullName, int downstreamBuildNumber)
      Parameters:
      downstreamJobFullName -
      downstreamBuildNumber -
      Returns:
    • listUpstreamPipelinesBasedOnParentProjectDependencies

      protected Map<String,Integer> listUpstreamPipelinesBasedOnParentProjectDependencies(@NonNull String downstreamJobFullName, int downstreamBuildNumber)
    • listTransitiveUpstreamJobs

      @NonNull public Map<String,Integer> listTransitiveUpstreamJobs(@NonNull String jobFullName, int buildNumber)
      Specified by:
      listTransitiveUpstreamJobs in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • listTransitiveUpstreamJobs

      @NonNull public Map<String,Integer> listTransitiveUpstreamJobs(@NonNull String jobFullName, int buildNumber, org.jenkinsci.plugins.pipeline.maven.dao.UpstreamMemory upstreamMemory)
      Specified by:
      listTransitiveUpstreamJobs in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • getGeneratedArtifacts

      @NonNull public List<org.jenkinsci.plugins.pipeline.maven.MavenArtifact> getGeneratedArtifacts(@NonNull String jobFullName, @NonNull int buildNumber)
      List the artifacts generated by the given build
      Specified by:
      getGeneratedArtifacts in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
      Parameters:
      jobFullName - see Item.getFullName()
      buildNumber - see Run.getNumber()
      Returns:
      list of artifact details stored as maps ("gav", "type", "skip_downstream_triggers")
    • getJenkinsMasterPrimaryKey

      @NonNull public Long getJenkinsMasterPrimaryKey(Connection cnn) throws SQLException
      Throws:
      SQLException
    • getJenkinsDetails

      protected MigrationStep.JenkinsDetails getJenkinsDetails()
      for mocking
    • toPrettyString

      public String toPrettyString()
      Specified by:
      toPrettyString in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • getDatabaseDescription

      protected String getDatabaseDescription()
    • updateBuildOnCompletion

      public void updateBuildOnCompletion(@NonNull String jobFullName, int buildNumber, int buildResultOrdinal, long startTimeInMillis, long durationInMillis)
      Specified by:
      updateBuildOnCompletion in interface org.jenkinsci.plugins.pipeline.maven.dao.PipelineMavenPluginDao
    • getDataSource

      @NonNull protected DataSource getDataSource()
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException