wt.inf.container
Class OrganizationCache

java.lang.Object
  extended bywt.inf.container.OrganizationCache

final class OrganizationCache
extends Object

Maintains a cache of internet domain names to WTOrganizations, and a cache of WTOrganizations to OrgContainers. Also handles file-based overrides of the internet domain to container mapping.

Supported API: false

Extendable: false


Nested Class Summary
static class OrganizationCache.DomainToOrgMessenger
           
private static class OrganizationCache.ExchangeInfo
          Stores the exchange's internet domain and oid JVM Ensures thread-safe lazy initialization
static class OrganizationCache.OrgToContainerMessenger
           
private static class OrganizationCache.RemotePlaceholder
          A utility class that allows the cache to signal whether a remote call is necessary when an object is added to the local cache
private static class OrganizationCache.Singleton
          JVM ensures thread-safe lazy initialization of instance
 
Field Summary
private static String CLASSNAME
           
private static boolean DEBUG
           
(package private)  DirtyMap domainToOrg
          Maps internet domain to organization oid
(package private)  OrganizationCache.DomainToOrgMessenger domainToOrgMessenger
           
(package private)  Map domainToPath
          Maps internet domain to container path, and vice versa
private static String EVENTS
           
private static String EXCHANGE_PATH
           
private static DebugWriter LOG
           
(package private) static String MAPPING_FILE
           
(package private)  DirtyMap orgToContainer
          Maps organization oid to container oid
(package private)  OrganizationCache.OrgToContainerMessenger orgToContainerMessenger
           
(package private)  Map pathToDomain
          Maps internet domain to container path, and vice versa
private static String RESOURCE
           
 
Constructor Summary
private OrganizationCache()
           
 
Method Summary
private  void addListeners()
           
 String[] getAllInternetDomains(WTContainerRef ref)
           
 WTContainerRef getByInternetDomain(String internet_domain)
           
private  WTContainerRef getByInternetDomainFromDirectory(String internet_domain)
          Find the mapping for the given internet domain.
private  WTContainerRef getByInternetDomainFromFile(String internet_domain)
          See if the file mappings contain an entry for the given internet domain
private  WTContainerRef getContainerRef(ObjectIdentifier oid)
           
 String getExchangeDomain()
           
private  ObjectIdentifier getId(ObjectReference ref)
           
private  ObjectIdentifier getId(Persistable obj)
           
(package private) static OrganizationCache getInstance()
           
 String getInternetDomain(WTContainerRef ref)
           
 WTContainerRef getOrgContainer(WTOrganization org)
           
 WTContainerRef getOrgContainer(WTPrincipalReference org)
           
private  WTPrincipalReference getPrincipalRef(ObjectIdentifier oid)
           
(package private)  boolean isExchangeOrganization(WTOrganization org)
           
private  boolean isExchangeOrganization(WTPrincipalReference org)
           
private  boolean isSourceOfExchangeDomain(WTOrganization org)
          Determine if the organization is where the exchange container's internet domain is derived form.
private  boolean isSourceOfExchangeDomain(WTPrincipalReference org_ref)
           
private  void loadFile()
          Loads overrides from file (by default internetDomain.properties) Called from the thread-safe constructor
private  void postChangeIdentity(OrgContainer container, WTContainerIdentity old_identity)
           
private  void postCreate(OrgContainer container)
           
private  void postModify(WTOrganization org)
           
(package private)  void putOverride(String internet_domain, String container_path)
          WARNING: This method does not ensure thread-safety
private  void removeFromCache(WTOrganization org)
           
(package private)  void removeOverride(String internet_domain)
          WARNING: This method does not ensure thread-safety
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSNAME

private static final String CLASSNAME

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

DEBUG

private static final boolean DEBUG

LOG

private static final DebugWriter LOG

EVENTS

private static final String EVENTS
See Also:
Constant Field Values

EXCHANGE_PATH

private static final String EXCHANGE_PATH
See Also:
Constant Field Values

MAPPING_FILE

static final String MAPPING_FILE

domainToOrg

DirtyMap domainToOrg
Maps internet domain to organization oid


