In PANDArch, the task of an evaluator component is to listen to generic events produced by monitors and use implementation metadata contained in those events to evaluate a collection of conformance rules assigned to that evaluator. For this purpose, an evaluator subscribes to one or more monitors to receive the required events, and thereafter invokes those monitors with the necessary information to connect to the subject application.
Java classes that implement evaluator components are located in theness.evaluatornames-
pace. This namespace corresponds to theConformance Rule Evaluationlayer in the PANDArch
architecture as discussed in Section 4.3.1. Table 5.5 on the following page describes the top level namespaces assigned to current and future implementations of different evaluator components.
5.4. EVALUATOR COMPONENTS 93
Namespace Description
ness.evaluator Root namespace for evaluator implementations and includes definitions of interfaces that all evaluator components must implement. This namespace also include interface definitions for conformance rules. The interfaces here are generic in nature and specialised by extending interfaces for specific evaluator implementations.
ness.evaluator.impl Includes abstract classes that implement base functionality for interfaces in the above namespace. These abstract classes serve as superclasses for classes that implement these interfaces in full.
ness.evaluator.runtime This namespace contains interfaces that are specific to run-
time evaluators. These extend the generic interfaces in
ness.evaluatorto make them specific for evaluating confor- mance rules against runtime events. The namespace also defines concrete rule types (i.e. non-parameterised interfaces) for implementing runtime conformance rules.
ness.evaluator.runtime.impl This namespace includes a complete implementation of a runtime evaluator. In addition, implementations of a number of runtime conformance rules are contained here.
ness.evaluator.statiic This contains base interfaces for components that evalu-
ate conformance rules against static events. It addition-
ally contains concrete type definitions for static confor-
mance rules. This namespace is the static counter-
part of the ness.evaluator.runtime namespace (not yet
implemented).
ness.monitor.statiic.impl Has abstract implementations for above interfaces (not yet
implemented).
Table 5.5: Java namespace assignments for implementing evaluator components.
Every evaluator component exposes an interface that extendsIEvaluator, the topmost super-
interface of evaluators. An evaluator interface is also bound to a monitor interface through Java generics. The design in Figure 5.5 shows that theIRuntimeEvaluatorinterface is bound
to the IRuntimeMonitor interface, theIRuntimeEvent interface and the IRuntimeTarget
interface. This means that an evaluator component implementingIRuntimeEvaluator can
subscribe only to monitors that implementIRuntimeMonitorand listen to events only of type IRuntimeEvents. This ensures that a runtime evaluator processes only runtime events, and a runtime monitor is what produces these events. Also by binding toIRuntimeTarget, a runtime evaluator is allowed specify to targets that only a runtime monitor may launch.
« bind » M -> IRuntimMonitor E -> IRuntimeEvent T -> IRuntimeTarget + monitor() : M + errors() : IErrorReport + mappedTypes() : Set<String> + mappedNamespaces() : Set<String>
+ conformanceRules() : Set<? extends IConformanceRule<IEvaluator<M, E, T>, M, E, ? extends E>> + evaluate(T target) : boolean
« interface »
IEvaluator
M : M extends IMonitor<E> E : E extends IEvent<M> T : T extends ITarget
+ addRule(IRuleVmConnectEvent rule) : void + addRule(IRuleVmDisconnectEvent rule) : void + addRule(IRuleAppStart rule) : void + addRule(IRuleAppStop rule) : void + addRule(IRuleThreadStart rule) : void + addRule(IRuleThreadStop rule) : void + addRule(IRuleInterfaceLoad rule) : void + addRule(IRuleClassLoad rule) : void + addRule(IRuleClassUnload rule) : void + addRule(IRuleClassInit rule) : void + addRule(IRuleObjectCreate rule) : void + addRule(IRuleMethodEntry rule) : void + addRule(IRuleMethodExit rule) : void + addRule(IRuleException rule) : void
« interface »
IRuntimeEvaluator
Figure 5.5: The interface-oriented design used for implementing evaluator components. Note that the
notation used for specifying template parameters is Java specific.
An important function of an evaluator is accepting conformance rules for evaluation. A given conformance rule is bound to one specific event type that provides the most suitable information for its evaluation. Because an evaluator is always associated with a particular class of events, such as runtime events, conformance rules accepted by the the evaluator must also be bound
to events belonging to the same class. TheIRuntimeEvaluatorinterface shown in Figure 5.5
contains a number ofaddRule()methods for adding conformance rules tied to each supported
runtime event type. For example, one of theaddRule()methods accepts anIRuleClassLoad
type conformance rule. As the name suggests, this conformance rule type is bound to the IClassLoadEventevent. As such, a conformance rule that needs metadata information of a
class-loadevent for evaluation should implement theIRuleClassLoadinterface.
When an evaluator receives an event from a monitor, it attempts to propagate this event to every conformance rule bound to that type of event. The evaluator maintains a list of conformance rules for each supported event type, whilst each list preserves the order in which the rules were added. This allows rules with a higher priority to be placed at the top of the list. The evaluation priority itself is determined by the component adding the conformance rules to the evaluator. For
each received event, conformance checking is triggered by invoking theevaluate()method
exposed by every conformance rule, giving the event as an argument. A conformance rule can either immediately use the event to evaluate its constraints, or cache its properties for later use. If the implementation metadata of an event fails to satisfy the constraints of a conformance rule, theevaluate()method returnsfalseto notify the evaluator of the outcome. At this point the evaluator aborts invoking the remaining conformance rules for that event.