All Packages Class Hierarchy This Package Previous Next Index
Class examples.jdbc.JDBCRepositorySrv
java.lang.Object
|
+----examples.jdbc.JDBCRepositorySrv
- public class JDBCRepositorySrv
- extends Object
- implements MoRepSrvIf
This class provides an implementation of an object repository.
The repository contains a mixture of volatile and persistent m-beans.
The repository stores volatile m-beans in memory and persistent m-beans in
a database. The database is accessed through the JDBC API.
M-beans are stored in domain tables. The M-bean state is stored through
serialization. Domain tables are registered with a registry table,
that manages the different domain tables.
The repository synchronize m-beans with the current framework. To enable
m-bean synchronization the framework should be the first object to register
with the repository and objects should not mark fields that reference the
framework with the transient keyword.
- See Also:
- MoRepSrvIf, RegistryTable, DomainTable, SerializationConvertion
-
JDBCRepositorySrv()
- 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.
-
retrieve(ObjectName)
- Retrieves an m-bean from the repository.
-
setConfig(Vector)
- Configures the repository.
-
setDomain(String)
- Sets the domain of the repository.
-
stop()
- Stop the repository and terminates the connection to the database.
-
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.
JDBCRepositorySrv
public JDBCRepositorySrv()
- Default constructor.
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.
isPersistent
public boolean isPersistent()
- Indicates whether the repository offers persistent storage.
- Returns:
- True if the repository offers persistent storage, false otherwise.
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.
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.
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.
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.
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.
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.
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.
unregister
public void unregister(Object obj) 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.
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.
getNbElements
public Integer getNbElements()
- Gets the number of m-beans registered with the repository.
- Returns:
- The number of m-beans registered with the repository.
getDomain
public String getDomain()
- Gets the domain of the repository.
- Returns:
- The domain of the repository.
setDomain
public void setDomain(String domain)
- Sets the domain of the repository.
setConfig
public void setConfig(Vector params)
- Configures the repository.
The configuration parameters must be specified in the following order:
- The JDBC driver name.(Mandatory)
- The JDBC database connection URL.(Mandatory)
- The database user on whose behalf the connection is made.(Optional)
- The user password.(Optional)
Configures the repository as follows:
- Loads the JDBC driver.
- Establish a database connection with auto commit enabled.
- Create the main registry table.
NOTE: The repository must be configured before it can be used.
- Parameters:
- params - A vector containing the configuration parameters
of the repository.
stop
public void stop()
- Stop the repository and terminates the connection to the database.
All Packages Class Hierarchy This Package Previous Next Index