atg.deployment.common.event
Class DeploymentEvent

java.lang.Object
  extended by atg.deployment.common.event.DeploymentEvent

public class DeploymentEvent
extends java.lang.Object

A deployment event denoting the change in state of a deployment or a deployment agent.

Deployment events are generic in structure and are keyed off of a set of state codes defined as constants in the event. Each time a deployment or deployment agent changes state, a deployment event is fired with relevant information.

DeploymentEvents also provide the ability to interrupt the deployment process. If a DeploymentEventListener receives a deployment event and needs to halt the deployment process, the listener can call interrupt() on the deployment event. Interrupted deployments are treated the same as if an error occurred during the deployment process.

See Also:
DeploymentEventSender, DeploymentEventListener

Field Summary
static int BEGIN_ACTIVATE
           
static int BEGIN_APPLY
           
static int BEGIN_APPLY_COMMITTED
           
static int BEGIN_CREATE
           
static int BEGIN_INSTALL
           
static int BEGIN_LOAD
           
static int BEGIN_LOCK
           
static int BEGIN_PREPARE
           
static int BEGIN_STOP
           
static java.lang.String CLASS_VERSION
          Class version string
static int DEPLOYMENT_COMPLETE
           
static int DEPLOYMENT_DELETED
           
static int DONE_ACTIVATE
           
static int DONE_APPLY
           
static int DONE_CREATE
           
static int DONE_INSTALL
           
static int DONE_LOAD
           
static int DONE_LOCK
           
static int DONE_PREPARE
           
static int DONE_STOP
           
static int ERROR
           
static int ERROR_ACTIVATE
           
static int ERROR_APPLY
           
static int ERROR_APPLY_COMMITTED
           
static int ERROR_CREATE
           
static int ERROR_INSTALL
           
static int ERROR_LOAD
           
static int ERROR_LOCK
           
static int ERROR_PREPARE
           
static int ERROR_STOP
           
static int EVENT_INTERRUPT
           
static int IDLE
           
 
Constructor Summary
DeploymentEvent(DeploymentEventSender pSender, ApplicationLogging pLog)
          Constructs an uninitialized event.
 
