JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.util
Class OrderedRepository

java.lang.Object
  |
  +--org.objectweb.jac.util.Repository
        |
        +--org.objectweb.jac.util.OrderedRepository
Direct Known Subclasses:
ACManager

public class OrderedRepository
extends Repository

This class defines a repository that provides order on the registered objects.

The order corresponds to the order the objects where registered into the repository.


Field Summary
 Vector orderedNames
          Vector for the ordered names.
 Vector orderedObjects
          Vector for the ordered objects.
protected static Repository repository
          Store the sole instance of repository.
 
Fields inherited from class org.objectweb.jac.util.Repository
names, objects
 
Constructor Summary
OrderedRepository()
           
 
Method Summary
static Repository get()
          Get the sole repository instance for this class.
 Object[] getNames()
          Return the ordered names of the registered objects as an array.
 Object[] getObjects()
          Return all the ordered registered objects as an array.
 String getPrintableString()
           
 boolean register(String logicalName, Object object)
          Register a new object into the repository.
 void unregister(String logicalName)
          Unregister a new JacObject into the repository.
 
Methods inherited from class org.objectweb.jac.util.Repository
dump, getName, getObject, isRegistered, unregisterObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

repository

protected static Repository repository
Store the sole instance of repository.

NOTE: this field MUST be defined by all subclasses.

See Also:
get()

orderedObjects

public Vector orderedObjects
Vector for the ordered objects.


orderedNames

public Vector orderedNames
Vector for the ordered names.

Constructor Detail

OrderedRepository

public OrderedRepository()
Method Detail

get

public static Repository get()
Get the sole repository instance for this class. Creates it if it does not exist yet.

NOTE: this method MUST be defined by all subclasses.


register

public boolean register(String logicalName,
                        Object object)
Register a new object into the repository.

Overrides:
register in class Repository
Parameters:
logicalName - the key that allows to find the object
object - the object to register
Returns:
true if the object registered, false if already registered
See Also:
unregister(String)

unregister

public void unregister(String logicalName)
Unregister a new JacObject into the repository.

Overrides:
unregister in class Repository
Parameters:
logicalName - the key that allows to find the object
See Also:
register(String,Object)

getObjects

public Object[] getObjects()
Return all the ordered registered objects as an array.

Reverse operation is getNames().

Overrides:
getObjects in class Repository
Returns:
the registered objects in this repository
See Also:
register(String,Object), getNames()

getNames

public Object[] getNames()
Return the ordered names of the registered objects as an array.

The given order is the registering order of the objects.

Reverse operation is getObjects().

Overrides:
getNames in class Repository
Returns:
the registered object names in this repository
See Also:
register(String,Object), getObjects()

getPrintableString

public String getPrintableString()
Overrides:
getPrintableString in class Repository

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli