|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
wt.util.RMIServer
wt.cache.CacheManager
wt.admin.cache.AdminDomainCache
Provides methods to access cached domains, domain names, and domain paths.
It is important to remember to perform any necessary access checks on objects
retrieved from this cache as none of the methods in this class do so. It is
also important to call isStale
before invoking any methods of this
class. If the cache is stale then any objects returned from the cache may be
invalid until the current transaction completes.
AdminDomainCache
is a subclass of CacheManager
in order
to communicate updates to cached data between multiple method servers. It does
not store its cached data in the CacheManager
cache.
Supported API: false
Extendable: false
Nested Class Summary | |
private static class |
AdminDomainCache.CacheUpdaterContainer
Helper class for calling the methods of CacheUpdater on all the
contained instances of CacheUpdater . |
static class |
AdminDomainCache.Server
Defines the remote method that is invoked by main in order to
report the current contents of this cache. |
Field Summary | |
private AdminDomainCache.CacheUpdaterContainer |
caches
|
private static AdminDomainCache |
domainCache
|
(package private) DomainHierarchy |
domainHierarchy
|
private static Object |
IS_STALE
Constant used as the key into the MethodContext where a boolean
flag is set that indicates that the AdminDomainCache contains stale
data for the duration of the current transaction. |
private static Object |
lock
|
Fields inherited from class wt.cache.CacheManager |
MASTER |
Fields inherited from class wt.util.RMIServer |
csf, ssf |
Fields inherited from class java.rmi.server.RemoteServer |
|
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Fields inherited from interface wt.cache.CacheServer |
versionID |
Constructor Summary | |
AdminDomainCache()
Do not directly invoke this constructor! Use getAdminDomainCache instead. |
Method Summary | |
private void |
clearStaleFlag()
Clears a boolean flag in the MethodContext that indicates that
the AdminDomainCache contains stale data for the current transaction |
static AdminDomainCache |
getAdminDomainCache()
Accessor method to obtain the single instance of the AdminDomainCache |
Vector |
getAncestorDomains(ObjectIdentifier oid)
Gets the ObjectIdentifiers of the ancestor domains for the given domain. |
ObjectIdentifier |
getChildDomain(ObjectIdentifier parent_oid,
String child_name,
WTContainerRef child_container_ref)
Gets the ObjectIdentifier of a named domain given the ObjectIdentifier
of its parent domain. |
int |
getDefaultSize()
Overrides CacheManager.getDefaultSize to return 0 since no objects
will be put into the wt.util.Cache object contained in CacheManager |
Vector |
getDescendentDomains(ObjectIdentifier oid)
Gets the ObjectIdentifiers of the descendent domains for the given domain. |
AdministrativeDomain |
getDomain(ObjectIdentifier oid)
Gets the AdministrativeDomain with the given ObjectIdentifier . |
AdministrativeDomain |
getDomain(String path,
WTContainerRef containerRef)
Gets the AdministrativeDomain with the given path relative
to the given container . |
String |
getDomainName(ObjectIdentifier domain)
Gets the name of the AdministrativeDomain with the given
ObjectIdentifier . |
ObjectIdentifier |
getDomainOID(String path,
WTContainerRef containerRef)
Gets the ObjectIdentifier of the domain specified by path which resides in the
specified container |
ObjectIdentifier |
getParentDomain(ObjectIdentifier child_oid)
Gets the ObjectIdentifier of a parent domain given the ObjectIdentifier
of a child domain. |
String |
getPathOfDomain(AdministrativeDomain domain)
Gets the path of the domain. |
private void |
initialize()
Initializes the attributes of this class |
boolean |
isStale()
Indicates if the contents of the AdminDomainCache have been changed at some
point during the current transaction. |
static void |
main(String[] args)
Reports the current contents of this cache. |
void |
putEntry(Object key,
Object value)
Overrides CacheManager.putEntry to do nothing so that entries
are not added to the wt.util.Cache object contained in CacheManager |
private void |
registerEventListeners()
Defines and registers event listeners used to update the AdminDomainCache
in response to persistent changes to cached data. |
protected void |
removeEntry(Object a_msg)
Decodes an UpdateMessage and then invokes the correct method
on each CacheUpdater , passing in the arguments to the method |
void |
report(File file)
Creates a report that shows the contents of the AdminDomainCache . |
void |
reset()
Reinitializes the AdminDomainCache in the event that communication
between CacheManagers was interrupted for some reason in which case
UpdateMessages may have been lost, invalidating the cache contents. |
private void |
setStaleFlag()
Sets a boolean flag in the MethodContext that indicates that
the AdminDomainCache contains stale data for the current transaction |
private static void |
signalRemoteCaches(UpdateMessage msg)
Signals all other instances of this AdminDomainCache
(running in other method servers typically) of an update to the cache |
Methods inherited from class wt.cache.CacheManager |
checkAccess, get, getDefaultName, getEntry, isCacheHost, overflow, ping, put, putEntry, reference, registerSlave, remove, remove, removeEntry, unreferenced, update, updateEntry, updateEntry |
Methods inherited from class wt.util.RMIServer |
clone, exportObject, exportObject, exportObject, getClientSocketFactory, getPort, getServerSocketFactory, getStub, isHostInList, isLocalHost, setPort, writeReplace |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
private AdminDomainCache.CacheUpdaterContainer caches
private static AdminDomainCache domainCache
private static Object lock
private static final Object IS_STALE
MethodContext
where a boolean
flag is set that indicates that the AdminDomainCache
contains stale
data for the duration of the current transaction.
DomainHierarchy domainHierarchy
Constructor Detail |
public AdminDomainCache() throws RemoteException
getAdminDomainCache
instead.
The constructor is public so that the ServerManager can create an instance of this
class for use as the master cache.
However, since the master cache is only being used to signal slave caches, we don't want to construct the internal cache object (DomainHierarchy) in the master cache as it is a waste of time and memory.
Method Detail |
public static AdminDomainCache getAdminDomainCache() throws RemoteException, WTException
AdminDomainCache
AdminDomainCache
RemoteException
- if an error occurs registering this cache with a remote server
WTException
- if a low level error occurspublic ObjectIdentifier getParentDomain(ObjectIdentifier child_oid) throws WTException
ObjectIdentifier
of a parent domain given the ObjectIdentifier
of a child domain.
child_oid
- an ObjectIdentifier
for a child domain
ObjectIdentifier
of the child's parent domain
WTException
- if a low level error occurspublic ObjectIdentifier getChildDomain(ObjectIdentifier parent_oid, String child_name, WTContainerRef child_container_ref) throws WTException
ObjectIdentifier
of a named domain given the ObjectIdentifier
of its parent domain.
parent_oid
- the ObjectIdentifier
of the parent domainchild_name
- the name of the child domainchild_container_ref
- the reference for the container the child domain resides in
ObjectIdentifier
of the child domain; returns null if the
domain does not exist
WTException
- if a low level error occurspublic Vector getAncestorDomains(ObjectIdentifier oid) throws WTException
ObjectIdentifiers
of the ancestor domains for the given domain.
oid
- the ObjectIdentifier
of the domain
ObjectIdentifiers
of the ancestor domains
for the given domain
WTException
- if a low level error occurspublic Vector getDescendentDomains(ObjectIdentifier oid) throws WTException
ObjectIdentifiers
of the descendent domains for the given domain.
oid
- the ObjectIdentifier
of the domain
ObjectIdentifiers
of the descendent domains
for the given domain
WTException
- if a low level error occurspublic ObjectIdentifier getDomainOID(String path, WTContainerRef containerRef) throws WTException
ObjectIdentifier
of the domain specified by path which resides in the
specified container
path
- the path of the domaincontainerRef
- reference to the container where domain resides
ObjectIdentifiers
of the domain
WTException
- if a low level error occurspublic String getPathOfDomain(AdministrativeDomain domain) throws WTException
domain
- AdministrativeDomain
object
WTException
- if a low level error occurspublic AdministrativeDomain getDomain(ObjectIdentifier oid) throws WTException
AdministrativeDomain
with the given ObjectIdentifier
.
oid
- an ObjectIdentifier
for a AdministrativeDomain
AdministrativeDomain
object, else null
if the
AdministrativeDomain
doesn't exist
WTException
- if a low level error occurspublic AdministrativeDomain getDomain(String path, WTContainerRef containerRef) throws WTException
AdministrativeDomain
with the given path
relative
to the given container
.
path
- a path
for an AdministrativeDomain
containerRef
- the container reference for the Container the path is relative to.
AdministrativeDomain
object, else null
if the
AdministrativeDomain
doesn't exist
WTException
- if a low level error occurspublic String getDomainName(ObjectIdentifier domain) throws WTException, ObjectNoLongerExistsException
AdministrativeDomain
with the given
ObjectIdentifier
.
domain
- an ObjectIdentifier
for a domain
domain's
name
ObjectNoLongerExistsException
- if the requested domain is not found in the database
WTException
- if a low level error occurspublic void putEntry(Object key, Object value)
CacheManager.putEntry
to do nothing so that entries
are not added to the wt.util.Cache
object contained in CacheManager
putEntry
in class CacheManager
key
- the key objectvalue
- the value objectpublic int getDefaultSize()
CacheManager.getDefaultSize
to return 0 since no objects
will be put into the wt.util.Cache
object contained in CacheManager
getDefaultSize
in class CacheManager
public void reset() throws RemoteException
AdminDomainCache
in the event that communication
between CacheManagers
was interrupted for some reason in which case
UpdateMessages
may have been lost, invalidating the cache contents.
reset
in class CacheManager
RemoteException
protected void removeEntry(Object a_msg)
UpdateMessage
and then invokes the correct method
on each CacheUpdater
, passing in the arguments to the method
removeEntry
in class CacheManager
a_msg
- an UpdateMessage
objectprivate static void signalRemoteCaches(UpdateMessage msg)
AdminDomainCache
(running in other method servers typically) of an update to the cache
msg
- a message object that encodes what method (along with its args)
to invoke on a remote cache in order to update itpublic boolean isStale()
AdminDomainCache
have been changed at some
point during the current transaction. If a client implements a transaction that changes
the persistent state of objects managed by this cache, before accessing objects in the
cache it should call this method. If this method returns true
then the cache
is stale and the client must not use the cached data because it is not guaranteed to be
accurate until the current transaction completes.
true
if this cache has already been updated
in the current transaction, otherwise false
private void registerEventListeners()
AdminDomainCache
in response to persistent changes to cached data. Each event listener in turn
creates and registers a TransactionListener
that does the actual
work in the notifyCommit
method.
TransactionListener
public void report(File file) throws IOException
AdminDomainCache
.
Used for debugging purposes only.
file
- the file to save the report to
IOException
public static void main(String[] args)
private void setStaleFlag()
MethodContext
that indicates that
the AdminDomainCache
contains stale data for the current transaction
private void clearStaleFlag()
MethodContext
that indicates that
the AdminDomainCache
contains stale data for the current transaction
private void initialize() throws WTException
WTException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |