Package org.technologybrewery.baton
Class AbstractMigration
- java.lang.Object
-
- org.technologybrewery.baton.AbstractMigration
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanactiveprotected StringbackupCustomLocationprotected booleanbackupOriginalMigratedFilesprotected Stringdescriptionprotected Set<String>fileNamePatternsprotected Stringnameprotected intnumberOfBackupsToKeepprotected org.apache.maven.project.MavenProjectprojectEnables access to the runtime properties associated with the project's POM configuration against which Baton is being executed.
-
Constructor Summary
Constructors Constructor Description AbstractMigration()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidbackupOriginalFile(File originalFile)MigrationSummaryexecute(org.apache.maven.shared.model.fileset.FileSet[] fileSets)If active, validates applicability of the migration each targeted file and then performs the migration.StringgetBackupCustomLocation()protected FilegetBasedir()protected StringgetBuildDir()StringgetDescription()Set<String>getFileNamePatterns()org.apache.maven.project.MavenProjectgetMavenProject()StringgetName()intgetNumberOfBacksUpsToKeep()booleanisActive()booleanisBackupOriginalMigratedFiles()protected abstract booleanperformMigration(File file)Called to perform the specific migration logic.voidsetActive(boolean active)voidsetBackupCustomLocation(String backupCustomLocation)voidsetBackupMigratedOriginalFiles(boolean backupOriginalMigratedFiles)voidsetBackupOriginalMigratedFiles(boolean backupOriginalMigratedFiles)voidsetDescription(String description)voidsetFileNamePatterns(Set<String> fileNamePatterns)voidsetMavenProject(org.apache.maven.project.MavenProject project)voidsetName(String name)voidsetNumberOfBacksUpsToKeep(int numberOfBacksUpsToKeep)booleanshouldBackupMigratedOriginalFiles()protected abstract booleanshouldExecuteOnFile(File file)Called to determine if this migration should be run on the passed file.
-
-
-
Field Detail
-
name
protected String name
-
description
protected String description
-
active
protected boolean active
-
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.
-
-
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.
-
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()
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin interfaceMigration
-
setDescription
public void setDescription(String description)
- Specified by:
setDescriptionin interfaceMigration
-
getFileNamePatterns
public Set<String> getFileNamePatterns()
- Specified by:
getFileNamePatternsin interfaceMigration
-
setFileNamePatterns
public void setFileNamePatterns(Set<String> fileNamePatterns)
- Specified by:
setFileNamePatternsin interfaceMigration
-
shouldBackupMigratedOriginalFiles
public boolean shouldBackupMigratedOriginalFiles()
- Specified by:
shouldBackupMigratedOriginalFilesin interfaceMigration
-
setBackupMigratedOriginalFiles
public void setBackupMigratedOriginalFiles(boolean backupOriginalMigratedFiles)
- Specified by:
setBackupMigratedOriginalFilesin interfaceMigration
-
isBackupOriginalMigratedFiles
public boolean isBackupOriginalMigratedFiles()
-
setBackupOriginalMigratedFiles
public void setBackupOriginalMigratedFiles(boolean backupOriginalMigratedFiles)
-
getBackupCustomLocation
public String getBackupCustomLocation()
- Specified by:
getBackupCustomLocationin interfaceMigration
-
setBackupCustomLocation
public void setBackupCustomLocation(String backupCustomLocation)
- Specified by:
setBackupCustomLocationin interfaceMigration
-
getNumberOfBacksUpsToKeep
public int getNumberOfBacksUpsToKeep()
- Specified by:
getNumberOfBacksUpsToKeepin interfaceMigration
-
setNumberOfBacksUpsToKeep
public void setNumberOfBacksUpsToKeep(int numberOfBacksUpsToKeep)
- Specified by:
setNumberOfBacksUpsToKeepin interfaceMigration
-
setMavenProject
public void setMavenProject(org.apache.maven.project.MavenProject project)
- Specified by:
setMavenProjectin interfaceMigration
-
getMavenProject
public org.apache.maven.project.MavenProject getMavenProject()
- Specified by:
getMavenProjectin interfaceMigration
-
-