domainToOrgMessenger

OrganizationCache.DomainToOrgMessenger domainToOrgMessenger

orgToContainer

DirtyMap orgToContainer
Maps organization oid to container oid


orgToContainerMessenger

OrganizationCache.OrgToContainerMessenger orgToContainerMessenger

domainToPath

Map domainToPath
Maps internet domain to container path, and vice versa


pathToDomain

Map pathToDomain
Maps internet domain to container path, and vice versa

Constructor Detail

OrganizationCache

private OrganizationCache()
                   throws WTException
Method Detail

getInstance

static OrganizationCache getInstance()
                              throws WTException
Throws:
WTException

getByInternetDomain

public WTContainerRef getByInternetDomain(String internet_domain)
                                   throws WTException
Throws:
WTException

getByInternetDomainFromFile

private WTContainerRef getByInternetDomainFromFile(String internet_domain)
                                            throws WTException
See if the file mappings contain an entry for the given internet domain

Throws:
WTException

getByInternetDomainFromDirectory

private WTContainerRef getByInternetDomainFromDirectory(String internet_domain)
                                                 throws WTException
Find the mapping for the given internet domain. If there is no cached mapping, query LDAP for it. If there is a cached mapping, make sure it is still in sync with LDAP.

Throws:
WTException

getInternetDomain

public String getInternetDomain(WTContainerRef ref)
                         throws WTException
Throws:
WTException

getAllInternetDomains

public String[] getAllInternetDomains(WTContainerRef ref)
                               throws WTException
Throws:
WTException

getExchangeDomain

public String getExchangeDomain()
                         throws WTException
Throws:
WTException

getOrgContainer

public WTContainerRef getOrgContainer(WTOrganization org)
                               throws WTException
Throws:
WTException

getOrgContainer

public WTContainerRef getOrgContainer(WTPrincipalReference org)
                               throws WTException
Throws:
WTException

putOverride

void putOverride(String internet_domain,
                 String container_path)
WARNING: This method does not ensure thread-safety


removeOverride

void removeOverride(String internet_domain)
WARNING: This method does not ensure thread-safety


loadFile

private void loadFile()
               throws WTException
Loads overrides from file (by default internetDomain.properties) Called from the thread-safe constructor

Throws:
WTException

addListeners

private void addListeners()

postCreate

private void postCreate(OrgContainer container)
                 throws WTException
Throws:
WTException

postModify

private void postModify(WTOrganization org)
                 throws WTException
Throws:
WTException

postChangeIdentity

private void postChangeIdentity(OrgContainer container,
                                WTContainerIdentity old_identity)
                         throws WTException
Throws:
WTException

removeFromCache

private void removeFromCache(WTOrganization org)
                      throws WTException
Throws:
WTException

getId

private ObjectIdentifier getId(ObjectReference ref)

getId

private ObjectIdentifier getId(Persistable obj)

getContainerRef

private WTContainerRef getContainerRef(ObjectIdentifier oid)
                                throws WTException
Throws:
WTException

getPrincipalRef

private WTPrincipalReference getPrincipalRef(ObjectIdentifier oid)
                                      throws WTException
Throws:
WTException

isExchangeOrganization

boolean isExchangeOrganization(WTOrganization org)
                         throws WTException
Throws:
WTException

isExchangeOrganization

private boolean isExchangeOrganization(WTPrincipalReference org)
                                throws WTException
Throws:
WTException

isSourceOfExchangeDomain

private boolean isSourceOfExchangeDomain(WTOrganization org)
                                  throws WTException
Determine if the organization is where the exchange container's internet domain is derived form. This is true if the org is the exchange org, and there is not a mapping for the exchange org in internetDomain.properties This informatino is used to determine if the organization's internet domain should map to the site or the org container

Parameters:
org -
Returns:
boolean
Throws:
WTException

isSourceOfExchangeDomain

private boolean isSourceOfExchangeDomain(WTPrincipalReference org_ref)
                                  throws WTException
Throws:
WTException
See Also:
isSourceOfExchangeDomain(WTOrganization)