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(Collection,ClassItem), AspectComponent.whenGetObjects(Collection,ClassItem)

Constructor Summary
ObjectRepository()
           
 
Method Summary
static void delete(Wrappee object)
          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 object)
           
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 getObjectsWhere(ClassItem cl, FieldItem relation, Object value)
          Get all instances of a class whose field relation contains the given value.
static Collection getObjectsWhere(ClassItem cl, Predicate filter)
          Get all instances of class cl which match a predicate
static int memoryObjectCount()
          This method returns the object counter of the Jac system (last created object is getObject(objectCount()-1)).
static void register(Object 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(Object wrappee)

delete

public static void delete(Wrappee object)
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 object)

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
See Also:
getObjects(), getObjects(ClassItem), getMemoryObjects(ClassItem)

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
See Also:
getObjects(), getObjects(ClassItem), getMemoryObjects(ClassItem)

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
See Also:
getObjects(), getObjects(ClassItem), getMemoryObjects()

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 a class whose field relation contains the given value. If a repository has been defined for the class, only objects belonging to the repository are returned.

Parameters:
cl - the class
relation - the relation
value - the value that the relation must contain
See Also:
RttiConf.defineRepository(ClassItem,String,CollectionItem)

getObjectsWhere

public static Collection getObjectsWhere(ClassItem cl,
                                         Predicate filter)
Get all instances of class cl which match a predicate

Parameters:
cl - the class
filter - the predicate to be matched
Returns:
a collection whose all items are such that filter(item)==true

dump

public void dump()