Package org.jrd.backend.decompiling
Class PluginManager
- java.lang.Object
-
- org.jrd.backend.decompiling.PluginManager
-
public class PluginManager extends Object
Executes manages external decompiler wrapper plugins. Wrapper plugins are stored as .java files along with .json file containing classname, wrapper url and dependencies url. When user calls decompile method with decompiler name and bytecode, wrapper plugin gets compiled and executed.
-
-
Field Summary
Fields Modifier and Type Field Description static Pattern
LAMBDA_FORM
static String
UNDECOMPILABLE_LAMBDA
-
Constructor Summary
Constructors Constructor Description PluginManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
createUserPluginDir()
DecompilerWrapperInformation
createWrapper()
String
decompile(DecompilerWrapperInformation wrapper, String name, byte[] bytecode, String[] options, VmInfo vmInfo, VmManager vmManager)
void
deleteWrapper(DecompilerWrapperInformation wrapperInformation)
static String
flipWrapperExtension(String filePath)
List<DecompilerWrapperInformation>
getWrappers()
boolean
haveCompiler(DecompilerWrapperInformation wrapper)
void
loadConfigs()
Searches plugin configuration locations and calls loadConfig(file) on files.void
replace(DecompilerWrapperInformation oldWrapper, DecompilerWrapperInformation newWrapper)
void
saveWrapper(DecompilerWrapperInformation wrapper)
void
setLocationForNewWrapper(DecompilerWrapperInformation wrapperInformation)
String
validatePlugin(DecompilerWrapperInformation plugin)
Validating the @param plugin using compilation
-
-
-
Field Detail
-
UNDECOMPILABLE_LAMBDA
public static final String UNDECOMPILABLE_LAMBDA
- See Also:
- Constant Field Values
-
LAMBDA_FORM
public static final Pattern LAMBDA_FORM
-
-
Method Detail
-
getWrappers
public List<DecompilerWrapperInformation> getWrappers()
-
loadConfigs
public void loadConfigs()
Searches plugin configuration locations and calls loadConfig(file) on files.
-
decompile
public String decompile(DecompilerWrapperInformation wrapper, String name, byte[] bytecode, String[] options, VmInfo vmInfo, VmManager vmManager) throws Exception
- Parameters:
wrapper
- decompiler used for decompilingname
- optional name for decompielrs supporting inner classesbytecode
- bytecode to be decompiledoptions
- decompile optionsvmInfo
- otional vminfo to find inner classesvmManager
- otional vmmanager to find inner classes- Returns:
- Decompiled bytecode or exception String
- Throws:
Exception
- exception String
-
haveCompiler
public boolean haveCompiler(DecompilerWrapperInformation wrapper) throws Exception
- Throws:
Exception
-
replace
public void replace(DecompilerWrapperInformation oldWrapper, DecompilerWrapperInformation newWrapper) throws IOException
- Throws:
IOException
-
deleteWrapper
public void deleteWrapper(DecompilerWrapperInformation wrapperInformation)
-
setLocationForNewWrapper
public void setLocationForNewWrapper(DecompilerWrapperInformation wrapperInformation)
-
validatePlugin
public String validatePlugin(DecompilerWrapperInformation plugin)
Validating the @param plugin using compilation- Parameters:
plugin
- - plugin to validate- Returns:
- error message or null
-
createWrapper
public DecompilerWrapperInformation createWrapper()
-
saveWrapper
public void saveWrapper(DecompilerWrapperInformation wrapper) throws IOException
- Throws:
IOException
-
createUserPluginDir
public static void createUserPluginDir()
-
-