Package es.bsc.dataclay.util
Class FileAndAspectsUtils
- java.lang.Object
- 
- es.bsc.dataclay.util.FileAndAspectsUtils
 
- 
 public final class FileAndAspectsUtils extends Object Utility class for aspects and files.
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancheckIfSomeFileExists(File folder)This function checks if there is any file in folder providedstatic voidcompileClass(String srcPath, String destPath, String[] classPath)Compile classstatic voidcompileClasses(String srcPath, String destPath, String[] classPath, String excludePackages)Compile classesstatic voidcompileClassesExcluding(String srcPath, String destPath, String[] classPath, Set<String> excludePackages)Compile classesstatic voidcopyFolder(File src, File dest)Copy folderstatic voidcreateDirectory(String targetDirectoryPath)Method that creates a directory on the specified path (or does nothing if it already exists)static voiddeleteFolderContent(File folder)This function deletes the files inside the folder providedstatic StringexecuteCommand(String[] command, boolean isWindows, boolean printOutput, Path redirectedOutput, String redirectedInput, Map<String,String> envVariables)Execute commandstatic List<Class<?>>find(String scannedPackage)Get all classes in packagestatic ArrayList<String>getClassNamesFromSourcePath(String dir, boolean isRoot)This function return a list of class names in a source pathstatic StringstoreClass(String targetDirectoryPath, String className, byte[] bs)Method that stores a class represented by the provided array of bytes with a certain name into a specific directorystatic voidweaveAspects(String binPath, String aspectpath, String[] classPath, String destPath)Apply aspects
 
- 
- 
- 
Method Detail- 
createDirectorypublic static void createDirectory(String targetDirectoryPath) Method that creates a directory on the specified path (or does nothing if it already exists)- Parameters:
- targetDirectoryPath- the directory path
 
 - 
deleteFolderContentpublic static void deleteFolderContent(File folder) This function deletes the files inside the folder provided- Parameters:
- folder- Folder containing files to delete
 
 - 
checkIfSomeFileExistspublic static boolean checkIfSomeFileExists(File folder) This function checks if there is any file in folder provided- Parameters:
- folder- Folder containing files to delete
- Returns:
- TRUE if folder is empty
 
 - 
storeClasspublic static String storeClass(String targetDirectoryPath, String className, byte[] bs) Method that stores a class represented by the provided array of bytes with a certain name into a specific directory- Parameters:
- targetDirectoryPath- the directory path
- className- the file name for the class
- bs- Bytecode of the class to store
- Returns:
- Path if it succeeds, null otherwise
 
 - 
copyFolderpublic static void copyFolder(File src, File dest) throws IOException Copy folder- Parameters:
- src- Source folder
- dest- Dest folder
- Throws:
- IOException- if some exception occurs
 
 - 
findpublic static List<Class<?>> find(String scannedPackage) Get all classes in package- Parameters:
- scannedPackage- Package being scanned
- Returns:
- List of classes in package
 
 - 
weaveAspectspublic static void weaveAspects(String binPath, String aspectpath, String[] classPath, String destPath) Apply aspects- Parameters:
- binPath- Path of classes to be weaved
- aspectpath- Aspects path
- classPath- Class path (aspects are not applied here)
- destPath- Destination path of the class with aspects
 
 - 
executeCommandpublic static String executeCommand(String[] command, boolean isWindows, boolean printOutput, Path redirectedOutput, String redirectedInput, Map<String,String> envVariables) Execute command- Parameters:
- command- Command to execute
- isWindows- Indicates if windows or Linux
- printOutput- Print output
- redirectedOutput- Path to file in which to store output of the command
- redirectedInput- TODO
- envVariables- Environment variables for the command.
 
 - 
compileClassespublic static void compileClasses(String srcPath, String destPath, String[] classPath, String excludePackages) throws Exception Compile classes- Parameters:
- srcPath- Source path
- destPath- Destination path
- classPath- Class path
- excludePackages- Packages to exclude
- Throws:
- Exception- if some exception occurs
 
 - 
compileClassesExcludingpublic static void compileClassesExcluding(String srcPath, String destPath, String[] classPath, Set<String> excludePackages) throws Exception Compile classes- Parameters:
- srcPath- Source path
- destPath- Destination path
- classPath- Class path
- excludePackages- Packages to exclude
- Throws:
- Exception- if some exception occurs
 
 - 
compileClasspublic static void compileClass(String srcPath, String destPath, String[] classPath) throws Exception Compile class- Parameters:
- srcPath- Source path
- destPath- Destination path
- classPath- Class path
- Throws:
- Exception- if some exception occurs
 
 - 
getClassNamesFromSourcePathpublic static ArrayList<String> getClassNamesFromSourcePath(String dir, boolean isRoot) This function return a list of class names in a source path- Parameters:
- dir- Source path to analyze
- isRoot- Must be true, used for recursive analysis
- Returns:
- List of classes found in source path
 
 
- 
 
-