Method Summary
 java.util.Map getAffectedItemTypes()
           
 long getDeploymentBeginTimestamp()
          System milliseconds when the deployment was first started.
 java.lang.String getDeploymentCreateInitiator()
          A generic identifier denoting who or what created/started the deployment.
 java.lang.String getDeploymentDeleteInitiator()
          A generic identifier denoting who or what deleted the deployment.
 java.lang.String getDeploymentID()
          The ID of the current deployment, if there is a current deployment.
 long getDeploymentLastBeginTimestamp()
          System milliseconds when the deployment was last started.
 long getDeploymentLastExecutionTime()
          The time in milliseconds the deployment has spent running since it was last started.
 int getDeploymentMode()
          The deployment mode, either Constants.MODE_ONLINE or Constants.MODE_SWITCH.
 java.lang.String[] getDeploymentProjectIDs()
          The project IDs being deployed to the target or agent.
 java.lang.String getDeploymentServer()
          Name of the deployment server performing the current deployment.
 java.lang.String getDeploymentStopInitiator()
          A generic identifier denoting who or what stopped/interrupted the deployment.
 int getDeploymentStrictFileOps()
           
 int getDeploymentStrictRepoOps()
           
 long getDeploymentTotalExecutionTime()
          The time in milliseconds the deployment has spent running.
 int getDeploymentType()
          The deployment type, either Constants.TYPE_INCREMENTAL or Constants.TYPE_FULL.
 java.lang.Throwable getErrorCausedByException()
          The Exception that caused the error state, if an Exception did so.
 java.lang.String getErrorMessage()
          A textual description of what caused the error status, if the state is an error state.
 java.lang.String getErrorMessage(java.util.Locale pLocale)
          A textual description of what caused the error status, if the status is an error state.
 java.lang.Object[] getErrorMsgResourceArguments()
          Resource string arguments used to fill in and create the error message.
 java.lang.String getErrorMsgResourceKey()
          The resource look-up key for the error message.
 java.lang.String getInterruptCaller()
          Who is interrupting this event, if it is interrupted.
 java.lang.String getInterruptReason()
          Why this event is being interrupted, if it is being interrupted.
 int getNewState()
          The new state that caused this event to fire.
 long getNewStateTimestamp()
          System milliseconds when the new state was set.
 int getOldState()
          The old state before this event was fired.
 java.lang.String getTarget()
          The logical target associated with the event, either a deployment target or an individual target agent.
 boolean interrupt(java.lang.String pCaller, java.lang.String pReason)
          Deployment events get sent on every state change during deployment.
 boolean isDeploymentRevert()
          Returns property deploymentRevert.
 boolean isDeploymentRollback()
          Whether or not the deployment has been flagged for rollback.
 boolean isDeploymentScheduled()
          Whether or not this deployment was kicked off automatically from a schedule.
 boolean isInterruptable()
          Whether or not the new state causing this event can be interrupted.
 boolean isInterrupted()
          Whether or not this event has been interrupted.
 void prepareForFiring()
          Prepares the event for firing.
 void setAffectedItemTypes(java.util.Map pAffectedItemTypes)
           
 void setDeploymentBeginTimestamp(long pDeploymentBeginTimestamp)
          System milliseconds when the deployment was first started.
 void setDeploymentCreateInitiator(java.lang.String pDeploymentCreateInitiator)
          A generic identifier denoting who or what created/started the deployment.
 void setDeploymentDeleteInitiator(java.lang.String pDeploymentDeleteInitiator)
          A generic identifier denoting who or what deleted the deployment.
 void setDeploymentID(java.lang.String pDeploymentID)
          The ID of the current deployment, if there is a current deployment.
 void setDeploymentLastBeginTimestamp(long pDeploymentLastBeginTimestamp)
          System milliseconds when the deployment was last started.
 void setDeploymentLastExecutionTime(long pDeploymentLastExecutionTime)
          The time in milliseconds the deployment has spent running since it was last started.
 void setDeploymentMode(int pDeploymentMode)
          The deployment mode, either Constants.MODE_ONLINE or Constants.MODE_SWITCH.
 void setDeploymentProjectIDs(java.lang.String[] pDeploymentProjectIDs)
          The project IDs being deployed to the target or agent.
 void setDeploymentRevert(boolean pDeploymentRevert)
          Sets property deploymentRevert.
 void setDeploymentRollback(boolean pDeploymentRollback)
          Whether or not the deployment has been flagged for rollback.
 void setDeploymentScheduled(boolean pDeploymentScheduled)
          Whether or not this deployment was kicked off automatically from a schedule.
 void setDeploymentServer(java.lang.String pDeploymentServer)
          Name of the deployment server performing the current deployment.
 void setDeploymentStopInitiator(java.lang.String pDeploymentStopInitiator)
          A generic identifier denoting who or what stopped/interrupted the deployment.
 void setDeploymentStrictFileOps(int pDeploymentStrictFileOps)
           
 void setDeploymentStrictRepoOps(int pDeploymentStrictRepoOps)
           
 void setDeploymentTotalExecutionTime(long pDeploymentTotalExecutionTime)
          The time in milliseconds the deployment has spent running.
 void setDeploymentType(int pDeploymentType)
          The deployment type, either Constants.TYPE_INCREMENTAL or Constants.TYPE_FULL.
 void setErrorCausedByException(java.lang.Throwable pErrorCausedByException)
          The Exception that caused the error state, if an Exception did so.
 void setErrorMsgResourceArguments(java.lang.Object[] pErrorMsgResourceArguments)
          Resource string arguments used to fill in and create the error message.
 void setErrorMsgResourceKey(java.lang.String pErrorMsgResourceKey)
          The resource look-up key for the error message.
 void setInterruptable(boolean pInterruptable)
          Whether or not the new state causing this event can be interrupted.
 void setInterruptCaller(java.lang.String pInterruptCaller)
          Who is interrupting this event, if it is interrupted.
 void setInterrupted(boolean pInterrupted)
          Whether or not this event has been interrupted.
 void setInterruptReason(java.lang.String pInterruptReason)
          Why this event is being interrupted, if it is being interrupted.
 void setNewState(int pNewState)
          The new state that caused this event to fire.
 void setNewStateTimestamp(long pNewStateTimestamp)
          System milliseconds when the new state was set.
 void setOldState(int pOldState)
          The old state before this event was fired.
 void setTarget(java.lang.String pTarget)
          The logical target associated with the event, either a deployment target or an individual target agent.
static java.lang.String stateToString(int pStateCode)
          Returns a string form of the state code, useful for listeners who may want to turn the event into a customized, readable format.
static int stringToState(java.lang.String pStateString)
          Returns a int form of the state string, useful for listeners who may want to take a string input instead of an integer which can be easily misconfigured.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


IDLE

public static final int IDLE
See Also:
Constant Field Values

DEPLOYMENT_COMPLETE

public static final int DEPLOYMENT_COMPLETE
See Also:
Constant Field Values

