public class PackageRenamer extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PackageRenamer.PackageRenamerException |
Constructor and Description |
---|
PackageRenamer()
The constructor of a PackageRenamer class.
|
PackageRenamer(String propertiesFileName) |
PackageRenamer(String[] args) |
Modifier and Type | Method and Description |
---|---|
void |
binaryCopy(File inFile,
File outFile)
Do a binary copy of the file byte buffer by byte buffer.
|
File |
buildAndCheckDestinationFile(String aDirString)
INTERNAL Creates a destination directory File object under the path
passed, verifying correctness.
|
File |
buildAndCheckExistingDirFile(String aDirString) |
PrintWriter |
buildAndCheckLogWriter(String logFileString) |
void |
createDestinationDirectory(File aDirectory)
This method creates an output directory for post-rename file(s).
|
static boolean |
directoryIsSubdirectory(File directory1,
File directory2)
Return true if directory2 is contained within directory1.
|
File |
existingDirectoryFromPrompt() |
static String |
getDefaultPropertiesFileName() |
BufferedReader |
getReader() |
boolean |
isExtensionSupported(String extension)
Return true if the PackageRenamer should work on the given file
extension.
|
void |
logln(String str) |
static void |
main(String[] args)
Main method to run the PackageRenamer
|
String |
parseFileExtension(File aFile)
Returns the extension of the given file.
|
Properties |
readChangesFile(String filename)
This readChangesFile() method reads the given properties file to be a
reference for renaming TopLink package name.
|
static String |
replace(String str,
String oldChars,
String newChars)
Do a search and replace in a string.
|
String |
returnNewFileNameIfRequired(String aSourceFileNameWithoutRoot)
Renames a file based on the properties passed.
|
void |
run()
This run() method performs,
reading the properties file into properties variable to be a reference for changing package name.
|
void |
runSearchAndReplacePackageName(File sourceFile)
This runSearchAndReplacePackageName() reads a pre-rename source file all
into string variable and replacing the old package names with the new
ones according to the properties file.
|
void |
traverseSourceDirectory(File aDirectoryString)
This traverseSourceDirectory() traverse source-root-directory, creating
an corresponding output directory, and calling another method for
replacing old TopLink package name.
|
static void |
usage() |
public PackageRenamer()
public PackageRenamer(String propertiesFileName)
public PackageRenamer(String[] args)
public void binaryCopy(File inFile, File outFile) throws FileNotFoundException, IOException
inFile
- The file to copyoutFile
- The destination fileFileNotFoundException
- if either of the two files does not existIOException
- if any other IO related error occurspublic File buildAndCheckDestinationFile(String aDirString)
aDirString
- The path to the directory File object to createpublic PrintWriter buildAndCheckLogWriter(String logFileString)
public void createDestinationDirectory(File aDirectory)
aDirectory
- The output directory to createpublic static boolean directoryIsSubdirectory(File directory1, File directory2)
directory1
- The higher level directorydirectory2
- The lower level directorypublic File existingDirectoryFromPrompt()
public static String getDefaultPropertiesFileName()
public BufferedReader getReader()
public boolean isExtensionSupported(String extension)
extension
- The file extension to check for being supportedpublic void logln(String str)
str
- The String to logpublic static void main(String[] args)
args
- Command line argumentspublic String parseFileExtension(File aFile)
aFile
- The file of which to retrieve the extensionpublic Properties readChangesFile(String filename)
filename
- The input file to use for the renamingpublic void run()
public void runSearchAndReplacePackageName(File sourceFile)
sourceFile
- The source file to processpublic static String replace(String str, String oldChars, String newChars)
str
- The original StringoldChars
- The character pattern to replacenewChars
- The character pattern to replace the existing withpublic String returnNewFileNameIfRequired(String aSourceFileNameWithoutRoot)
aSourceFileNameWithoutRoot
- The original filenamepublic void traverseSourceDirectory(File aDirectoryString)
aDirectoryString
- The source root directory to traversepublic static void usage()
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference