All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.jaw.impl.agent.services.persistent.PersistentRepSrv
java.lang.Object
|
+----com.sun.jaw.impl.agent.services.light.RepositorySrv
|
+----com.sun.jaw.impl.agent.services.persistent.PersistentRepSrv
- public class PersistentRepSrv
- extends RepositorySrv
- implements MoRepSrvIf, ResolveLoaderIf
This class provides an implementation of a persistent repository.
The repository contains a mixture of volatile and persistent m-beans.
The repository stores volatile m-beans in memory.
It stores persistent m-beans in a flat-file database.
The framework should be the first object to register with the repository,
enabling the synchronization of m-beans with the current framework.
To enable framework synchronization the repository has to be a trusted
class. i.e. It must be loaded by the premordial(system) classloader.
Each persistent m-bean is stored as a serialized Java object.
For each persistent m-bean, the repository stores:
- The object name of the m-bean
- The serialized m-bean
- The object name of the class loader that loaded the m-bean when it
was instantiated
The repository stores the object name of the class loader to enable it
to locate the class loader when an agent deserializes the m-bean. To locate
a class loader, the repository internally invokes these methods:
Note - Use the setConfig method to
configure the repository before trying to register any m-beans with it.
- See Also:
- MoRepSrvIf, ObjectInputStream, ObjectOutputStream, Serializable, Externalizable
-
PersistentRepSrv()
- Default constructor.
-
contains(Object)
- Verifies whether a singleton m-bean is registered with the
repository.
-
contains(ObjectName)
- Verifies whether an m-bean is registered with the repository.
-
getDomain()
- Gets the domain of the repository.
-
getNbElements()
- Gets the number of m-beans registered with the repository.
-
getObject(ObjectName, QueryExp)
- Gets handles on m-beans controlled by the repository.
-
isPersistent()
- Indicates whether the repository offers persistent storage.
-
isQuerySrv()
- Indicates whether the repository supports filtering.
-
register(Object, ObjectName)
- Invoked by the core management framework to register a volatile m-bean
with the repository.
-
registerDB(Object, ObjectName)
- Invoked by the core management framework to register a persistent
m-bean with the repository.
-
resolveClassLoader(ObjectName)
- Gets the class loader associated with an m-bean that is being
deserialized.
-
retrieve(ObjectName)
- Retrieves an m-bean from the repository.
-
retrieveClassLoaderName(ClassLoader)
- Gets the object name of a class loader.
-
setConfig(Vector)
- Configures the repository and starts the database.
-
setDomain(String)
- Sets the domain of the repository.
-
stop()
- Stop the repository and release allocated resources.
-
unregister(Object)
- Removes a singleton m-bean from the repository.
-
unregister(ObjectName)
- Removes an m-bean from the repository.
-
update(Object, ObjectName)
- Updates an m-bean registered with the repository.
PersistentRepSrv
public PersistentRepSrv()
- Default constructor.
setConfig
public void setConfig(Vector params)
- Configures the repository and starts the database.
The configuration parameters must be specified in the following order:
- The base directory of the database.
By default it is the current directory of the agent.
- The name of the database. The repository creates a directory with
this name in the base directory. The file that contains the database
is written to the directory created.
The name of the database is
default.db by default.
All parameters are String objects or null
if not specified.
If the parameter vector is empty or null, default values are
used.
- Parameters:
- params - A vector containing the configuration parameters
of the repository.
- Overrides:
- setConfig in class RepositorySrv
isQuerySrv
public boolean isQuerySrv()
- Indicates whether the repository supports filtering.
If the repository does not support filtering,
the core management framework will perform filtering
for the repository.
- Returns:
- True if the filtering is supported, false otherwise.
- Overrides:
- isQuerySrv in class RepositorySrv
isPersistent
public boolean isPersistent()
- Indicates whether the repository offers persistent storage.
- Returns:
- True if the repository offers persistent storage, false otherwise.
- Overrides:
- isPersistent in class RepositorySrv
contains
public boolean contains(ObjectName name)
- Verifies whether an m-bean is registered with the repository.
- Parameters:
- name - The object name of the m-bean.
- Returns:
- True if the m-bean is registered with the repository, false
otherwise.
- Overrides:
- contains in class RepositorySrv
retrieve
public Object retrieve(ObjectName name)
- Retrieves an m-bean from the repository.
- Parameters:
- name - The object name of the m-bean to be retrieved.
- Returns:
- The retrieved m-bean, or null if it could not be retrieved.
- Overrides:
- retrieve in class RepositorySrv
contains
public boolean contains(Object object)
- Verifies whether a singleton m-bean is registered with the
repository. A singleton m-bean has no
search key in its object name and is, therefore, the only instance of the
class permitted in the domain.
- Parameters:
- object - The m-bean.
- Returns:
- True if the m-bean is registered with the repository,
false otherwise.
- Overrides:
- contains in class RepositorySrv
registerDB
public void registerDB(Object object,
ObjectName name) throws InstanceAlreadyExistException
- Invoked by the core management framework to register a persistent
m-bean with the repository.
- Parameters:
- object - The m-bean to be registered.
- name - The object name with which the m-bean is
to be registered.
- Throws: InstanceAlreadyExistException
- The m-bean is already
registered in the object repository.
- Overrides:
- registerDB in class RepositorySrv
register
public void register(Object object,
ObjectName name) throws InstanceAlreadyExistException
- Invoked by the core management framework to register a volatile m-bean
with the repository.
- Parameters:
- object - The m-bean to be registered.
- name - The object name with which the m-bean is
to be registered.
- Throws: InstanceAlreadyExistException
- The m-bean is already
registered in the repository.
- Overrides:
- register in class RepositorySrv
update
public void update(Object object,
ObjectName name) throws InstanceNotFoundException
- Updates an m-bean registered with the repository.
- Parameters:
- object - The new instance of the m-bean.
- name - The object name of the m-bean to be updated.
- Throws: InstanceNotFoundException
- The specified m-bean was not
found in the repository.
- Overrides:
- update in class RepositorySrv
unregister
public void unregister(ObjectName name) throws InstanceNotFoundException
- Removes an m-bean from the repository.
- Parameters:
- name - The object name of the m-bean to be removed.
- Throws: InstanceNotFoundException
- The specified m-bean was not
found in the repository.
- Overrides:
- unregister in class RepositorySrv
unregister
public void unregister(Object object) throws InstanceNotFoundException
- Removes a singleton m-bean from the repository. A singleton
m-bean has no search key in its object name and is, therefore, the
only instance of the class permitted in the domain.
- Parameters:
- object - The m-bean to be removed from the repository.
- Throws: InstanceNotFoundException
- The specified m-bean was not
found in the repository.
- Overrides:
- unregister in class RepositorySrv
getObject
public Vector getObject(ObjectName name,
QueryExp query)
- Gets handles on m-beans controlled by the repository.
- Parameters:
- name - An object name that specifies the m-beans to be
selected.
- query - A query to be applied to the selected m-beans.
- Returns:
- A list of
named objects
corresponding to the selected m-beans.
- Overrides:
- getObject in class RepositorySrv
getNbElements
public Integer getNbElements()
- Gets the number of m-beans registered with the repository.
- Returns:
- The number of m-beans registered with the repository.
- Overrides:
- getNbElements in class RepositorySrv
getDomain
public String getDomain()
- Gets the domain of the repository.
- Returns:
- The domain of the repository.
- Overrides:
- getDomain in class RepositorySrv
setDomain
public void setDomain(String domain)
- Sets the domain of the repository.
- Overrides:
- setDomain in class RepositorySrv
resolveClassLoader
public ClassLoader resolveClassLoader(ObjectName aloader)
- Gets the class loader associated with an m-bean that is being
deserialized. It is the class loader that loaded the m-bean when it was
instantiated. The repository internally invokes this method when
the m-bean is deserialized. The method searches the repository to find the
class loader.
- Parameters:
- aloader - The object name of the class loader.
- Returns:
- The required class loader, or null if the class loader could not
be retrieved.
retrieveClassLoaderName
public ObjectName retrieveClassLoaderName(ClassLoader loader)
- Gets the object name of a class loader. The repository internally invokes
this method when an m-bean is deserialized. The method analyzes the
specified loader to find the method
getLoaderName with
the following signature:
ObjectName getLoaderName()
The getLoaderName method found is invoked
with no parameters and returns the object name of
the class loader.
- Parameters:
- loader - The class loader.
- Returns:
- The object name of the class loader, or null if the object
name could not be retrieved.
stop
public void stop()
- Stop the repository and release allocated resources.
All Packages Class Hierarchy This Package Previous Next Index