DEPLOYMENT_DELETED

public static final int DEPLOYMENT_DELETED
See Also:
Constant Field Values

EVENT_INTERRUPT

public static final int EVENT_INTERRUPT
See Also:
Constant Field Values

ERROR

public static final int ERROR
See Also:
Constant Field Values

BEGIN_LOCK

public static final int BEGIN_LOCK
See Also:
Constant Field Values

DONE_LOCK

public static final int DONE_LOCK
See Also:
Constant Field Values

ERROR_LOCK

public static final int ERROR_LOCK
See Also:
Constant Field Values

BEGIN_PREPARE

public static final int BEGIN_PREPARE
See Also:
Constant Field Values

DONE_PREPARE

public static final int DONE_PREPARE
See Also:
Constant Field Values

ERROR_PREPARE

public static final int ERROR_PREPARE
See Also:
Constant Field Values

BEGIN_CREATE

public static final int BEGIN_CREATE
See Also:
Constant Field Values

DONE_CREATE

public static final int DONE_CREATE
See Also:
Constant Field Values

ERROR_CREATE

public static final int ERROR_CREATE
See Also:
Constant Field Values

BEGIN_INSTALL

public static final int BEGIN_INSTALL
See Also:
Constant Field Values

DONE_INSTALL

public static final int DONE_INSTALL
See Also:
Constant Field Values

ERROR_INSTALL

public static final int ERROR_INSTALL
See Also:
Constant Field Values

BEGIN_LOAD

public static final int BEGIN_LOAD
See Also:
Constant Field Values

DONE_LOAD

public static final int DONE_LOAD
See Also:
Constant Field Values

ERROR_LOAD

public static final int ERROR_LOAD
See Also:
Constant Field Values

BEGIN_APPLY

public static final int BEGIN_APPLY
See Also:
Constant Field Values

BEGIN_APPLY_COMMITTED

public static final int BEGIN_APPLY_COMMITTED
See Also:
Constant Field Values

DONE_APPLY

public static final int DONE_APPLY
See Also:
Constant Field Values

ERROR_APPLY

public static final int ERROR_APPLY
See Also:
Constant Field Values

ERROR_APPLY_COMMITTED

public static final int ERROR_APPLY_COMMITTED
See Also:
Constant Field Values

BEGIN_ACTIVATE

public static final int BEGIN_ACTIVATE
See Also:
Constant Field Values

DONE_ACTIVATE

public static final int DONE_ACTIVATE
See Also:
Constant Field Values

ERROR_ACTIVATE

public static final int ERROR_ACTIVATE
See Also:
Constant Field Values

BEGIN_STOP

public static final int BEGIN_STOP
See Also:
Constant Field Values

DONE_STOP

public static final int DONE_STOP
See Also:
Constant Field Values

ERROR_STOP

public static final int ERROR_STOP
See Also:
Constant Field Values
Constructor Detail

DeploymentEvent

public DeploymentEvent(DeploymentEventSender pSender,
                       ApplicationLogging pLog)
Constructs an uninitialized event. A logging interface must be included when the event is created however.

Method Detail

setOldState

public void setOldState(int pOldState)
The old state before this event was fired.


getOldState

public int getOldState()
The old state before this event was fired.

Returns:
int

setNewState

public void setNewState(int pNewState)
The new state that caused this event to fire.


getNewState

public int getNewState()
The new state that caused this event to fire.

Returns:
int

setNewStateTimestamp

public void setNewStateTimestamp(long pNewStateTimestamp)
System milliseconds when the new state was set.


getNewStateTimestamp

public long getNewStateTimestamp()
System milliseconds when the new state was set.

Returns:
long

getErrorMessage

public java.lang.String getErrorMessage()
A textual description of what caused the error status, if the state is an error state.

Returns:
String

getErrorMessage

public java.lang.String getErrorMessage(java.util.Locale pLocale)
A textual description of what caused the error status, if the status is an error state.

Returns:
String

setErrorMsgResourceKey

public void setErrorMsgResourceKey(java.lang.String pErrorMsgResourceKey)
The resource look-up key for the error message.

All of deployment uses the same ResouceBundle and so no bundle is ever specified here.


getErrorMsgResourceKey

public java.lang.String getErrorMsgResourceKey()
The resource look-up key for the error message.

All of deployment uses the same ResouceBundle and so no bundle is ever specified here.

Returns:
String

setErrorMsgResourceArguments

public void setErrorMsgResourceArguments(java.lang.Object[] pErrorMsgResourceArguments)
Resource string arguments used to fill in and create the error message.


getErrorMsgResourceArguments

