wt.admin
Class AdministrativeDomainManagerEvent

java.lang.Object
  extended bywt.events.KeyedEvent
      extended bywt.admin.AdministrativeDomainManagerEvent
All Implemented Interfaces:
Serializable

public class AdministrativeDomainManagerEvent
extends KeyedEvent
implements Serializable

AdministrativeDomainManagerEvent encapsulates the events posted by an AdministrativeDomainManager. Currently, the possible event types are:

  1. PRE_CHANGE_DOMAIN
  2. POST_CHANGE_DOMAIN

In addition to the usual event target object, or target objects for the multi-object variant of the event, AdministrativeDomainManagerEvent events also contain a domain reference (domain_ref), or domain references for the multi-object variant. The domain_ref has different meanings for the different AdministrativeDomainManagerEvent event types. For PRE_CHANGE_DOMAIN types, domain_ref is the domain reference for the domain that the DomainAdministered object is being moved to. For POST_CHANGE_DOMAIN types domain_ref is the domain reference for the domain that the object was moved from.

Event target objects are expected to be DomainAdministered objects.

For multi-object events it is assumed there is a one-to-one correspondence between target objects in the targets collection and domain references in the domain_refs collection. The first domain_ref corresponds to the first target, the second domain_ref corresponds to the second target, and so on. This means the number of domain references in the domain_refs collection must be the same as the number of event target objects. The one exception is that when creating an event object instead of a collection of domain references you can specify a single domain reference. In this case the single domain reference applies to all target objects.

For multi-object events you can access the event targets and the domain_refs collections in one of two ways. The first is to get the collection of event targets or the collection of domain_refs and iterate over the collections. Use the super.getEventTarget() method to get the targets collection and the getDomainRefs() method to get the domain_refs collection. The second is to use convenience methods that allow you to get target objects or domain_refs by specifying an index. There are also convenience methods to get the sizes of the collections.

Supported API: true

Extendable: false

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
private  boolean commitChange
           
private  WTList domainRefs
           
private  int domainRefsSize
           
private  int eventTargetsSize
           
static String POST_CHANGE_DOMAIN
          Constant containing the event type for the POST_CHANGE_DOMAIN event.
static String PRE_CHANGE_DOMAIN
          Constant containing the event type for the PRE_CHANGE_DOMAIN event.
private static String RESOURCE
           
 
Fields inherited from class wt.events.KeyedEvent
 
Constructor Summary
AdministrativeDomainManagerEvent(AdministrativeDomainManager mgr, String evnt, Object tgt, AdminDomainRef domain_ref, boolean commit)
          Deprecated.  
AdministrativeDomainManagerEvent(String evnt, Object tgt, AdminDomainRef domain_ref, boolean commit)
          Event constructor for domain change events.
AdministrativeDomainManagerEvent(String evnt, WTList targets, AdminDomainRef domain_ref, boolean commit)
          Event constructor for multi-object domain change events.
AdministrativeDomainManagerEvent(String evnt, WTList targets, WTList domain_refs, boolean commit)
          Event constructor for multi-object domain change events.
 
Method Summary
static String generateEventKey(String event_type)
          Helper method that generates the event key from the event type and the issuing manager.
 AdminDomainRef getDomainRef()
          Convenience method meant to be used primarily for single object AdministrativeDomainManagerEvent events.
 AdminDomainRef getDomainRef(int index)
          Convience method to be used with multi-object AdministrativeDomainManagerEvent events.
 WTList getDomainRefs()
          Gets the value of the attribute: domainRefs.
 int getDomainRefsSize()
          Returns the size of the domain references collection.
 Object getEventTarget(int index)
          Convience method to be used with multi-object AdministrativeDomainManagerEvent events.
 int getEventTargetsSize()
          Returns the size of the event target objects collection.
 boolean isChangeCommitted()
          Returns true if the change of domain is persisted in the database; false otherwise.
 void setDomainRefs(WTList a_DomainRefs)
          Sets the value of the attribute: domainRefs.
 KeyedEvent toMultiObjectEvent()
          Converts a single object AdministrativeDomainManagerEvent event into a multi-object AdministrativeDomainManagerEvent event.
 KeyedEvent[] toSingleObjectEvents()
          Converts a mutli-object AdministrativeDomainManagerEvent event into multiple single object AdministrativeDomainManagerEvent events.
 
