org.objectweb.jac.core
Interface BaseProgramListener

All Known Implementing Classes:
ACManager, AspectComponent

public interface BaseProgramListener

This interface specify the prototypes of the methods that can be notified when an event occurs within the base program.

This can be regarded as the JAC Meta-Object Protocol (MOP).

Author:
Renaud Pawlak

Field Summary
static String FOUND_OBJECT
           
 
Method Summary
 void afterApplicationStarted()
          Upcalled after a new application is started on the JAC system.
 void afterRunningWrapper(Wrapper wrapper, String wrappingMethod)
          This method is upcalled by JAC after the application of the wrapper.
 void afterWrap(Wrappee wrappee, Wrapper wrapper, String[] wrapping_methods, String[][] wrapped_methods)
          This method is upcalled after the wrappee is wrapped by 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).
 boolean beforeRunningWrapper(Wrapper wrapper, String wrappingMethod)
          This method is upcalled by JAC when a wrapper is going to be applied to a wrappee.
 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 onExit()
          This method is upcalled when the system exits.
 void whenClone(Wrappee cloned, Wrappee clone)
          This method is upcalled by JAC when a JAC object is cloned.
 void whenCloseDisplay(Display display)
          Upcalled when a display is closing.
 void whenDeleted(Wrappee object)
          Upcalled when an object is deleted.
 Wrappee whenDeserialized(SerializedJacObject orgObject, Wrappee finalObject)
          This method is called when a base object is deserialized and can parametrize the deserialization by reading the SerializedJacObject instance to get some extra infos on the aspects.
 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)
          This method is upcalled by JAC when a new object is instantiated from a remote site.
 Wrappee whenSerialized(Wrappee orgObject, SerializedJacObject finalObject)
          This method is called when a JAC object is serialized and can parametrize the serialization by filling the finalObject parameter.
 void whenTopologyChanged()
          This method is upcalled when a topological change occurs whithin the distributed application.
 void whenUsingNewClass(ClassItem cl)
          This method is upcalled by JAC when a static method is called for the first time.
 void whenUsingNewInstance(Interaction interaction)
          This method is upcalled by JAC when a given instance is used for the first time at construction-time.
 

Field Detail

FOUND_OBJECT

public static final String FOUND_OBJECT
See Also:
Constant Field Values
Method Detail

whenUsingNewInstance

public void whenUsingNewInstance(Interaction interaction)
This method is upcalled by JAC when a given instance is used for the first time at construction-time.

Informations about the called method can be retrieved by using the CollaborationParticipant methods.

Parameters:
interaction - the interaction that triggered the whenUsingNewInstance event (usually a constructor invocation)
See Also:
CollaborationParticipant, whenUsingNewClass(ClassItem)

whenUsingNewClass

public void whenUsingNewClass(ClassItem cl)
This method is upcalled by JAC when a static method is called for the first time.

Parameters:
cl - the class that is used for the first time.
See Also:
CollaborationParticipant, whenUsingNewInstance(Interaction)

whenRemoteInstantiation

public void whenRemoteInstantiation(Wrappee newInstance,
                                    String name)
This method is upcalled by JAC when a new object is instantiated from a remote site.

The name that is passed is the name of the remote reference that has been used to create the object.

Parameters:
newInstance - the instance that have been created by a remote host
name - the name of the new instance

whenClone

public void whenClone(Wrappee cloned,
                      Wrappee clone)
This method is upcalled by JAC when a JAC object is cloned.

Parameters:
cloned - the object that is being cloned
clone - the new object (the clone of cloned)

whenSerialized

public Wrappee whenSerialized(Wrappee orgObject,
                              SerializedJacObject finalObject)
This method is called when a JAC object is serialized and can parametrize the serialization by filling the finalObject parameter.

IMPORTANT: this method is upcalled only if the serialization is done with a JacObjectOutputStream. To ensure the correct use of this class, only use JacObject.serialize() to serialize an object.

Parameters:
orgObject - the object being serialized
finalObject - the corresponding serialized structure
Returns:
the object being serialized (usually orgObject, but not necessarily).
See Also:
SerializedJacObject, JacObjectOutputStream

whenDeserialized

public Wrappee whenDeserialized(SerializedJacObject orgObject,
                                Wrappee finalObject)
This method is called when a base object is deserialized and can parametrize the deserialization by reading the SerializedJacObject instance to get some extra infos on the aspects.

IMPORTANT: this method is upcalled only if the deserialization is done with a JacObjectInputStream. To ensure the correct use of this class, only use JacObject.deserialize() to deserialize an object.

Parameters:
orgObject - the corresponding serialized structure
finalObject - the object being deserialized
Returns:
the object being deserialized (usually finalObject but not necessarily)
See Also:
SerializedJacObject, JacObjectInputStream

beforeRunningWrapper

public boolean beforeRunningWrapper(Wrapper wrapper,
                                    String wrappingMethod)
This method is upcalled by JAC when a wrapper is going to be applied to a wrappee.

Parameters:
wrapper - the wrapper that is going to be runned
wrappingMethod - the name of the may-be runned wrapping method
Returns:
a boolean that tells if the wrapper has to be runned (true) or not (false)
See Also:
Wrappee, Wrapping.wrap(Wrappee,Wrapper,AbstractMethodItem), Wrapper, Wrapper.proceed(Invocation)

afterRunningWrapper

public void afterRunningWrapper(Wrapper wrapper,
                                String wrappingMethod)
This method is upcalled by JAC after the application of the wrapper.

Parameters:
wrapper - the wrapper that has just been runned
wrappingMethod - the name of the runned wrapping method
See Also:
Wrappee, Wrapping.wrap(Wrappee,Wrapper,AbstractMethodItem), Wrapper, Wrapper.proceed(Invocation)

afterWrap

public void afterWrap(Wrappee wrappee,
                      Wrapper wrapper,
                      String[] wrapping_methods,
                      String[][] wrapped_methods)
This method is upcalled after the wrappee is wrapped by the wrapper.

See Also:
Wrapper, Wrappee, Wrapping.wrap(Wrappee,Wrapper,AbstractMethodItem)

whenGetObjects

public void whenGetObjects(Collection objects,
                           ClassItem cl)
Calls whenGetObjects on all aspects.

Parameters:
objects - list of objects already in memory
cl - return only instances of this class

whenNameObject

public String whenNameObject(Object object,
                             String name)
Upcalled when the naming aspect names an object.

Parameters:
object - the object to name
name - current name of the object or null
Returns:
the proposed name for the object

whenObjectMiss

public void whenObjectMiss(String name)
Upcalled when an object is been seeked within the name repository and is not found.

The finally found object is a contextual attribute called FOUND_OBJECT.

Parameters:
name - the name that has not been found
See Also:
FOUND_OBJECT

whenDeleted

public void whenDeleted(Wrappee object)
Upcalled when an object is deleted.

Parameters:
object - the deleted object

whenFree

public void whenFree(Wrappee object)
Upcalled when an object is freed from the memory.

Parameters:
object - the deleted object

afterApplicationStarted

public void afterApplicationStarted()
Upcalled after a new application is started on the JAC system.


whenCloseDisplay

public void whenCloseDisplay(Display display)
Upcalled when a display is closing.

Parameters:
display - the closing display

whenTopologyChanged

public void whenTopologyChanged()
This method is upcalled when a topological change occurs whithin the distributed application.


onExit

public void onExit()
This method is upcalled when the system exits.


beforeWrappeeInit

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

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.


afterWrappeeInit

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