Class AbstractMigration

  • All Implemented Interfaces:
    Migration

    public abstract class AbstractMigration
    extends Object
    implements Migration
    Common migration logic to make it easier to implement custom migrations.
    • Field Detail

      • description

        protected String description
      • active

        protected boolean active
      • fileNamePatterns

        protected Set<String> fileNamePatterns
      • backupOriginalMigratedFiles

        protected boolean backupOriginalMigratedFiles
      • backupCustomLocation

        protected String backupCustomLocation
      • numberOfBackupsToKeep

        protected int numberOfBackupsToKeep
      • project

        protected org.apache.maven.project.MavenProject project
        Enables access to the runtime properties associated with the project's POM configuration against which Baton is being executed.
    • Constructor Detail

      • AbstractMigration

        public AbstractMigration()
    • Method Detail

      • execute

        public MigrationSummary execute​(org.apache.maven.shared.model.fileset.FileSet[] fileSets)
        If active, validates applicability of the migration each targeted file and then performs the migration. Tracks the number of files successfully and unsuccessfully changed during the process.
        Specified by:
        execute in interface Migration
        Parameters:
        fileSets - the file sets to process with this migration
        Returns:
        a summary of results
      • shouldExecuteOnFile

        protected abstract boolean shouldExecuteOnFile​(File file)
        Called to determine if this migration should be run on the passed file.
        Parameters:
        file - file to check
        Returns:
        to execute or not
      • performMigration

        protected abstract boolean performMigration​(File file)
        Called to perform the specific migration logic.
        Parameters:
        file - file to migrate
        Returns:
        if successful or not
      • backupOriginalFile

        protected void backupOriginalFile​(File originalFile)
      • getBasedir

        protected File getBasedir()
      • getBuildDir

        protected String getBuildDir()
      • isActive

        public boolean isActive()
        Specified by:
        isActive in interface Migration
      • setActive

        public void setActive​(boolean active)
        Specified by:
        setActive in interface Migration
      • isBackupOriginalMigratedFiles

        public boolean isBackupOriginalMigratedFiles()
      • setBackupOriginalMigratedFiles

        public void setBackupOriginalMigratedFiles​(boolean backupOriginalMigratedFiles)
      • setMavenProject

        public void setMavenProject​(org.apache.maven.project.MavenProject project)
        Specified by:
        setMavenProject in interface Migration
      • getMavenProject

        public org.apache.maven.project.MavenProject getMavenProject()
        Specified by:
        getMavenProject in interface Migration