public java.lang.Object[] getErrorMsgResourceArguments()
Resource string arguments used to fill in and create the error message.

Returns:
Object[]

setErrorCausedByException

public void setErrorCausedByException(java.lang.Throwable pErrorCausedByException)
The Exception that caused the error state, if an Exception did so. Note that this Exception may have been thrown on an agent rather than locally on the server.


getErrorCausedByException

public java.lang.Throwable getErrorCausedByException()
The Exception that caused the error state, if an Exception did so. Note that this Exception may have been thrown on an agent rather than locally on the server.

Returns:
Exception

setInterruptable

public void setInterruptable(boolean pInterruptable)
Whether or not the new state causing this event can be interrupted.


isInterruptable

public boolean isInterruptable()
Whether or not the new state causing this event can be interrupted.

Returns:
boolean

setInterrupted

public void setInterrupted(boolean pInterrupted)
Whether or not this event has been interrupted.


isInterrupted

public boolean isInterrupted()
Whether or not this event has been interrupted.

Returns:
boolean

setInterruptCaller

public void setInterruptCaller(java.lang.String pInterruptCaller)
Who is interrupting this event, if it is interrupted.


getInterruptCaller

public java.lang.String getInterruptCaller()
Who is interrupting this event, if it is interrupted.

Returns:
String

setInterruptReason

public void setInterruptReason(java.lang.String pInterruptReason)
Why this event is being interrupted, if it is being interrupted.


getInterruptReason

public java.lang.String getInterruptReason()
Why this event is being interrupted, if it is being interrupted.

Returns:
String

setTarget

public void setTarget(java.lang.String pTarget)
The logical target associated with the event, either a deployment target or an individual target agent.


getTarget

public java.lang.String getTarget()
The logical target associated with the event, either a deployment target or an individual target agent.

Returns:
String

setDeploymentID

public void setDeploymentID(java.lang.String pDeploymentID)
The ID of the current deployment, if there is a current deployment.


getDeploymentID

public java.lang.String getDeploymentID()
The ID of the current deployment, if there is a current deployment.

Returns:
String

setDeploymentBeginTimestamp

public void setDeploymentBeginTimestamp(long pDeploymentBeginTimestamp)
System milliseconds when the deployment was first started.


getDeploymentBeginTimestamp

public long getDeploymentBeginTimestamp()
System milliseconds when the deployment was first started.


setDeploymentLastBeginTimestamp

public void setDeploymentLastBeginTimestamp(long pDeploymentLastBeginTimestamp)
System milliseconds when the deployment was last started.

Parameters:
pDeploymentLastBeginTimestamp - new value to set

getDeploymentLastBeginTimestamp

public long getDeploymentLastBeginTimestamp()
System milliseconds when the deployment was last started.

Returns:
long

setDeploymentLastExecutionTime

public void setDeploymentLastExecutionTime(long pDeploymentLastExecutionTime)
The time in milliseconds the deployment has spent running since it was last started. Note that deployment stop automatically on errors.

Parameters:
pDeploymentLastExecutionTime - new value to set

getDeploymentLastExecutionTime

public long getDeploymentLastExecutionTime()
The time in milliseconds the deployment has spent running since it was last started. Note that deployment stop automatically on errors.

Returns:
long

setDeploymentTotalExecutionTime

public void setDeploymentTotalExecutionTime(long pDeploymentTotalExecutionTime)
The time in milliseconds the deployment has spent running. Note that deployment stop automatically on errors.

Parameters:
pDeploymentTotalExecutionTime - new value to set

getDeploymentTotalExecutionTime

public long getDeploymentTotalExecutionTime()
The time in milliseconds the deployment has spent running. Note that deployment stop automatically on errors.

Returns:
long

setDeploymentProjectIDs

public void setDeploymentProjectIDs(java.lang.String[] pDeploymentProjectIDs)
The project IDs being deployed to the target or agent. All events fired by the deployment server will have this value. Only events fired by the deployment agent after the prepare phase will have this value.


getDeploymentProjectIDs

public java.lang.String[] getDeploymentProjectIDs()
The project IDs being deployed to the target or agent.

Returns:
String[]

setDeploymentType

public void setDeploymentType(int pDeploymentType)
The deployment type, either Constants.TYPE_INCREMENTAL or Constants.TYPE_FULL.


getDeploymentType

public int getDeploymentType()
The deployment type, either Constants.TYPE_INCREMENTAL or Constants.TYPE_FULL.

Returns:
int

setDeploymentMode

public void setDeploymentMode(int pDeploymentMode)
The deployment mode, either Constants.MODE_ONLINE or Constants.MODE_SWITCH.