Methods inherited from class wt.events.KeyedEvent
generateEventKey, generateEventKey, getConceptualClassname, getEventKey, getEventTarget, getEventType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

commitChange

private boolean commitChange

PRE_CHANGE_DOMAIN

public static final String PRE_CHANGE_DOMAIN
Constant containing the event type for the PRE_CHANGE_DOMAIN event.

Supported API: false

See Also:
Constant Field Values

POST_CHANGE_DOMAIN

public static final String POST_CHANGE_DOMAIN
Constant containing the event type for the POST_CHANGE_DOMAIN event.

Supported API: false

See Also:
Constant Field Values

domainRefs

private WTList domainRefs

domainRefsSize

private int domainRefsSize

eventTargetsSize

private int eventTargetsSize
Constructor Detail

AdministrativeDomainManagerEvent

public AdministrativeDomainManagerEvent(String evnt,
                                        Object tgt,
                                        AdminDomainRef domain_ref,
                                        boolean commit)
                                 throws WTException
Event constructor for domain change events. The domain change event signals a change of the administrative domain to which a DomainAdministered object belongs. On a PRE_CHANGE_DOMAIN event domain_ref is the domain to which the DomainAdministered object is being moved. On a POST_CHANGE_DOMAIN event domain_ref is the domain that the object was moved from. The commit value is true if the change of domain is persisted in the database by the AdministrativeDomainManager; false otherwise.

Supported API: true

Parameters:
evnt - the type of the event
tgt - The DomainAdministered object that is the target of the event. If tgt is null, a WTInvalidParameterException is thrown.
domain_ref - A domain reference associated with the DomainAdministered object. If domain_ref is null, a WTInvalidParameterException is thrown.
commit - commit status
Throws:
WTException

AdministrativeDomainManagerEvent

public AdministrativeDomainManagerEvent(AdministrativeDomainManager mgr,
                                        String evnt,
                                        Object tgt,
                                        AdminDomainRef domain_ref,
                                        boolean commit)
                                 throws WTException
Deprecated.  

Event constructor for domain change events. The domain change event signals a change of the administrative domain to which a DomainAdministered object belongs. On a PRE_CHANGE_DOMAIN event domain_ref is the domain to which the DomainAdministered object is being moved. On a POST_CHANGE_DOMAIN event domain_ref is the domain that the object was moved from. The commit value is true if the change of domain is persisted in the database by the AdministrativeDomainManager; false otherwise.

Supported API: true

Parameters:
mgr - the AdministrativeDomainManager service that issued the event
evnt - the type of the event
tgt - The DomainAdministered object that is the target of the event. If tgt is null, a WTInvalidParameterException is thrown.
domain_ref - A domain reference associated with the DomainAdministered object. If domain_ref is null, a WTInvalidParameterException is thrown.
commit - commit status
Throws:
WTException

AdministrativeDomainManagerEvent

public AdministrativeDomainManagerEvent(String evnt,
                                        WTList targets,
                                        AdminDomainRef domain_ref,
                                        boolean commit)
                                 throws WTException
Event constructor for multi-object domain change events. The domain change event signals a change of the administrative domain to which one or more DomainAdministered objects belong. On a PRE_CHANGE_DOMAIN event domain_ref is the domain to which the DomainAdministered objects are being moved. On a POST_CHANGE_DOMAIN event domain_ref is the domain that the objects were moved from.

targets is expected to be a collection of one or more DomainAdministered objects. If the targets collection is null or empty, a WTInvalidParameterException is thrown.

domain_ref is the domain reference that applies to each target object. If the domain_ref is null, a WTInvalidParameterException is thrown.

The commit value is true if the change of domain is persisted in the database by the AdministrativeDomainManager; false otherwise.

Supported API: true

Parameters:
evnt - the type of the event
targets - Collection of DomainAdministered objects that are the targets of this event.
domain_ref - The domain reference associated with each DomainAdministered object in the targets collection.
commit - commit status
Throws:
WTException

AdministrativeDomainManagerEvent

public AdministrativeDomainManagerEvent(String evnt,
                                        WTList targets,
                                        WTList domain_refs,
                                        boolean commit)
                                 throws WTException
Event constructor for multi-object domain change events. The domain change event signals a change of the administrative domain to which one or more DomainAdministered objects belong. On a PRE_CHANGE_DOMAIN event the domain references in the domain_refs collection are the domains the target DomainAdministered objects are being moved to. On a POST_CHANGE_DOMAIN event the domain references in the domain_refs collection are the domains that the target objects were moved from.

