public interface

IUnitProcessor

com.pnfsoftware.jeb.core.units.IUnitProcessor

Class Overview

A unit processor is a parser that uses registered JEB plugins to identify and process input data into IUnits.

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

Summary

Public Methods
abstract IDebuggerUnit createDebugger(String name, IUnit parent)
Convenience method that processes a code unit to produce an associated debugger unit.
abstract IDecompilerUnit createDecompiler(String name, IUnit parent)
Convenience method that processes a code unit to produce an associated decompiler unit.
abstract boolean getAlwaysProcessDuplicateInputs()
Determine whether this parser always process duplicate inputs, or can, under certain conditions, skip processing duplicates.
abstract List<IDebuggerUnitIdentifier> getDebuggerUnitIdentifiers()
Get a list of unit identifier for debugger units only.
abstract int getProcessingDepth()
Get the processing depth.
abstract IPropertyDefinitionManager getPropertyDefinitionManager()
Get the PDM used by this processor.
abstract IPropertyManager getPropertyManager()
Get the PM used by this processor.
abstract IUnitIdentifier getUnitIdentifier(String type)
Get an identifier by type.
abstract List<IUnitIdentifier> getUnitIdentifiers()
Get a list of unit identifiers managed by this processor.
abstract IUnit process(String name, IInput input, IUnitCreator parent, String wantedType, boolean softDelegation)
Identify and process input data.
abstract IUnit process(String name, IUnitCreator parent)
Identify and process input data.
abstract IUnit process(String name, IInput input, IUnitCreator parent, String wantedType, boolean softDelegation, boolean doNotProcessUnit)
Identify and process input data.
abstract IUnit process(String name, IInput input, IUnitCreator parent, String wantedType)
Identify and process input data.
abstract IUnit process(String name, IInput input, IUnitCreator parent)
Identify and process input data.
abstract IUnitIdentifier registerPlugin(IUnitPlugin identifier)
Register a plugin: it can be a true unit identifier or a native code plugin (that will yield an identifier).
abstract int setProcessingDepth(int depth)
Set the maximum processing depth.
abstract void setUnknownInputResolver(IUnknownInputResolver resolver)
Provide an optional "callback class" used as a last-resort mechanism when a unit could not be identified.
abstract boolean unregisterUnitIdentifier(IUnitIdentifier identifier)
Unregister a unit identifier.

Public Methods

public abstract IDebuggerUnit createDebugger (String name, IUnit parent)

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 an ICodeUnit
Returns
  • a debugger unit or null

public abstract IDecompilerUnit createDecompiler (String name, IUnit parent)

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 an ICodeUnit
Returns
  • a decompiler unit or null

public abstract boolean getAlwaysProcessDuplicateInputs ()

Determine whether this parser always process duplicate inputs, or can, under certain conditions, skip processing duplicates.

public abstract List<IDebuggerUnitIdentifier> getDebuggerUnitIdentifiers ()

Get a list of unit identifier for debugger units only.

Returns
  • a list of debugger unit identifiers

public abstract int getProcessingDepth ()

Get the processing depth.

Returns
  • the processing depth

public abstract IPropertyDefinitionManager getPropertyDefinitionManager ()

Get the PDM used by this processor.

Returns
  • the mandatory PDM

public abstract IPropertyManager getPropertyManager ()

Get the PM used by this processor.

Returns
  • the mandatory PM

public abstract IUnitIdentifier getUnitIdentifier (String type)

Get an identifier by type.

Parameters
type the unit identifier type string
Returns
  • the identifier or null

public abstract List<IUnitIdentifier> getUnitIdentifiers ()

Get a list of unit identifiers managed by this processor.

Returns
  • a list of unit identifiers

public abstract 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)

public abstract IUnit process (String name, IUnitCreator parent)

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.

Same as process(name, null, parent, null, false, false)

Parameters
name the unit name
parent the parent
Returns
  • a new unit

public abstract 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-generated
input the optional input binary data
parent the creating entity, either a parent unit or an artifact
wantedType the optional wanted type. Leave null to let the identifiers perform identification
softDelegation 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 null
doNotProcessUnit if true, after preparation by the identifier, do not automatically call process() on the newly-created unit
Returns
  • a new unit

public abstract IUnit process (String name, IInput input, IUnitCreator parent, String wantedType)

Identify and process input data.

Same as: process(name, data, parent, wantedType, false, false)

Parameters
name the unit name
input the input data
parent the parent
wantedType the optional wanted type
Returns
  • a new unit

public abstract IUnit process (String name, IInput input, IUnitCreator parent)

Identify and process input data.

Same as: process(name, data, parent, null, false, false)

Parameters
name the unit name
input the input data
parent the parent
Returns
  • a new unit

public abstract IUnitIdentifier registerPlugin (IUnitPlugin identifier)

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

public abstract 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

public abstract void setUnknownInputResolver (IUnknownInputResolver resolver)

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

public abstract boolean unregisterUnitIdentifier (IUnitIdentifier identifier)

Unregister a unit identifier.

Parameters
identifier the identifier
Returns
  • true if the identifier was unregistered