getDeploymentMode

public int getDeploymentMode()
The deployment mode, either Constants.MODE_ONLINE or Constants.MODE_SWITCH.

Returns:
int

setDeploymentRevert

public void setDeploymentRevert(boolean pDeploymentRevert)
Sets property deploymentRevert.
Whether or not this is a special deployment reverting an open Project off of the Target.


isDeploymentRevert

public boolean isDeploymentRevert()
Returns property deploymentRevert.
Whether or not this is a special deployment reverting an open Project off of the Target.

Returns:
boolean

setDeploymentRollback

public void setDeploymentRollback(boolean pDeploymentRollback)
Whether or not the deployment has been flagged for rollback.


isDeploymentRollback

public boolean isDeploymentRollback()
Whether or not the deployment has been flagged for rollback.

Returns:
boolean

setDeploymentServer

public void setDeploymentServer(java.lang.String pDeploymentServer)
Name of the deployment server performing the current deployment.


getDeploymentServer

public java.lang.String getDeploymentServer()
Name of the deployment server performing the current deployment.

Returns:
String

setDeploymentScheduled

public void setDeploymentScheduled(boolean pDeploymentScheduled)
Whether or not this deployment was kicked off automatically from a schedule.


isDeploymentScheduled

public boolean isDeploymentScheduled()
Whether or not this deployment was kicked off automatically from a schedule.

Returns:
boolean

setDeploymentCreateInitiator

public void setDeploymentCreateInitiator(java.lang.String pDeploymentCreateInitiator)
A generic identifier denoting who or what created/started the deployment.


getDeploymentCreateInitiator

public java.lang.String getDeploymentCreateInitiator()
A generic identifier denoting who or what created/started the deployment.

Returns:
String

setDeploymentStopInitiator

public void setDeploymentStopInitiator(java.lang.String pDeploymentStopInitiator)
A generic identifier denoting who or what stopped/interrupted the deployment.


getDeploymentStopInitiator

public java.lang.String getDeploymentStopInitiator()
A generic identifier denoting who or what stopped/interrupted the deployment.

Returns:
String

setDeploymentDeleteInitiator

public void setDeploymentDeleteInitiator(java.lang.String pDeploymentDeleteInitiator)
A generic identifier denoting who or what deleted the deployment.


getDeploymentDeleteInitiator

public java.lang.String getDeploymentDeleteInitiator()
A generic identifier denoting who or what deleted the deployment.

Returns:
String

getDeploymentStrictFileOps

public int getDeploymentStrictFileOps()

setDeploymentStrictFileOps

public void setDeploymentStrictFileOps(int pDeploymentStrictFileOps)

getDeploymentStrictRepoOps

public int getDeploymentStrictRepoOps()

setDeploymentStrictRepoOps

public void setDeploymentStrictRepoOps(int pDeploymentStrictRepoOps)

getAffectedItemTypes

public java.util.Map getAffectedItemTypes()

setAffectedItemTypes

public void setAffectedItemTypes(java.util.Map pAffectedItemTypes)

prepareForFiring

public void prepareForFiring()
Prepares the event for firing.

Fired events are shared amongst event listeners and are therefore made immutable so that listeners cannot change the information the events hold.


interrupt

public boolean interrupt(java.lang.String pCaller,
                         java.lang.String pReason)
Deployment events get sent on every state change during deployment. If a DeploymentEventListener needs to stop the deployment for any reason, interrupt() should be called on the event. This interrupt will stop the deployment.

However, the deployment cannot be interrupted if either the deployment has advanced past the point of interruption or is entering an uninterruptable state, such as an error state. The property 'isInterruptable' can be checked to see if the current event can interrupt the deployment. Calling interrupt() when isInterruptable() returns false will result in no interrupt and the interrupt() method returning false.

Parameters:
pCaller - an identifier for who is interrupting the deployment
pReason - a description of why the deployment is being interrupted
Returns:
true if the deployment will be interrupted
false if the deployment cannot be interrupted

stateToString

public static java.lang.String stateToString(int pStateCode)
Returns a string form of the state code, useful for listeners who may want to turn the event into a customized, readable format.

Parameters:
pStateCode - one of the constant state codes in DeploymentEvent
Returns:
String form of constant state code name

stringToState

public static int stringToState(java.lang.String pStateString)
Returns a int form of the state string, useful for listeners who may want to take a string input instead of an integer which can be easily misconfigured.

Parameters:
pStateString - one of the constant state codes in DeploymentEvent
Returns:
String form of constant state code name