targets is expected to be a collection of one or more DomainAdministered objects. If the targets collection is null or empty, a WTInvalidParameterException is thrown.

domain_refs is a collection of one or more AdminDomainRef objects. The number of AdminDomainRef objects in the collection has to be either one OR the same as the number of objects in the targets collection. If the collection has only one AdminDomainRef object, this AdminDomainRef applies to all target objects in the targets collection; otherwise, the first AdminDomainRef in the collection corresponds to the first target object in the targets collection, the second AdminDomainRef corresponds to the second target object, and so on. If the domain_refs collection is null, empty, or not the correct size, a WTInvalidParameterException is thrown.

The commit value is true if the change of domain is persisted in the database by the AdministrativeDomainManager; false otherwise.

Supported API: true

Parameters:
evnt - the type of the event
targets - Collection of DomainAdministered objects that are the targets of this event.
domain_refs - Collection of AdminDomainRefs associated with the corresponding DomainAdministered objects in the targets collection.
commit - commit status
Throws:
WTException
Method Detail

getDomainRefs

public WTList getDomainRefs()
Gets the value of the attribute: domainRefs.

Supported API: false

Returns:
WTList

setDomainRefs

public void setDomainRefs(WTList a_DomainRefs)
                   throws WTPropertyVetoException
Sets the value of the attribute: domainRefs.

Supported API: false

Parameters:
a_DomainRefs -
Throws:
WTPropertyVetoException

generateEventKey

public static String generateEventKey(String event_type)
Helper method that generates the event key from the event type and the issuing manager.

Supported API: true

Parameters:
event_type -
Returns:
String

getDomainRef

public AdminDomainRef getDomainRef()
Convenience method meant to be used primarily for single object AdministrativeDomainManagerEvent events.

For single object events this method returns the AdminDomainRef associated with the event.

For multi-object events this method can be used to get the AdminDomainRef associated with the event for the case where there is a single AdminDomainRef that applies to all target objects of the multi-object event. If this method is called for multi-object events that have more than one AdminDomainRef, null is returned. For this case either iterate over the domain_refs collection or use the getDomainRef(int index) method instead.

Supported API: true

Returns:
AdminDomainRef

getDomainRef

public AdminDomainRef getDomainRef(int index)
Convience method to be used with multi-object AdministrativeDomainManagerEvent events.

Returns an AdminDomainRef from the collection of AdminDomainRefs specified by the index parameter. The first element in the collection is index 0. If the input index is out of range, null is returned.

Supported API: true

Parameters:
index -
Returns:
AdminDomainRef

getDomainRefsSize

public int getDomainRefsSize()
Returns the size of the domain references collection. For single object events if the domain reference is not null, 1 is returned. For both multi-object and single object events if the domain reference is null, 0 is returned.

Supported API: true

Returns:
int

getEventTarget

public Object getEventTarget(int index)
Convience method to be used with multi-object AdministrativeDomainManagerEvent events.

Returns an event target object from the collection of target objects specified by the index parameter. The first element in the collection is index 0. If the input index is out of range or this is a single object event, null is returned.

Supported API: true

Parameters:
index -
Returns:
Object

getEventTargetsSize

public int getEventTargetsSize()
Returns the size of the event target objects collection. For single object events if the event target is not null, 1 is returned. For both multi-object and single object events if the target object is null, 0 is returned.

Supported API: true

Returns:
int

isChangeCommitted

public boolean isChangeCommitted()
Returns true if the change of domain is persisted in the database; false otherwise.

Supported API: true

Returns:
boolean

toMultiObjectEvent

public KeyedEvent toMultiObjectEvent()
Converts a single object AdministrativeDomainManagerEvent event into a multi-object AdministrativeDomainManagerEvent event. If the AdministrativeDomainManagerEvent constructor throws an exception, null is returned.

Supported API: false

Overrides:
toMultiObjectEvent in class KeyedEvent
Returns:
KeyedEvent

toSingleObjectEvents

public KeyedEvent[] toSingleObjectEvents()
                                  throws WTException
Converts a mutli-object AdministrativeDomainManagerEvent event into multiple single object AdministrativeDomainManagerEvent events. One single object event is created for each target object in the multi-object event targets collection.

Supported API: false

Overrides:
toSingleObjectEvents in class KeyedEvent
Returns:
KeyedEvent[]
Throws:
WTException