|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.admin.cache.DomainHierarchy
Manages a cache of AdministrativeDomains
which is used for navigating
domain hierarchies.
To limit the amount of memory consumed by cached AdministrativeDomain
objects
the property wt.admin.cache.maxDomains
in wt.properties controls the
maximum number of AdministrativeDomains
that will be cached by this class.
Field Summary | |
(package private) Cache |
ancestors
Map of AdministrativeDomain ObjectIdentifier to Vector
of ancestor AdministrativeDomain ObjectIdentifiers . |
(package private) Cache |
cachedDomains
Map of AdministrativeDomain ObjectIdentifiers to
AdministrativeDomain objects. |
private static int |
changeCount
|
(package private) Cache |
children
Map of parent AdministrativeDomain ObjectIdentifiers to Vector
of child AdministrativeDomain ObjectIdentifiers . |
(package private) Cache |
descendants
Map of AdministrativeDomain ObjectIdentifier to Vector
of descendant AdministrativeDomain ObjectIdentifiers . |
(package private) Cache |
domainNames
Map of AdministrativeDomain ObjectIdentifiers to domain names. |
(package private) Cache |
domainPaths
Map of AdministrativeDomain ObjectIdentifiers to the domain path
relative to the domain's container. |
(package private) Cache |
domainsByPath
Map of DomainPathKey to the AdministrativeDomain ObjectIdentifiers . |
private static Object |
lock
|
private static int |
MAX_DOMAINS
|
(package private) Cache |
parents
Map of child AdministrativeDomain ObjectIdentifiers to parent AdministrativeDomain ObjectIdentifiers . |
private static String |
RESOURCE
|
private static boolean |
VERBOSE
|
Constructor Summary | |
(package private) |
DomainHierarchy()
|
Method Summary | |
void |
add(AdministrativeDomain domain)
Caches a domain in response to a POST_STORE event on an AdministrativeDomain . |
private void |
addChildDomains(ObjectIdentifier oid,
Vector descendent_oids)
Builds a Vector of descendent ObjectIdentifiers for a domain
by recursively adding the child ObjectIdentifiers to the descendents
Vector . |
void |
delete(AdministrativeDomain domain)
Deletes a cached domain in response to a REMOVE event on an AdministrativeDomain . |
private String |
genDomainPathRelativeToItsContainer(AdministrativeDomain inDomain)
|
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)
Returns the ObjectIdentifier of a named domain given the ObjectIdentifier
of its parent domain. |
private Vector |
getChildDomains(ObjectIdentifier oid)
Gets the ObjectIdentifiers of child domains for the domain with the given
ObjectIdentifier . |
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_oid)
Gets the name of the AdministrativeDomain with the given
ObjectIdentifier . |
(package private) ObjectIdentifier |
getDomainOID(String domainPath,
WTContainerRef containerRef)
Gets the Domain OID for the domain specified by the input domainPath and containerRef. |
(package private) String |
getDomainPath(AdministrativeDomain inDomain)
Returns Domain Path for the input Domain object relative to the container domain resides in. |
ObjectIdentifier |
getParentDomain(ObjectIdentifier child_oid)
Gets the ObjectIdentifier of a parent domain given the ObjectIdentifier
of a child domain. |
void |
modify(AdministrativeDomain domain)
Updates the cache in response to a POST_MODIFY event on an AdministrativeDomain . |
void |
move(AdministrativeDomain domain,
AdminDomainRef old_parent,
AdminDomainRef new_parent)
Updates the cache in response to a POST_CHANGE_DOMAIN event on an AdministrativeDomain . |
private void |
pp(String msg)
|
private Vector |
queryForChildren(ObjectIdentifier oid)
Queries the database for AdministrativeDomains whose parent is the domain with the
given ObjectIdentifier . |
private AdministrativeDomain |
restoreDomain(ObjectIdentifier oid)
Gets an AdministrativeDomain from the database given an ObjectIdentifier |
void |
writeContents(OutputStream os)
Writes the contents of this cache to an OutputStream for debugging purposes |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String RESOURCE
private static int MAX_DOMAINS
private static boolean VERBOSE
private static Object lock
private static int changeCount
Cache children
Vector
of child AdministrativeDomain ObjectIdentifiers
.
The capacity of this cache is wt.admin.cache.maxDomains
Cache parents
AdministrativeDomain ObjectIdentifiers
.
The capacity of this cache is wt.admin.cache.maxDomains
Cache ancestors
AdministrativeDomain ObjectIdentifier
to Vector
of ancestor AdministrativeDomain ObjectIdentifiers
.
The capacity of this cache is wt.admin.cache.maxDomains
Cache descendants
Vector
of descendant AdministrativeDomain ObjectIdentifiers
.
The capacity of this cache is wt.admin.cache.maxDomains
Cache domainNames
AdministrativeDomain ObjectIdentifiers
to domain names.
The capacity of this cache is wt.admin.cache.maxDomains
Cache domainPaths
AdministrativeDomain ObjectIdentifiers
to the domain path
relative to the domain's container. The domain paths in this cache do NOT
include the container path.
The capacity of this cache is wt.admin.cache.maxDomains
Cache domainsByPath
DomainPathKey
to the AdministrativeDomain ObjectIdentifiers
.
The DomainPathKey
consists of the domain path and the container
reference the domain path is relative to (i.e., the domain's container reference).
The capacity of this cache is wt.admin.cache.maxDomains
Cache cachedDomains
AdministrativeDomain ObjectIdentifiers
to
AdministrativeDomain
objects.
The capacity of this cache is wt.admin.cache.maxDomains
Constructor Detail |
DomainHierarchy()
Method Detail |
public ObjectIdentifier getParentDomain(ObjectIdentifier child_oid) throws WTException
ObjectIdentifier
of a parent domain given the ObjectIdentifier
of a child domain. If the child domain's parent is not in the cache, the database is queried and
the parent is added to the cache.
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. If the desired child domain is not in the cache, the database is queried and
the child is added to the cache.
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 AdministrativeDomain getDomain(ObjectIdentifier oid) throws WTException
AdministrativeDomain
with the given ObjectIdentifier
.
If cachedDomains
doesn't contain the AdministrativeDomain
then
it is queried from the database and added to it.
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
. If cachedDomains
doesn't contain the
AdministrativeDomain
then it is queried from the database and added to it.
path
- a path
for an AdministrativeDomain
. The path
must be an unescaped domain path.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_oid) throws WTException, ObjectNoLongerExistsException
AdministrativeDomain
with the given
ObjectIdentifier
. If domainNames
doesn't contain
the name then the database is queried for the domain and the name is added to the cache.
domain's
name
ObjectNoLongerExistsException
- if the requested domain is not found in the database
WTException
- if a low level error occurspublic void add(AdministrativeDomain domain)
AdministrativeDomain
.
add
in interface CacheUpdater
domain
- a new AdministrativeDomain
public void delete(AdministrativeDomain domain)
AdministrativeDomain
.
If the deleted domain is a key in any of the caches, the entry is removed.
delete
in interface CacheUpdater
domain
- a deleted AdministrativeDomain
public void modify(AdministrativeDomain domain)
AdministrativeDomain
.
Only the cachedDomains, domainNames, domainsByPath, and domainPaths caches need to be updated.
If the parent domain for an AdministrativeDomain
is changed, a POST_CHANGE_DOMAIN
event will always be generated and will cause the other caches to be updated.
modify
in interface CacheUpdater
domain
- a modified AdministrativeDomain
public void move(AdministrativeDomain domain, AdminDomainRef old_parent, AdminDomainRef new_parent)
AdministrativeDomain
.
If the old_parent
or new_parent
is a key in children
then removes the AdministrativeDomain
being moved from the
old_parent's
children and adds it to the new_parent's
children. If the AdministrativeDomain
being moved is a key in parents
its value is set to new_parent
. If the AdministrativeDomain
being moved
is a key in domainPaths
, remove the cached paths for the domain and add the new path
to domainPaths
and domainsByPath
.
move
in interface CacheUpdater
domain
- a moved AdministrativeDomain
old_parent
- the old parent AdministrativeDomain
new_parent
- the new parent AdministrativeDomain
public void writeContents(OutputStream os) throws IOException
OutputStream
for debugging purposes
writeContents
in interface CacheUpdater
os
- an OutputStream
to write the contents of a cache to
IOException
- if there is an I/O errorprivate void addChildDomains(ObjectIdentifier oid, Vector descendent_oids) throws WTException
Vector
of descendent ObjectIdentifiers
for a domain
by recursively adding the child ObjectIdentifiers
to the descendents
Vector
.
oid
- an ObjectIdentifier
for an AdministrativeDomain
descendent_oids
- a Vector
of descendent ObjectIdentifiers
WTException
- if a low level error occursprivate Vector getChildDomains(ObjectIdentifier oid) throws WTException
ObjectIdentifiers
of child domains for the domain with the given
ObjectIdentifier
. If the child domains are not in the cache, the database
is queried and the children are added to the cache.
oid
- the ObjectIdentifier
of an AdministrativeDomain
ObjectIdentifiers
of the child domains
WTException
- if a low level error occursprivate Vector queryForChildren(ObjectIdentifier oid) throws WTException
AdministrativeDomains
whose parent is the domain with the
given ObjectIdentifier
.
oid
- the ObjectIdentifier
for an AdministrativeDomain
ObjectIdentifiers
of the child AdministrativeDomains
WTException
- if a low level error occursprivate AdministrativeDomain restoreDomain(ObjectIdentifier oid) throws WTException
AdministrativeDomain
from the database given an ObjectIdentifier
oid
- an ObjectIdentifier
for an AdministrativeDomain
AdministrativeDomain
object
ObjectNoLongerExistsException
- if the requested AdministrativeDomain
is not
found in the database
WTException
- if a low level error occursString getDomainPath(AdministrativeDomain inDomain) throws WTException
inDomain
- The AdministrativeDomain
to get the path for.
WTException
ObjectIdentifier getDomainOID(String domainPath, WTContainerRef containerRef) throws WTException
domainPath
- Required. Must be a valid, unescaped domain path. (i.e., doesn't contain [Container Path])
The path must be relative to the Container referenced by the input containerRef.containerRef
- Required. Container Reference for the container the domain resides in.
WTException
private String genDomainPathRelativeToItsContainer(AdministrativeDomain inDomain) throws WTException
WTException
private final void pp(String msg)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |