|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.jac.util.Repository | +--org.objectweb.jac.util.OrderedRepository | +--org.objectweb.jac.core.ACManager
This class manages all the aspect components that are present in the JAC system.
When a new aspect component is registered, it is
woven regarding its weaving properties. Once woven, the aspect
component manager dispatches all the events of the
BaseProgramListener
to it.
AspectComponent
,
BaseProgramListener
Field Summary | |
protected static ACManager |
acManager
Stores the sole instance of Aspect Component Manager. |
protected Hashtable |
declaredACs
Stores all the declared aspect components. |
boolean |
registering
A internally-used flag to bootstrap the AC manager. |
Fields inherited from class org.objectweb.jac.util.OrderedRepository |
orderedNames, orderedObjects, repository |
Fields inherited from class org.objectweb.jac.util.Repository |
names, objects |
Fields inherited from interface org.objectweb.jac.core.BaseProgramListener |
FOUND_OBJECT |
Constructor Summary | |
ACManager()
The default constructor will set the acManager field to the right value and bind the JAC internal MOP to it so that it will be notified of the base program events. |
Method Summary | |
void |
afterApplicationStarted()
Dispatch this event to all the registered Aspect Components that are woven. |
void |
afterRunningWrapper(Wrapper wrapper,
String wrappingMethod)
Upcall the beforeRunningWrapper method of all the aspect component that owns the wrapper. |
void |
afterWrap(Wrappee wrappee,
Wrapper wrapper,
String[] wrapping_methods,
String[][] wrapped_methods)
Upcall the beforeRunningWrapper method of all the aspect component that owns the wrapper. |
void |
afterWrappeeInit(Wrappee wrappee)
This method should be called by the GUI system after an object has been created and initialized (tells the other aspects that the object is now regular). |
Object |
attr(String name)
|
void |
attrdef(String name,
Object value)
|
boolean |
beforeRunningWrapper(Wrapper wrapper,
String wrappingMethod)
Forward this event to the aspect component that owns the wrapper. |
void |
beforeWrappeeInit(Wrappee wrappee)
This method should be called by the GUI system before an object is being created and initialized (but the process is not finished yet). |
void |
declareAC(String name,
String path)
Declares a new aspect component. |
static Repository |
get()
Get the sole instance of Aspect Component Manager for this JAC container. |
AspectComponent |
getAC(String name)
Returns an AC of a given name for the current application. |
AspectComponent |
getACFromFullName(String fullName)
Returns an AC of a given name |
static ACManager |
getACM()
|
String |
getACPathFromName(String acName)
Gets a declared aspect component path from its name. |
AspectComponent[] |
getAspectComponents()
|
Set |
getDeclaredACs()
Gets the declared aspect components. |
void |
getNameCounters(Map counters)
|
boolean |
isACDeclared(String name)
|
static void |
main(String[] args)
Called by the JAC launcher to create and declare the aspect components defined in jac.prop. |
void |
onExit()
This method is upcalled when the system exits. |
boolean |
register(String name,
Object aspectComponent)
Register a new aspect component. |
AspectComponent |
registerDeclaredAC(String name)
Registers a declared aspect as is (not linked to an application and with no configuration). |
boolean |
registerWithName(String name,
String className)
A resister method that can be used by a UI. |
void |
reloadAspect(String aspect)
Reload an aspect for the current application |
void |
reloadAspect(String application,
String aspect)
Reload an aspect for an application |
void |
simulateUsingNewInstance(Wrappee wrappee)
Apply all the woven aspect components to the given wrappee. |
void |
unregister(String name)
Unregister a given aspect component (it is then unwoven). |
void |
updateNameCounters(Map counters)
Update name counters |
void |
weave(AspectComponent ac)
Register (if not allready registered) and weaves a new Aspect Component. |
void |
whenClone(Wrappee cloned,
Wrappee clone)
Dispatch this event to all the registered Aspect Components that are woven. |
void |
whenCloseDisplay(Display display)
Dispatch this event to all the registered Aspect Components that are woven. |
void |
whenDeleted(Wrappee object)
Upcalled when an object is deleted. |
Wrappee |
whenDeserialized(SerializedJacObject orgObject,
Wrappee finalObject)
Dispatch this event to all the woven Aspect Components. |
void |
whenFree(Wrappee object)
Upcalled when an object is freed from the memory. |
void |
whenGetObjects(Collection objects,
ClassItem cl)
Calls whenGetObjects on all aspects. |
String |
whenNameObject(Object object,
String name)
Upcalled when the naming aspect names an object. |
void |
whenObjectMiss(String name)
Upcalled when an object is been seeked within the name repository and is not found. |
void |
whenRemoteInstantiation(Wrappee newInstance,
String name)
Dispatch this event to all the registered Aspect Components. |
Wrappee |
whenSerialized(Wrappee orgObject,
SerializedJacObject finalObject)
Dispatch this event to all the woven Aspect Components. |
void |
whenTopologyChanged()
Dispatch this event to all the registered Aspect Components that are woven. |
void |
whenUsingNewClass(ClassItem cl)
This method is upcalled by JAC when a static method is called for the first time. |
void |
whenUsingNewInstance(Interaction interaction)
Dispatch this event to all the registered Aspect Components that are woven. |
Methods inherited from class org.objectweb.jac.util.OrderedRepository |
getNames, getObjects, getPrintableString |
Methods inherited from class org.objectweb.jac.util.Repository |
dump, getName, getObject, init, isRegistered, unregisterObject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public boolean registering
protected static ACManager acManager
protected Hashtable declaredACs
Constructor Detail |
public ACManager()
BaseProgramListener
Method Detail |
public static Repository get()
If this instance does not exist yet, then it is created.
This method returns a Repository
so that the
result must be casted to used specific method of
ACManager
.
Repository
public static ACManager getACM()
public AspectComponent[] getAspectComponents()
public void declareAC(String name, String path)
name
- the name of the aspect componentpath
- its path (must be accessible from the current
classpath)public boolean isACDeclared(String name)
public String getACPathFromName(String acName)
acName
- the name of the AC
public Set getDeclaredACs()
public AspectComponent registerDeclaredAC(String name)
name
- the aspect namepublic static void main(String[] args) throws Throwable
Throwable
public AspectComponent getAC(String name)
name
- aspect's namepublic AspectComponent getACFromFullName(String fullName)
fullName
- aspect's full name (public final void whenRemoteInstantiation(Wrappee newInstance, String name)
whenRemoteInstantiation
in interface BaseProgramListener
newInstance
- the remotly created instancename
- the original remote nameAspectComponent.whenRemoteInstantiation(Wrappee,String)
,
BaseProgramListener.whenRemoteInstantiation(Wrappee,String)
public final void whenUsingNewInstance(Interaction interaction)
whenUsingNewInstance
in interface BaseProgramListener
interaction
- the interaction that triggered the
whenUsingNewInstance event (usually a constructor invocation)AspectComponent.whenUsingNewInstance(Interaction)
,
BaseProgramListener.whenUsingNewInstance(Interaction)
public final void whenUsingNewClass(ClassItem cl)
BaseProgramListener
whenUsingNewClass
in interface BaseProgramListener
cl
- the class that is used for the first time.CollaborationParticipant
,
BaseProgramListener.whenUsingNewInstance(Interaction)
public final Wrappee whenSerialized(Wrappee orgObject, SerializedJacObject finalObject)
Note: the current collaboration contains an attribute called "orgObject" and that is a reference to the object that is currently serialized.
whenSerialized
in interface BaseProgramListener
finalObject
- the corresponding serialized structure.orgObject
- the object being serialized
AspectComponent.whenSerialized(Wrappee,SerializedJacObject)
,
BaseProgramListener.whenSerialized(Wrappee,SerializedJacObject)
public final Wrappee whenDeserialized(SerializedJacObject orgObject, Wrappee finalObject)
Note: the current collaboration contains an attribute called "finalObject" and that is a reference to the object that is will be finally deserialized.
whenDeserialized
in interface BaseProgramListener
orgObject
- the corresponding serialized structure.finalObject
- the object being deserialized
AspectComponent.whenDeserialized(SerializedJacObject,Wrappee)
,
BaseProgramListener.whenDeserialized(SerializedJacObject,Wrappee)
public final void simulateUsingNewInstance(Wrappee wrappee)
wrappee
- the wrappee that have to be treatedpublic final void whenClone(Wrappee cloned, Wrappee clone)
whenClone
in interface BaseProgramListener
cloned
- the wrappee that is being clonedclone
- the new clone of clonedAspectComponent.whenClone(Wrappee,Wrappee)
,
BaseProgramListener.whenClone(Wrappee,Wrappee)
public final void whenDeleted(Wrappee object)
BaseProgramListener
whenDeleted
in interface BaseProgramListener
object
- the deleted objectpublic final void whenFree(Wrappee object)
BaseProgramListener
whenFree
in interface BaseProgramListener
object
- the deleted objectpublic final void afterApplicationStarted()
afterApplicationStarted
in interface BaseProgramListener
AspectComponent.afterApplicationStarted()
public final void onExit()
BaseProgramListener
onExit
in interface BaseProgramListener
public final void whenTopologyChanged()
whenTopologyChanged
in interface BaseProgramListener
AspectComponent.whenTopologyChanged()
public final void whenCloseDisplay(Display display)
whenCloseDisplay
in interface BaseProgramListener
display
- the closing displayAspectComponent.whenCloseDisplay(Display)
public final boolean beforeRunningWrapper(Wrapper wrapper, String wrappingMethod)
beforeRunningWrapper
in interface BaseProgramListener
wrapper
- the wrapper that is going to be runnedwrappingMethod
- the name of the may-be runned wrapping
AspectComponent.beforeRunningWrapper(Wrapper,String)
,
BaseProgramListener.beforeRunningWrapper(Wrapper,String)
public final void afterRunningWrapper(Wrapper wrapper, String wrappingMethod)
afterRunningWrapper
in interface BaseProgramListener
wrapper
- the wrapper that has just been runnedwrappingMethod
- the name of the runned wrapping methodAspectComponent.afterRunningWrapper(Wrapper,String)
,
BaseProgramListener.afterRunningWrapper(Wrapper,String)
public final void afterWrap(Wrappee wrappee, Wrapper wrapper, String[] wrapping_methods, String[][] wrapped_methods)
afterWrap
in interface BaseProgramListener
AspectComponent.afterWrap(Wrappee,Wrapper,String[],String[][])
public void whenGetObjects(Collection objects, ClassItem cl)
BaseProgramListener
whenGetObjects
in interface BaseProgramListener
objects
- list of objects already in memorycl
- return only instances of this classpublic String whenNameObject(Object object, String name)
BaseProgramListener
whenNameObject
in interface BaseProgramListener
object
- the object to namename
- current name of the object or null
public void getNameCounters(Map counters)
public void updateNameCounters(Map counters)
public void whenObjectMiss(String name)
BaseProgramListener
The finally found object is a contextual attribute called FOUND_OBJECT.
whenObjectMiss
in interface BaseProgramListener
name
- the name that has not been foundBaseProgramListener.FOUND_OBJECT
public final boolean register(String name, Object aspectComponent)
When a new aspect component is registered, the
allWoven
flag is set to false. And the
checkWeaving
method will be called for each base
method call until all the aspect components are woven.
register
in class OrderedRepository
name
- the aspect component key for the AC manageraspectComponent
- the registered aspect component
AspectComponent.weave()
public final boolean registerWithName(String name, String className)
This method creates a new aspect component with the name of the given class and registers it. It will be woven immediatly.
name
- the aspect component key for the AC managerclassName
- the aspect component class nameregister(String,Object)
,
AspectComponent.weave()
public final void weave(AspectComponent ac)
ac
- the aspect component to weaveregister(String,Object)
,
AspectComponent.weave()
public final void unregister(String name)
unregister
in class OrderedRepository
name
- the aspect component key for the AC managerregister(String,Object)
,
AspectComponent.unweave()
public final void attrdef(String name, Object value)
public final Object attr(String name)
public void reloadAspect(String application, String aspect)
application
- the application's nameaspect
- the aspect's namepublic void reloadAspect(String aspect) throws Exception
aspect
- the aspect's name
Exception
public final void beforeWrappeeInit(Wrappee wrappee)
BaseProgramListener
Then, some aspects should deal differently with this object thant with already created objects (for instance, the GUI aspect should not show the object to other users, or a remote access aspect should disable forwarding.
beforeWrappeeInit
in interface BaseProgramListener
public final void afterWrappeeInit(Wrappee wrappee)
BaseProgramListener
afterWrappeeInit
in interface BaseProgramListener
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |