Interface IUnitProcessor
IUnit
s.
No two identifiers registered in a processor can have the same
type
.
A processor has a PDM and a PM, which are provided to unit identifiers in order to maintain a chain of properties
A unit processor is a crucial component for building plugins that achieve high coherence and loose coupling. Please refer to the JEB Unit Plugin Development Guide: Delegation and Parsing Inner Data for more information.
Note: may be renamed to IParser
-
Method Summary
Modifier and TypeMethodDescriptioncreateDebugger
(String name, IUnit parent) Convenience method that processes a code unit to produce an associated debugger unit.createDecompiler
(String name, IUnit parent) Convenience method that processes a code unit to produce an associated decompiler unit.boolean
Determine whether this parser always process duplicate inputs, or can, under certain conditions, skip processing duplicates.Get a list of unit identifier for debugger units only.int
Get the processing depth.Get the PDM used by this processor.Get the PM used by this processor.getUnitIdentifier
(String type) Get an identifier by type.Get a list of unit identifiers managed by this processor.process
(String name, IInput input, IUnitCreator parent) Identify and process input data.process
(String name, IInput input, IUnitCreator parent, String wantedType) Identify and process input data.process
(String name, IInput input, IUnitCreator parent, String wantedType, boolean softDelegation) Identify and process input data.process
(String name, IInput input, IUnitCreator parent, String wantedType, boolean softDelegation, boolean doNotProcessUnit) Identify and process input data.process
(String name, IUnitCreator parent) Identify and process input data.registerPlugin
(IUnitPlugin identifier) Register a plugin: it can be a true unit identifier or a native code plugin (that will yield an identifier).int
setProcessingDepth
(int depth) Set the maximum processing depth.void
setUnknownInputResolver
(IUnknownInputResolver resolver) Provide an optional "callback class" used as a last-resort mechanism when a unit could not be identified.boolean
unregisterUnitIdentifier
(IUnitIdentifier identifier) Unregister a unit identifier.
-
Method Details
-
getPropertyDefinitionManager
IPropertyDefinitionManager getPropertyDefinitionManager()Get the PDM used by this processor.- Returns:
- the mandatory PDM
-
getPropertyManager
IPropertyManager getPropertyManager()Get the PM used by this processor.- Returns:
- the mandatory PM
-
registerPlugin
Register a plugin: it can be a true unit identifier or a native code plugin (that will yield an identifier).This method is used by clients to register unit identifiers manually. The client is responsible for initializing the unit identifier prior to registering it. The client is also responsible for performing appropriate version checking.
- Parameters:
identifier
- the plugin to register- Returns:
- the newly registered unit identifier
-
unregisterUnitIdentifier
Unregister a unit identifier.- Parameters:
identifier
- the identifier- Returns:
- true if the identifier was unregistered
-
getUnitIdentifiers
List<IUnitIdentifier> getUnitIdentifiers()Get a list of unit identifiers managed by this processor.- Returns:
- a list of unit identifiers
-
getDebuggerUnitIdentifiers
List<IDebuggerUnitIdentifier> getDebuggerUnitIdentifiers()Get a list of unit identifier for debugger units only.- Returns:
- a list of debugger unit identifiers
-
getUnitIdentifier
Get an identifier by type.- Parameters:
type
- the unit identifier type string- Returns:
- the identifier or null
-
getAlwaysProcessDuplicateInputs
boolean getAlwaysProcessDuplicateInputs()Determine whether this parser always process duplicate inputs, or can, under certain conditions, skip processing duplicates.- Returns:
-
setUnknownInputResolver
Provide an optional "callback class" used as a last-resort mechanism when a unit could not be identified.Note: currently, the resolver is not used by the official RCP client
- Parameters:
resolver
- an optional resolver
-
setProcessingDepth
int setProcessingDepth(int depth) Set the maximum processing depth. A call to process() can succeed if and only if the depth level of the parent is strictly less than the processing depth. By default, the processing depth is set to 0 (meaning, process as deep as possible). Clients may change this setting, temporarily and permanently.- Parameters:
depth
- a number ≥ 1; any number ≤ 0 means no depth (process as deep as possible)- Returns:
- the previous depth
-
getProcessingDepth
int getProcessingDepth()Get the processing depth.- Returns:
- the processing depth
-
process
IUnit process(String name, IInput input, IUnitCreator parent, String wantedType, boolean softDelegation, boolean doNotProcessUnit) Identify and process input data. The identification part can be short-circuited by providing a specific wanted type. In that case, the processor looks for a matching identifier, and start processing the input data right away without executing the identification routine.- Parameters:
name
- the optional wanted unit name; if null, a name will be auto-generatedinput
- the optional input binary dataparent
- the creating entity, either a parent unit or an artifactwantedType
- the optional wanted type. Leave null to let the identifiers perform identificationsoftDelegation
- perform soft delegation, aka, avoid calling the unknown resolver (if any) and avoid creating a generic unit if all unit identifiers failed to identify the input data; in the latter case, this method will return nulldoNotProcessUnit
- if true, after preparation by the identifier, do not automatically callprocess()
on the newly-created unit- Returns:
- a new unit
-
process
IUnit process(String name, IInput input, IUnitCreator parent, String wantedType, boolean softDelegation) Identify and process input data.Same as:
process(name, data, parent, wantedType, softDelegation, false)
-
process
Identify and process input data.Same as:
process(name, data, parent, wantedType, false, false)
- Parameters:
name
- the unit nameinput
- the input dataparent
- the parentwantedType
- the optional wanted type- Returns:
- a new unit
-
process
Identify and process input data.- Parameters:
name
- the unit nameinput
- the input dataparent
- the parent- Returns:
- a new unit
-
process
Identify and process input data. The input data in that case is the parent unit itself. This method is used when re-parsing existing units. It is used by decompilers, typically.- Parameters:
name
- the unit nameparent
- the parent- Returns:
- a new unit
-
createDecompiler
Convenience method that processes a code unit to produce an associated decompiler unit.- Parameters:
name
- the name of the resulting unit, generally "decompiler"parent
- a parent unit, generally anICodeUnit
- Returns:
- a decompiler unit or null
-
createDebugger
Convenience method that processes a code unit to produce an associated debugger unit.- Parameters:
name
- the name of the resulting unit, generally "debugger"parent
- a prent unit, generally anICodeUnit
- Returns:
- a debugger unit or null
-