JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.core
Class ObjectRepository

java.lang.Object
  |
  +--org.objectweb.jac.core.ObjectRepository

public class ObjectRepository
extends Object

This class allows the JAC applications to access objects that are managed within the current VM or that can be defined outside of it by the currently woven aspects.

By default, the object repository methods only return the JAC objects that are accessible through the JacObject.getObject methods. However, since it upcalls the ACManager.whenGetObjects() method, all the aspect components can change the returned object set.

As typical examples:

See Also:
ACManager#whenGetObjects(List,ClassItem), AspectComponent#whenGetObjects(List,ClassItem)

Constructor Summary
ObjectRepository()
           
 
Method Summary
static void delete(Wrappee wrappee)
          This method deletes the given JAC object by removing it from the different collections it has been inserted into by the system.
 void dump()
           
static void free(Wrappee wrappee)
           
static Object getMemoryObject(int nth)
          This method returns the nth object that has been created in the Jac system.
static int getMemoryObjectIndex(Object obj)
          This method returns the index of anobject that has been created in the Jac system.
static Collection getMemoryObjects()
          This method returns all the JAC objects that are in the current JVM memory (use getObjects() to get all the objects handled by the woven aspects -- such as distribution or persistence).
static Object[] getMemoryObjects(ClassItem cl)
          This method returns all the JAC objects of a given type as an array.
static Object[] getMemoryObjects(ClassItem[] types)
          This method returns all the Jac objects that match any of the given types.
static Object[] getMemoryObjects(String type)
          This method returns all the Jac objects of a given type as an array.
static Object[] getMemoryObjects(String[] types)
          This method returns all the JAC objects that match any of the given types.
static Collection getObjects()
          Gets all the instantiated JAC objects on the current VM and on all the external objects sources known by the aspects (maybe resticed by some aspects).
static Collection getObjects(Class cl)
          Gets all the JAC objects instances of a given class on the current VM and on all the external objects sources known by the aspects (maybe resticed by some aspects).
static Collection getObjects(ClassItem cl)
          Gets all the JAC objects instances of a given class on the current VM and on all the external objects sources known by the aspects (maybe resticed by some aspects).
static Collection getObjects(String expr)
          Gets the set of JAC objects whose names match an expression.
static Collection getObjectsWhere(ClassItem cl, FieldItem relation, Object value)
          Get all instances of class cl whose field relation contains the given value.
static Collection getObjectsWhere(ClassItem cl, Predicate filter)
          Get all instances of class cl whose field relation contains the given value.
static int memoryObjectCount()
          This method returns the object counter of the Jac system (last created object is getObject(objectCount()-1)).
static void register(Wrappee wrappee)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectRepository

public ObjectRepository()
Method Detail

register

public static void register(Wrappee wrappee)

delete

public static void delete(Wrappee wrappee)
This method deletes the given JAC object by removing it from the different collections it has been inserted into by the system.

The JAVA GC, will then be able to free it from memory on its next run.


free

public static void free(Wrappee wrappee)

getMemoryObject

public static Object getMemoryObject(int nth)
This method returns the nth object that has been created in the Jac system.

Parameters:
nth - the object index
Returns:
the requested object

getMemoryObjectIndex

public static int getMemoryObjectIndex(Object obj)
This method returns the index of anobject that has been created in the Jac system.

Parameters:
obj - the object
Returns:
the index of the object

memoryObjectCount

public static int memoryObjectCount()
This method returns the object counter of the Jac system (last created object is getObject(objectCount()-1)).

Returns:
the number of created objects

getMemoryObjects

public static Collection getMemoryObjects()
This method returns all the JAC objects that are in the current JVM memory (use getObjects() to get all the objects handled by the woven aspects -- such as distribution or persistence).

Returns:
all the JAC objects in memory

getMemoryObjects

public static Object[] getMemoryObjects(String type)
This method returns all the Jac objects of a given type as an array.

Parameters:
type - the type to get
Returns:
all the Jac objects of a given type

getMemoryObjects

public static Object[] getMemoryObjects(ClassItem cl)
This method returns all the JAC objects of a given type as an array.

Parameters:
cl - the type to get
Returns:
all the JAC objects of a given type

getMemoryObjects

public static Object[] getMemoryObjects(String[] types)
This method returns all the JAC objects that match any of the given types.

Parameters:
types - the types to get
Returns:
all the JAC objects that match any of the given types

getMemoryObjects

public static Object[] getMemoryObjects(ClassItem[] types)
This method returns all the Jac objects that match any of the given types.

Parameters:
types - the types to get
Returns:
all the Jac objects that match any of the given types

getObjects

public static Collection getObjects()
Gets all the instantiated JAC objects on the current VM and on all the external objects sources known by the aspects (maybe resticed by some aspects).

Returns:
a collection of acessible objects
See Also:
getObjects(ClassItem), getMemoryObjects()

getObjects

public static Collection getObjects(ClassItem cl)
Gets all the JAC objects instances of a given class on the current VM and on all the external objects sources known by the aspects (maybe resticed by some aspects).

Returns:
a collection of acessible instances of cl
See Also:
getObjects(Class)

getObjects

public static Collection getObjects(Class cl)
Gets all the JAC objects instances of a given class on the current VM and on all the external objects sources known by the aspects (maybe resticed by some aspects).

Returns:
a collection of acessible instances of cl
See Also:
getObjects(ClassItem)

getObjectsWhere

public static Collection getObjectsWhere(ClassItem cl,
                                         FieldItem relation,
                                         Object value)
Get all instances of class cl whose field relation contains the given value.

Parameters:
cl - the class
relation - the relation
value - the value that the relation must contain

getObjectsWhere

public static Collection getObjectsWhere(ClassItem cl,
                                         Predicate filter)
Get all instances of class cl whose field relation contains the given value.

Parameters:
cl - the class

getObjects

public static Collection getObjects(String expr)
Gets the set of JAC objects whose names match an expression.

Parameters:
expr - a regular expression
Returns:
the objects set

dump

public void dump()

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli