Class PluginManager
java.lang.Object
org.jrd.backend.decompiling.PluginManager
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String(package private) com.google.gson.Gsonstatic final Patternstatic final Stringprivate List<DecompilerWrapper> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddAndInitDepndenceClass(VmInfo vmInfo, VmManager vmManager, Map<String, byte[]> otherClasses, String clazz, Optional<String> classloader) voidaddWrapper(DecompilerWrapper wrapper) private intcompileWrapper(DecompilerWrapper wrapper, ByteArrayOutputStream errStream) decompile(DecompilerWrapper wrapper, String name, byte[] bytecode, String[] options, VmInfo vmInfo, VmManager vmManager, Optional<String> classloader) voiddeleteWrapper(DecompilerWrapper wrapper) getBundledCompilerStatus(DecompilerWrapper decompiler) booleanhasBundledCompiler(DecompilerWrapper wrapper) voidinitializeWrapper(DecompilerWrapper wrapper) Compiles wrapper plugin, loads it into JVM and stores it for later.static booleanstatic booleanstatic booleanprivate voidloadConfig(File file) Loads information decompiler json file into ListWrapper. voidSearches plugin configuration locations and calls loadConfig(file) on files.private voidloadConfigsFromLocation(String location) voidreplace(DecompilerWrapper oldWrapper, DecompilerWrapper newWrapper) voidsaveWrapper(DecompilerWrapper wrapper) voidprivate voidprivate static StringurlListToCsv(List<ExpandableUrl> list, String delimiter) Converts list of URLs to CSV String
example: (list){URL1,URL2,URL3} -> (String)URL1:URL2:URL3validatePlugin(DecompilerWrapper plugin) Validating the @param plugin using compilation
-
Field Details
-
wrappers
-
gson
com.google.gson.Gson gson -
ARRAY_FORM
- See Also:
-
UNDECOMPILABLE_LAMBDA
- See Also:
-
LAMBDA_FORM
-
-
Constructor Details
-
PluginManager
public PluginManager()
-
-
Method Details
-
getWrappers
-
isArrayForm
-
isUndecompilableLambda
-
isLambdaForm
-
loadConfigs
public void loadConfigs()Searches plugin configuration locations and calls loadConfig(file) on files. -
loadConfigsFromLocation
-
loadConfig
Loads information decompiler json file into ListWrapper. -
decompile
public String decompile(DecompilerWrapper wrapper, String name, byte[] bytecode, String[] options, VmInfo vmInfo, VmManager vmManager, Optional<String> classloader) throws Exception - Parameters:
wrapper- decompiler used for decompilingname- optional name for decompilers supporting inner classesbytecode- bytecode to be decompiledoptions- decompile optionsvmInfo- optional vmInfo to find inner classesvmManager- optional vmManager to find inner classes- Returns:
- Decompiled bytecode or exception String
- Throws:
Exception- the exception String
-
addAndInitDepndenceClass
-
getBundledCompilerStatus
-
hasBundledCompiler
-
initializeWrapper
Compiles wrapper plugin, loads it into JVM and stores it for later. -
replace
- Throws:
IOException
-
deleteWrapper
-
setLocationForNewWrapper
-
compileWrapper
-
validatePlugin
Validating the @param plugin using compilation- Parameters:
plugin- - plugin to validate- Returns:
- error message or null
-
createWrapper
-
saveWrapper
- Throws:
IOException
-
sortWrappers
private void sortWrappers() -
urlListToCsv
Converts list of URLs to CSV String
example: (list){URL1,URL2,URL3} -> (String)URL1:URL2:URL3 -
addWrapper
-