Package org.alfresco.traitextender
package org.alfresco.traitextender
-
ClassDescriptionStatic utility used for aspectJ extension consistency , routing and for maintaining thread-local extension-bypass context stack.
AspectJ extension routing distinguishes between the following contexts in which an extended method (i.e. a method with anExtendannotation) can be called: Extend context
when an extended method is called and the extension overrides the method call Local proceed context
when an extension method needs to execute the original method that it has overridden. Extension bypass context
when a call to an extended method needs to be completed with the extensions disabled for that call
TheAJExtendercan checkExtensionPointdefinitions for consistency by compiling extensible classes.Implementors are aspectJ extension ignoring closures.JavaProxyInvocationHandlerto be used in conjuction with asprctJ extended traits.
Method calls will be delegated to a givenExtensibleobject method having the same signature within anAJExtender.ExtensionBypasscontext.A runtime retained annotation that marks AJ-trait-extended methods ofExtensibleobjects.
It defines the actual circumstances in which theExtensionPointdefined usingExtend.extensionAPI()andExtend.traitAPI()has its extension invoked.
Methods marked by this aspect are advised by an extension-routing around advice inRouteExtensions.ExtendedTrait<T extends Trait>Trait based extension reference holder.
Keeps track of extension references for one extensible and allows the collection of those extensions when the extensible is collected.Trait-extender central extension registry and life cycle handler.
Implementors must handle:ExtensionBundlelife cycle operations that start and stop bundles of extension points implementations at runtime.Standard-singletonExtenderimplementation.AnExtensibleobject exposes a set ofTraits asExtendedTraits objects.
AnExtendedTraitis an association between aTraitexposing object and several extension objects.
The actualTraits and associated extensions provided by anExtensibleobject are given by itsExtensionPointhandling strategy and by the current set of registered extensions (seeExtender).
The exposedTraits can be thought of as parts of an object's interface that will be exposed to an extension.Implementors are sets of extension implementations that are registered on specificExtensionPointfor givenExtenders.Creates extension instances for givenTraits andExtensionPoints.ExtensionPoint<E,M extends Trait> Defines a two-way interfacing mechanism between aTraitexposing object and an extension of that object.
The extended object can call methods of theExtensionPoint.extensionAPIwhich will be able to interact with the extended object through theExtensionPoint.traitAPIinterface it was paired with in the extension point.Trait-extension runtime target-exception wrapper.InstanceExtension<E,T extends Trait> Sub classes are extension API implementors that get instantiated once per extensible-extension point definition.Creates extension sub classes that are extension API implementors once per extensible-extension point definition.Signals an invalid extension state or extension definition.An method override extension routing aspect.
Overrides calls to methods marked by anExtendannotation with calls to methods having the same signature in extensions registered for theExtensionPointreferred by theExtendmethod annotation.
Overriding methods can call the overridden method using its correspondentTraitrepresentation (i.e. a method having the same signature).
If no extension is defined the call proceeds with the original method.
The aspect uses theAJExtenderstatic utility to for extension invocation and for maintaining thread-local extension-bypass contexts as not all calls must be overridden and calls from within the extension must be aware of this context (seeAJProxyTrait).SingletonExtension<E,T extends Trait> A singleton extension API implementor.SingletonExtensionFactory<E,S extends SingletonExtension<E, T>, T extends Trait> Creates singleton extension sub classes that are extension API implementors.SpringBeanExtension<E,T extends Trait> ASingletonExtensionextension-API implementor defined as a spring-bean.
Handles also spring-bundle extension registrations.ASpringBeanExtensions collection that get registered on theExtender's registry onSpringExtensionBundle.afterPropertiesSet().
Works in conjunction withSpringBeanExtensions andSpringExtensionPoints to define and start spring basedExtensionBundles ofSingletonExtensions.
The spring-context XML sample bellow shows the definition of spring-bundled trait-extensions:AnExtensionPointspring bean wrapper with spring registering life-cycle management.
Works in conjunction withSpringBeanExtensions andSpringExtensionBundles to define spring basedExtensionBundles of singleton extensions.Markup interface.
Subinterfaces represent distiguishing features ofExtensibleobjects that are meant to be extended and exposed to the extending code.
Ideally they would be the only means of interaction between extensions and the extended modules.