com.sun.jaw.impl.agent.services.light
Class RepositorySrv

java.lang.Object
  |
  +--com.sun.jaw.impl.agent.services.light.RepositorySrv
Direct Known Subclasses:
PersistentRepSrv

public class RepositorySrv
extends java.lang.Object
implements MoRepSrvIf

This class provides a simple implementation of an object repository.

The implementation does not offer any persistency. The objects are stored in memory.

See Also:
MoRepSrvIf, Serialized Form

Constructor Summary
RepositorySrv()
          Default constructor.
 
Method Summary
 boolean contains(java.lang.Object object)
          Checks if a managed object is already stored in the Object Repository.
 boolean contains(ObjectName name)
          Checks if a managed object is already stored in the Object Repository.
static java.lang.String getClassVersion()
          Returns the version of this class.
 java.lang.String getDomain()
          Gets the domain name associated with the Object Repository.
 java.lang.Integer getNbElements()
          Returns the number of elements stored in the Object Repository.
 java.util.Vector getObject(ObjectName name, QueryExp query)
          Get handles on managed objects controlled by the Object Repository.
 boolean isPersistent()
          Indicates whether or not the Object Repository offers persistency or not.
 boolean isQuerySrv()
          Indicates whether or not the Object Repository supports filtering or not.
 void register(java.lang.Object object, ObjectName name)
          Registers a named object into the Object Repository.
 void registerDB(java.lang.Object object, ObjectName name)
          Registers a named object with persistency into the Object Repository.
 java.lang.Object retrieve(ObjectName name)
          Retrieves the managed object from the Object Repository.
 void setConfig(java.util.Vector params)
          The method does not perform anything for the current implementation of the repository.
 void setDomain(java.lang.String domain)
          Sets the domain name associated with the Object Repository.
 void unregister(java.lang.Object object)
          Removes a managed object from the Object Repository.
 void unregister(ObjectName name)
          Removes a managed object from the Object Repository.
 void update(java.lang.Object object, ObjectName name)
          Updates the managed object in the Object Repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositorySrv

public RepositorySrv()
Default constructor.
Method Detail

setConfig

public void setConfig(java.util.Vector params)
The method does not perform anything for the current implementation of the repository. The method is only provided to comply to the MoRepSrvIf interface definition.
Specified by:
setConfig in interface MoRepSrvIf

isQuerySrv

public boolean isQuerySrv()
Indicates whether or not the Object Repository supports filtering or not. If the Object Repository does not support filtering, then the Common Management Framework (CMF) will perform filtering itself on behalf of the Object Repository.
Specified by:
isQuerySrv in interface MoRepSrvIf
Returns:
true if the filtering is supported, false otherwise.

isPersistent

public boolean isPersistent()
Indicates whether or not the Object Repository offers persistency or not.
Specified by:
isPersistent in interface MoRepSrvIf
Returns:
true if persistence is supported, false otherwise.

contains

public boolean contains(ObjectName name)
Checks if a managed object is already stored in the Object Repository.
Specified by:
contains in interface MoRepSrvIf
Parameters:
name - name of the managed object to find.
Returns:
true if the managed object is part of the repository, false otherwise.

retrieve

public java.lang.Object retrieve(ObjectName name)
Retrieves the managed object from the Object Repository.
Specified by:
retrieve in interface MoRepSrvIf
Parameters:
name - name of the managed object to retrieve.
Returns:
the retrieved managed object, null otherwise.

contains

public boolean contains(java.lang.Object object)
Checks if a managed object is already stored in the Object Repository. This method is to be used only with a singleton, that is, only one instance of that class is permitted within the repository for a given domain.
Specified by:
contains in interface MoRepSrvIf
Parameters:
object - object to find.
Returns:
true if the managed object is part of the repository, false otherwise.

registerDB

public void registerDB(java.lang.Object object,
                       ObjectName name)
                throws InstanceAlreadyExistException
Registers a named object with persistency into the Object Repository.

NOTE: This service does not support persistency.

Specified by:
registerDB in interface MoRepSrvIf
Parameters:
object - object to be added to the repository.
name - logical name of the object.
Throws:
InstanceAlreadyExistException - The instance is already registered in the object repository.
ServiceNotFoundException - The requested service is not supported.

register

public void register(java.lang.Object object,
                     ObjectName name)
              throws InstanceAlreadyExistException
Registers a named object into the Object Repository.
Specified by:
register in interface MoRepSrvIf
Parameters:
object - object to be added to the repository.
name - logical name of the object.
Throws:
InstanceAlreadyExistException - The instance is already registered in the object repository.

update

public void update(java.lang.Object object,
                   ObjectName name)
            throws InstanceNotFoundException
Updates the managed object in the Object Repository.
Specified by:
update in interface MoRepSrvIf
Parameters:
object - the new object.
name - name of the managed object.
Throws:
InstanceNotFoundException - Object not found in repository.

unregister

public void unregister(ObjectName name)
                throws InstanceNotFoundException
Removes a managed object from the Object Repository.
Specified by:
unregister in interface MoRepSrvIf
Parameters:
name - name of the managed object.
Throws:
InstanceNotFoundException - Object not found in repository.

unregister

public void unregister(java.lang.Object object)
                throws InstanceNotFoundException
Removes a managed object from the Object Repository. This method is to be used only for unregistering a singleton, that is, only one instance of that class is permitted within the repository for a given domain.
Specified by:
unregister in interface MoRepSrvIf
Parameters:
object - managed object to remove from the Object Repository
Throws:
InstanceNotFoundException - Object not found in repository.

getObject

public java.util.Vector getObject(ObjectName name,
                                  QueryExp query)
Get handles on managed objects controlled by the Object Repository.
Specified by:
getObject in interface MoRepSrvIf
Parameters:
name - name of the managed object.
query - query to apply when selecting objects.
Returns:
The list of selected managed objects is returned.

getClassVersion

public static java.lang.String getClassVersion()
Returns the version of this class.

getNbElements

public java.lang.Integer getNbElements()
Returns the number of elements stored in the Object Repository.
Specified by:
getNbElements in interface MoRepSrvIf

getDomain

public java.lang.String getDomain()
Gets the domain name associated with the Object Repository.
Specified by:
getDomain in interface MoRepSrvIf

setDomain

public void setDomain(java.lang.String domain)
Sets the domain name associated with the Object Repository.
Specified by:
setDomain in interface MoRepSrvIf