wt.inf.container
Class DefaultWTOrganizationValidator

java.lang.Object
  extended bywt.inf.container.DefaultWTOrganizationValidator
All Implemented Interfaces:
WTOrganizationValidator

public class DefaultWTOrganizationValidator
extends Object
implements WTOrganizationValidator

Provides a final template implementation of validate.

Supported API: true

Extendable: true


Field Summary
private static String CLASSNAME
           
private static boolean DEBUG
           
private static DebugWriter LOG
           
private static Vector READ_PERM
           
private static String RESOURCE
           
private static String WTGROUP_NAME
           
private static String WTORG_NAME
           
private static String WTUSER_NAME
           
 
Constructor Summary
DefaultWTOrganizationValidator()
           
 
Method Summary
protected  AdminDomainRef createDomain(WTOrganization organization, Object requestor)
          Creates a new AdministrativeDomain for the organization, if neccessary.
protected  void createPolicies(WTOrganization organization, Object requestor)
          Creates the policy rules for domains created by #createValidDomain(WTOrganization,Object).
protected  void finalizeValidation(WTOrganization organization, Object requestor)
          Provides subclasses a last opportunity to do any additional work before the validate method completes.
protected  WTOrganization getOrganization(Object requestor)
          Gets either an existing WTOrganization that corresponds to the requestor, or instantiates a new one.
 WTOrganization validate(Object requestor)
          Template method for organization validation.
protected  boolean validateAttributes(WTOrganization organization, Object requestor)
          Ensures the organization's attributes are appropriately set up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

DEBUG

private static final boolean DEBUG

LOG

private static final DebugWriter LOG

READ_PERM

private static final Vector READ_PERM

WTUSER_NAME

private static final String WTUSER_NAME

WTGROUP_NAME

private static final String WTGROUP_NAME

WTORG_NAME

private static final String WTORG_NAME
Constructor Detail

DefaultWTOrganizationValidator

public DefaultWTOrganizationValidator()
Method Detail

validate

public final WTOrganization validate(Object requestor)
                              throws WTException
Template method for organization validation. The template has the following steps.
  1. Gets either an existing or new instance of an organization by calling getOrganization(Object).
  2. Checks to see if a new domain needs to be created for the organization by calling createDomain(WTOrganization,Object)
  3. Passes the instance to validateAttributes(WTOrganization,Object)
  4. If a non-null domain was returned by createDomain, then assigns the domain to the organization.
  5. If the instance is new, then calls OrganizationServicesManager.createPrincipal. If the instance already existed, and validateAttributes returned true, calls OrganizationServicesManager.updatePrincipal instead.
  6. If a non-null domain was returned by createDomain, then calls createPolicies(WTOrganization,Object)
  7. Calls finalizeValidation(WTOrganization,Object)


Supported API: true

Specified by:
validate in interface WTOrganizationValidator
Parameters:
requestor -
Returns:
WTOrganization
Throws:
WTException
See Also:
WTOrganizationValidator.validate(Object), DirectoryHelperSvr

createDomain

protected AdminDomainRef createDomain(WTOrganization organization,
                                      Object requestor)
                               throws WTException
Creates a new AdministrativeDomain for the organization, if neccessary. If the organization is not in either the global USER or UNAFFILIATED domain, then a new domain is not created for it and nullis returned. Otherwise, a new domain is created using the name generated by WTContainerServiceSvr.getUnusedDomainName(String,AdminDomainRef).

Supported API: true

Parameters:
organization -
requestor -
Returns:
A reference to the new domain or null.
Throws:
WTException

createPolicies

protected void createPolicies(WTOrganization organization,
                              Object requestor)
                       throws WTException
Creates the policy rules for domains created by #createValidDomain(WTOrganization,Object). This method will only be called if createValidDomain returns a non-null result.

The default implementation gives members of the organization READ access to users and groups in the domain.

Supported API: true

Parameters:
organization -
requestor -
Throws:
WTException

finalizeValidation

protected void finalizeValidation(WTOrganization organization,
                                  Object requestor)
                           throws WTException
Provides subclasses a last opportunity to do any additional work before the validate method completes. The default implementation does nothing.

Supported API: true

Parameters:
organization -
requestor -
Throws:
WTException

getOrganization

protected WTOrganization getOrganization(Object requestor)
                                  throws WTException
Gets either an existing WTOrganization that corresponds to the requestor, or instantiates a new one.

Supported API: true

Parameters:
requestor -
Returns:
WTOrganization
Throws:
WTException

validateAttributes

protected boolean validateAttributes(WTOrganization organization,
                                     Object requestor)
                              throws WTException
Ensures the organization's attributes are appropriately set up. The default implementation assigns the organization an internet domain (if it was null) using DirectoryHelperSvr.generateInternetDomain(WTOrganization).

Subclasses should typically call super.validateAttributes when overriding this method.

Supported API: true

Parameters:
organization -
requestor -
Returns:
A boolean indicating whether the attributes of the organization were modified. This is used to determine whether OrganizationServicesManager.updatePrincipal needs to be called on an organization that is already persisted.
Throws:
WTException