atg.deployment.server
Class Target

java.lang.Object
  extended by atg.deployment.server.Target
All Implemented Interfaces:
atg.deployment.common.Constants, atg.deployment.DeploymentConstants, java.io.Externalizable, java.io.Serializable

public class Target
extends java.lang.Object
implements atg.deployment.common.Constants, java.io.Externalizable

A simple interface for managing a deployment target and deployments to that target.

Targets are generated when the deployment topology is initialized. Instances of Targets are obtained from the DeploymentServer via the getTargets(), getTargetByName(), and getTargetByID() methods.

Two lists of the agents that make up a target are provided. The method getAgents() returns all agents that make up the target. The method getResponsibleAgents() only returns those agents that have deployment responsibilities.

The Target class is the conceptual single entity formed by the group of agents that define the target. As a whole, the Target can be queried through the following methods:

A running deployment to a target is handled through the Deployment class. Since a physical target can only receive one deployment at a time, each target manages a separate schedule and queue of deployments. Deployments of new Projects are scheduled or queued via the deployProjects() method. Temporary "back deployments" to previous deployment states are scheduled or queued via the deployPrevious() method. And in some cases, deployInitial() can be used when a target is first created or to return a target to its primordial deployment state.

Access to deployments associated with a target is available through several useful methods:

Just as a running deployment is controled through the Deployment instance directly, deployments can be removed from the target's schedule or queue by calling Deployment.delete().

A Project can be deployed to a target before it has been checked in and rendered immutable. This is a handy way of viewing a Project's changes before making them final and visible to other users to build on. If such a Project must be removed from the target, there are two methods to do so, revert() and deployRevert(). Both of these methods disassociates the Project from the target.

Some utility methods are also available but should be used carefully or not at all, as they are not considered part of the standard deployment process:

Target instances should not be cached or held onto, as a call to DeploymentServer.reinitializeTopology() will render them defunct. The DeploymentServer should always be used as the source for obtaining the current instance of a target.

See Also:
DeploymentServer, Status, Deployment, AgentRef, Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String TARGET_BRANCH_NAME_PREFIX
           
 
Fields inherited from interface atg.deployment.common.Constants
ACCEPTED_FOR_TARGET, APPLY_TRANSACTION_SIZE, APPROVED_FOR_TARGET, DEPLOYED_TO_TARGET, DEPLOYMENT_PROTOCOL_VERSION, DEPLOYMENT_TYPE_BACK_DEPLOY, DEPLOYMENT_TYPE_DEPLOY_TO_INITIAL, DEPLOYMENT_TYPE_INIT_TARGET, DEPLOYMENT_TYPE_ONE_OFF_DEPLOY, DEPLOYMENT_TYPE_REVERT_DEPLOY, DEPLOYMENT_TYPE_STANDARD_DEPLOY, DPLY_CMD_ACTIVE_APPLY_COMMITTED, DPLY_CMD_AFFECTED_TYPES, DPLY_CMD_ASSET_DESTINATIONS, DPLY_CMD_CLUSTER_ID, DPLY_CMD_COMMAND, DPLY_CMD_DATASTORES_TO_SWITCH, DPLY_CMD_DEPLOYMENT_END_TIME, DPLY_CMD_DEPLOYMENT_ID, DPLY_CMD_DEPLOYMENT_START_TIME, DPLY_CMD_EXCLUDE_ASSET, DPLY_CMD_FIRST_APPLY, DPLY_CMD_FROM_SNAPSHOT, DPLY_CMD_INCLUDE_ASSET, DPLY_CMD_INSTALL_BYTES, DPLY_CMD_INSTALL_NUM_BYTES, DPLY_CMD_MANIFEST_ID, DPLY_CMD_MODE, DPLY_CMD_ONEOFF, DPLY_CMD_PRINCIPAL, DPLY_CMD_PROJECTS, DPLY_CMD_PROTOCOL_VERSION, DPLY_CMD_RECOVERING, DPLY_CMD_REFRESH_REPOSITORIES, DPLY_CMD_RESUME, DPLY_CMD_ROLLBACK, DPLY_CMD_SCIEVENTS, DPLY_CMD_SERVER_NAME, DPLY_CMD_SET_AGENT_STATUS, DPLY_CMD_SWITCH_FIRST, DPLY_CMD_SWITCH_LIVE, DPLY_CMD_TO_SNAPSHOT, DPLY_CMD_TX_SIZE, DPLY_CMD_TYPE, DPLY_CMD_USER_ID, DPLY_CMD_VERIFY_FILE_CHECKSUM, DPLY_CMD_VERIFY_FILE_COMPONENT_PATH, DPLY_CMD_VERIFY_FILE_LAST_MODIFIED, DPLY_CMD_VERIFY_FILE_PATH, DPLY_CMD_VERIFY_FILE_SIZE, DPLY_CMD_VFS_ORDER, HIDDEN_FROM_TARGET, INIT_BRANCH_LOCK_NAME, ONE_OFF, REMOTE_SWITCH_EXCEPTION, REMOTE_SWITCH_SUCCESS, RENOUNCED_FOR_TARGET, ROLLBACK_DEPLOYMENT_FAILURE, STRICT_OP_DEFAULT, STRICT_OP_OVERRIDE_FALSE, STRICT_OP_OVERRIDE_TRUE, TARGET_INITIAL_STATE_PROJECT_ID, TOPOLOGY_AGENT_PRINCIPAL_ALL, TOPOLOGY_AGENT_PRINCIPAL_NONE, TOPOLOGY_AGENT_PRINCIPAL_REPOSITORY, TOPOLOGY_AGENT_PRINCIPAL_VFS, TOPOLOGY_DEPLOY_TYPE_ONE_OFF, TOPOLOGY_DEPLOY_TYPE_WORKFLOW, TOPOLOGY_TRANSPORT_JNDI, TOPOLOGY_TRANSPORT_RMI, WORKFLOW
 
Fields inherited from interface atg.deployment.DeploymentConstants
DEPLOYABLE_ATTRIBUTE_NAME, DEPLOYMENT_SYSTEM_VERSION, JAR_ATTR_MAN_FILE, JAR_ATTR_MAN_ID, JAR_ATTR_VERSION, MODE_ONLINE, MODE_SWITCH, PM_DEP, REFERENCES_ATTRIBUTE_NAME, TYPE_FULL, TYPE_INCREMENTAL
 
Constructor Summary
protected Target()
          Protected constructor for testing only.
 
Method Summary
 Snapshot createOrGetDeploymentSnapshot(VersionManager versionManager, Project project)
          Create a snapshot for the given project when its already deployed to this target.
 void criticalReset(java.lang.String pInitiatorID)
          Does a "hard" reset of the target and the target agents.
 Deployment deployInitial(boolean pForceDeployment, java.lang.String pInitiatorID)
          Deploys the initial state of the target.
 Deployment deployPrevious(java.lang.String pProjectID, boolean pForceFull, java.util.Calendar pDeployTime, java.lang.String pInitiatorID)
          See deployPrevious.
 Deployment deployPrevious(java.lang.String pProjectID, boolean pForceFull, java.util.Calendar pDeployTime, java.lang.String pInitiatorID, int pStrictFileOps, int pStrictRepoOps)
          Performs a "back deployment" to the Target returning it to the state when the given Project was deployed and checked-in.
 Deployment deployProjects(java.lang.String[] pProjectIDs, boolean pForceFull, java.util.Calendar pDeployTime, java.lang.String pInitiatorID)
          See deployProjects.
 Deployment deployProjects(java.lang.String[] pProjectIDs, boolean pForceFull, java.util.Calendar pDeployTime, java.lang.String pInitiatorID, int pStrictFileOps, int pStrictRepoOps)
          Deploys the specified Projects to this target.
 Deployment deployRevert(java.lang.String pProjectID, java.util.Calendar pDeployTime, java.lang.String pInitiatorID)
          Functions the same as deploy() Projects that have been checked-in cannot be reverted from a target.
 Project findProjectByDeploymentSnapshot(java.lang.String pSnapshotID)
          Can this target accept a back deployment at this time.
 AgentRef[] getAgents()
          The list of all deployment agents that make up the target.
 Status[] getAgentStatuses()
          A convenience method that queries and returns the status of each agent in the target.
 java.lang.String getClusterID()
           
 int getCountOfDeployedActiveProjects()
          Gets the count of projects merged to this target.
 int getCountOfDeployedCheckedinProjects()
          Gets the count of projects merged to this target.
 int getCountOfDeployedProjects()
          Gets the count of projects merged to this target.
 int getCountOfPendingDeployments()
          Find the count of pending(Queued and Scheduled) deployments for this targets.
 int getCountOfQueuedDeployments()
          Find the count of queued deployments for this targets
 int getCountOfScheduledDeployments()
          Find the count of pending deployments for this targets
 Deployment getCurrentDeployment()
          The current deployment for this Target.
 Status getCurrentStatus()
          Returns the current status of this Target regardless of the current cluster.
 Project[] getDeployedActiveProjects(int pStartIndex, int pCount)
          Gets the list of projects to this target.
 Project[] getDeployedCheckedinProjects(int pStartIndex, int pCount)
          Gets the list of projects to this target.
 Project[] getDeployedProjects(int pStartIndex, int pCount)
          Gets the list of projects to this target.
 java.lang.Long getDeployedSnapshotCreationTime()
          Returns the creation time (as a Long ) of the last deployed snapshot.
 java.lang.String getDescription()
          A brief description of this target, any old information that is desired.
 java.util.Map getDestinations()
          Get a Map of destination repository path or host:port names, keyed by the source repository or VFS nucleus path.
 Snapshot getEffectiveDeployedSnapshot()
          Find the snapshot that we should consider as deployed to the target this may be different than the snapshot that is installed on the target.
 java.lang.Long getEffectiveDeployedSnapshotCreationTime()
          Returns the creation time (as a Long ) of the last effectively deployed snapshot.
 java.lang.String getID()
          The repository ID of this Target.
 Project[] getInitDeployedProjects(int pStartIndex, int pCount)
          Gets the list of projects deployed to uninitialized target.
 Snapshot getInitialSnapshot()
          Get the snapshot this target was initialized with.
 java.lang.String getInstalledSnapshot()
          Returns the current snapshot on this Target by querying each target agent that has deployment responsibilities (as these are the only agents who actually maintain deployed data).
 Project getLastCheckedInDeployedProject()
          Returns the Project that was last successfully deployed to this target.
 Project getLastDeployedProject()
          Returns the Project that was last successfully deployed to this target.
 java.lang.String getName()
          The name given this target.
 Deployment getNextDeployment()
          A convenience method that returns the next logical deployment to run.
 Deployment[] getPendingDeployments(int pStartIndex, int pCount)
          Returns the list of pending Deployments as an array ordered by schedule of execution.
 Deployment[] getQueuedDeployments(int pStartIndex, int pCount)
          Returns the list of QUEUED Deployments as an array ordered by schedule of execution.
 AgentRef[] getResponsibleAgents()
          Deployment agents in this target that have deployment responsibilities.
 Deployment[] getScheduledDeployments(int pStartIndex, int pCount)
          Returns the list of SCHEDULED Deployments as an array ordered by schedule of execution.
 Status getStatus()
          Returns the status of this Target.
 Status getStatus(boolean pUseCache)
          Returns the status of this Target.
 atg.deployment.server.topology.TargetTypeEnum getType()
          Target type e.g.
 void haltQueue()
          Halts handling of pending deployments on this target.
 Status[] initializeAgents()
          Runs through the list of agent statuses and tries once again to initialize any uninitialized agent transports.
 Status[] initializeAgents(boolean pOnlyResponsibles)
          Runs through the list of agent statuses and tries once again to initialize any uninitialized agent transports.
 boolean isAccessible()
          Whether or not this target is currently accessible.
 boolean isBackDeployable()
          Can this target accept a back deployment at this time.
protected  boolean isBackDeployed()
          If this target is not current i.e.
 boolean isDeployable()
          Whether or not this target is capable of being deployed to.
 boolean isHalted()
          Whether or not this target's deployment queue is halted.
 boolean isIncrementallyDeployable()
          Whether or not this target is capable of receiving an incremental deployment or if a full deployment is necessary.
 boolean isInitialized()
          Returns whether or not this Target is currently initialized due to a Topology change.
 boolean isInitializing()
          If this target is currently initializing.
 boolean isOneOff()
          Flag indicating if this target is used for one-off deployments.
 boolean isReverseDeployment()
           
protected  Snapshot lastDeployedProjectSnapshot()
           
 void readExternal(java.io.ObjectInput in)
           
 void resumeQueue()
          Resumes handling of pending deployments on this target.
 void setClusterID(java.lang.String pClusterID)
           
 void setIsReverseDeployment(boolean pReverseDeployment)
           
 void setOneOff(boolean pOneOff)
          TODO: remove me.
 java.lang.String toString()
          Returns this Target as a String.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TARGET_BRANCH_NAME_PREFIX

public static final java.lang.String TARGET_BRANCH_NAME_PREFIX
See Also:
Constant Field Values

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

Target

protected Target()
Protected constructor for testing only.

Method Detail

getID

public java.lang.String getID()
The repository ID of this Target.


getName

public java.lang.String getName()
The name given this target.


getDescription

public java.lang.String getDescription()
A brief description of this target, any old information that is desired.


getType

public atg.deployment.server.topology.TargetTypeEnum getType()
Target type e.g. workflow, one-off.


isOneOff

public boolean isOneOff()
Flag indicating if this target is used for one-off deployments.


setOneOff

public void setOneOff(boolean pOneOff)
TODO: remove me. For testing purposes.


getAgents

public AgentRef[] getAgents()
The list of all deployment agents that make up the target. The topology rules insure this value to be non-null.


getResponsibleAgents

public AgentRef[] getResponsibleAgents()
Deployment agents in this target that have deployment responsibilities. The topology rules insure this value to be non-null.


setClusterID

public void setClusterID(java.lang.String pClusterID)
Parameters:
pClusterID -

getClusterID

public java.lang.String getClusterID()
Returns:

getInitialSnapshot

public Snapshot getInitialSnapshot()
                            throws atg.deployment.common.DeploymentException
Get the snapshot this target was initialized with. Client must check if target is initialized using isInitialized() method. Which will return false for initialized targets.

Throws:
atg.deployment.common.DeploymentException

toString

public java.lang.String toString()
Returns this Target as a String. Specifically, the String form of this Target is its name.

Overrides:
toString in class java.lang.Object

initializeAgents

public Status[] initializeAgents()
Runs through the list of agent statuses and tries once again to initialize any uninitialized agent transports.

Returns:
Status[] array of Status objects returned from each agent in matching order to the array returned from getAgents()

initializeAgents

public Status[] initializeAgents(boolean pOnlyResponsibles)
Runs through the list of agent statuses and tries once again to initialize any uninitialized agent transports.

Parameters:
pOnlyResponsibles - when set to true only agents with deployment responsibilities are initialized
Returns:
Status[] array of Status objects returned from each agent in matching order to the array returned from getAgents()

isHalted

public boolean isHalted()
                 throws atg.deployment.common.DeploymentException
Whether or not this target's deployment queue is halted.

Deployments can still be scheduled via deploy(), but no deployments will be executed automaticaly by the queue as long as the queue is halted.

Returns:
true if the target queue is halted
false if the target queue not halted
Throws:
atg.deployment.common.DeploymentException - if there is an error discerning whether or not the queue is halted (i.e. communication/repository errors)

haltQueue

public void haltQueue()
               throws atg.deployment.common.DeploymentException
Halts handling of pending deployments on this target.

Deployments can still be scheduled via deploy(), but no deployments will be executed automaticaly by the queue as long as the queue is halted.

Throws:
atg.deployment.common.DeploymentException - if there is an error restarting the queue is halted (i.e. communication/repository errors)

resumeQueue

public void resumeQueue()
                 throws atg.deployment.common.DeploymentException
Resumes handling of pending deployments on this target.

Deployments can still be scheduled via deploy(), but no deployments will be executed automaticaly by the queue as long as the queue is halted.

Throws:
atg.deployment.common.DeploymentException - if there is an error restarting the queue is halted (i.e. communication/repository errors)

isInitialized

public boolean isInitialized()
                      throws atg.deployment.common.DeploymentException
Returns whether or not this Target is currently initialized due to a Topology change. Targets cannot perform certain actions while they are uninitialized, such as execute deployments or perform reverts.

Returns:
boolean true if the Target is initialized
false if the Target is not initialized
Throws:
atg.deployment.common.DeploymentException - is anything goes wrong, reading the status from the database

isInitializing

public boolean isInitializing()
                       throws atg.deployment.common.DeploymentException
If this target is currently initializing.

Returns:
Throws:
atg.deployment.common.DeploymentException

setIsReverseDeployment

public void setIsReverseDeployment(boolean pReverseDeployment)

isReverseDeployment

public boolean isReverseDeployment()

isAccessible

public boolean isAccessible()
Whether or not this target is currently accessible. A target can become inaccessible if one or more of the target agents with deployment responsibilities reports a transport error.

Returns:
boolean true if the target is currently accessible
false if the target is currently unaccessible

isDeployable

public boolean isDeployable()
Whether or not this target is capable of being deployed to. Even if the local deployment server does not have a deployment for this target, the target still might not accept a deployment. Specifically, targets with inaccessible responsible agents or targets that are being deployed to by another server cannot be deployed to.

This method does not comment on whether or not a target can schedule or queue deployments, only whether or not a deployment can currently run against the target. Thus the usefulness of this method is limited.

Note: Calling this method will also call isAccessible() internally.

Returns:
boolean true if the target can be deployed to
false if the target cannot be deployed to

isIncrementallyDeployable

public boolean isIncrementallyDeployable()
                                  throws atg.deployment.common.DeploymentException
Whether or not this target is capable of receiving an incremental deployment or if a full deployment is necessary.

NOTE: If a required agent is inaccessible, a deployment exception is thrown rather than making this method return a potentially false negative. Whether or not an agent is required depends on whether or not the agent has deployment responsibilities and whether or not allowMissingNonEssentialAgents is true on the DeploymentServer.

Returns:
boolean true if this target can be deployed to incrementally
false if this target must have a full deployment
Throws:
atg.deployment.common.DeploymentException - if a required agent is inaccessible

isBackDeployable

public boolean isBackDeployable()
                         throws atg.deployment.common.DeploymentException
Can this target accept a back deployment at this time. A back deployment can only be performed when there are no active and deployed (to this target) projects in the system.

Returns:
true or false.
Throws:
atg.deployment.common.DeploymentException

findProjectByDeploymentSnapshot

public Project findProjectByDeploymentSnapshot(java.lang.String pSnapshotID)
                                        throws atg.deployment.common.DeploymentException
Can this target accept a back deployment at this time. A back deployment can only be performed when there are no active and deployed (to this target) projects in the system.

Returns:
true or false.
Throws:
atg.deployment.common.DeploymentException

getStatus

public Status getStatus()
Returns the status of this Target. Target status always comes from the responsible deployment agents that make up the target. With a Target being a group of agents, the "worst-case" status is returned. For example, if there are five agents that make up the target with four reporting idle and one reporting an error, the Target will return the error as the Target status.


getStatus

public Status getStatus(boolean pUseCache)
Returns the status of this Target. Target status always comes from the responsible deployment agents that make up the target. With a Target being a group of agents, the "worst-case" status is returned. For example, if there are five agents that make up the target with four reporting idle and one reporting an error, the Target will return the error as the Target status.


getCurrentStatus

public Status getCurrentStatus()
Returns the current status of this Target regardless of the current cluster. Target status always comes from the responsible deployment agents that make up the target. With a Target being a group of agents, the "worst-case" status is returned. For example, if there are five agents that make up the target with four reporting idle and one reporting an error, the Target will return the error as the Target status.


getAgentStatuses

public Status[] getAgentStatuses()
A convenience method that queries and returns the status of each agent in the target.

Returns:
Status[] array of Status objects returned from each agent in matching order to the array returned from getAgents()

getCurrentDeployment

public Deployment getCurrentDeployment()
                                throws atg.deployment.common.DeploymentException
The current deployment for this Target. Null if there is no deployment currently associated with the target.

Throws:
atg.deployment.common.DeploymentException - if there is an error accessing the deployment repository - see the wrapped exception
See Also:
atg.deployment.DeploymentException

getNextDeployment

public Deployment getNextDeployment()
                             throws atg.deployment.common.DeploymentException
A convenience method that returns the next logical deployment to run. Note that the next deployment to run may be waiting in the queue or scheduled for much later. Essentially, calling this method should be equivalent to calling getPendingDeployments(0, 1).

Returns:
Deployment the next deployment to run or null if there are no pending deployments
Throws:
atg.deployment.common.DeploymentException

getCountOfPendingDeployments

public int getCountOfPendingDeployments()
                                 throws atg.deployment.common.DeploymentException
Find the count of pending(Queued and Scheduled) deployments for this targets.

Throws:
atg.deployment.common.DeploymentException

getPendingDeployments

public Deployment[] getPendingDeployments(int pStartIndex,
                                          int pCount)
                                   throws atg.deployment.common.DeploymentException
Returns the list of pending Deployments as an array ordered by schedule of execution.

The list of pending Deployments includes scheduled Deployments whose scheduled execution time has not yet come to term as well as all Deployments that are queued for immediate execution. Each Deployment's Status indicates whether the Deployment is scheduled or waiting to run.

The list of pending Deployments does *NOT* include the current running Deployment nor any completed Deployments.

Throws:
atg.deployment.common.DeploymentException

getCountOfQueuedDeployments

public int getCountOfQueuedDeployments()
                                throws atg.deployment.common.DeploymentException
Find the count of queued deployments for this targets

Throws:
atg.deployment.common.DeploymentException

getQueuedDeployments

public Deployment[] getQueuedDeployments(int pStartIndex,
                                         int pCount)
                                  throws atg.deployment.common.DeploymentException
Returns the list of QUEUED Deployments as an array ordered by schedule of execution. Queued deployments are ones that are waiting for their turn to be executed on a target. Their deployTime has already occurred and they are possibly waiting for a deployment to finish which is ahead of them or for the target to be freed from a failed deployment.

to get a list of all pending deployments use @link getPendingDeployments()

The list of queued (@see Status.WAITING_QUEUED) deployments does *NOT* include the current running Deployment nor any completed Deployments.

Throws:
atg.deployment.common.DeploymentException

getCountOfScheduledDeployments

public int getCountOfScheduledDeployments()
                                   throws atg.deployment.common.DeploymentException
Find the count of pending deployments for this targets

Throws:
atg.deployment.common.DeploymentException

getScheduledDeployments

public Deployment[] getScheduledDeployments(int pStartIndex,
                                            int pCount)
                                     throws atg.deployment.common.DeploymentException
Returns the list of SCHEDULED Deployments as an array ordered by schedule of execution. Scheduled deployments are ones that are waiting for their turn to be executed on a target but their time of execution is in the future. Scheduled deployments become queued once the time for their execution arrives.

to get a list of all pending deployments use @link getPendingDeployments()

@see Status.WAITING_SCHEDULED

Throws:
atg.deployment.common.DeploymentException

getLastDeployedProject

public Project getLastDeployedProject()
                               throws atg.deployment.common.DeploymentException
Returns the Project that was last successfully deployed to this target. Null is returned if the target does not know which Project was deployed last.

Returns:
Project the last deployed Project or null
Throws:
atg.deployment.common.DeploymentException - if the target cannot be accessed, if there is a mis-match between agents of which project was deployed last, or if there were problems finding the Project refered to by the target

getLastCheckedInDeployedProject

public Project getLastCheckedInDeployedProject()
                                        throws atg.deployment.common.DeploymentException
Returns the Project that was last successfully deployed to this target. Null is returned if the target does not know which Project was deployed last.

Returns:
Project the last deployed Project or null
Throws:
atg.deployment.common.DeploymentException - if the target cannot be accessed, if there is a mis-match between agents of which project was deployed last, or if there were problems finding the Project refered to by the target

getCountOfDeployedProjects

public int getCountOfDeployedProjects()
                               throws atg.deployment.common.DeploymentException
Gets the count of projects merged to this target. Sorted by their merge time in descending order.

Throws:
atg.deployment.common.DeploymentException

getDeployedProjects

public Project[] getDeployedProjects(int pStartIndex,
                                     int pCount)
                              throws atg.deployment.common.DeploymentException
Gets the list of projects to this target. Sorted by their merge time in descending order.

Parameters:
pStartIndex -
pCount -
Throws:
atg.deployment.common.DeploymentException

getInitDeployedProjects

public Project[] getInitDeployedProjects(int pStartIndex,
                                         int pCount)
                                  throws atg.deployment.common.DeploymentException
Gets the list of projects deployed to uninitialized target. Sorted by their merge time in descending order.

Parameters:
pStartIndex -
pCount -
Throws:
atg.deployment.common.DeploymentException

getCountOfDeployedCheckedinProjects

public int getCountOfDeployedCheckedinProjects()
                                        throws atg.deployment.common.DeploymentException
Gets the count of projects merged to this target. Sorted by their merge time in descending order.

Throws:
atg.deployment.common.DeploymentException

getDeployedCheckedinProjects

public Project[] getDeployedCheckedinProjects(int pStartIndex,
                                              int pCount)
                                       throws atg.deployment.common.DeploymentException
Gets the list of projects to this target. Sorted by their merge time in descending order.

Parameters:
pStartIndex -
pCount -
Throws:
atg.deployment.common.DeploymentException

getCountOfDeployedActiveProjects

public int getCountOfDeployedActiveProjects()
                                     throws atg.deployment.common.DeploymentException
Gets the count of projects merged to this target. Sorted by their merge time in descending order.

Throws:
atg.deployment.common.DeploymentException

getDeployedActiveProjects

public Project[] getDeployedActiveProjects(int pStartIndex,
                                           int pCount)
                                    throws atg.deployment.common.DeploymentException
Gets the list of projects to this target. Sorted by their merge time in descending order.

Parameters:
pStartIndex -
pCount -
Throws:
atg.deployment.common.DeploymentException

getDestinations

public java.util.Map getDestinations()
                              throws atg.deployment.common.DeploymentException
Get a Map of destination repository path or host:port names, keyed by the source repository or VFS nucleus path. This is configured in the deployment UI, and is used by the DAF deployment system to configure the destination repository/VFS for a given source when creating DeploymentData objects.

Returns:
Map
Throws:
atg.deployment.common.DeploymentException

deployInitial

public Deployment deployInitial(boolean pForceDeployment,
                                java.lang.String pInitiatorID)
                         throws atg.deployment.common.DeploymentException
Deploys the initial state of the target.

When a target is first created it must be initialized properly. The method deployInitial() serves both as a means of performing this initialization as well re-deploying the targets initial state before any other deployments were made to the target.

deployInitial() is called automatically when the topology is initialized and a target is first created.

In the case where data has been exported from the target and imported into the publishing server, there may be little point in deploying the data back out to the target. Though this might be desirable just to insure that what is in the publishing server is exactly what is on the target, some may prefer another option. The parameter pForceDeployment when set to true will initialize the target on the server as normal and perform a full deployment of the data back to the target. When pForceDeployment is set to false, instead of deploying the data, the target will simply be flagged with the necessary information to appear as if a deployment had occured. This "flagging" of the target could save time by skipping an unnecessary full deployment and allowing incremental deployments as soon as the target is finished initializing.

NOTE: If this method is not called, or if the deployment scheduled by this method fails, any standard deployment of a project will also peform the necessary initializations. This method is simply provided in the case where target initializaton is desirable before any projects exist.

Parameters:
pForceDeployment - true if a deployment should be performed, false if agents should be "flagged" as deployed to
pInitiatorID - an identifying string of "who" is effectively performing this action
Returns:
Deployment a deployment object representing the new deployment
Throws:
atg.deployment.common.DeploymentException
See Also:
Deployment

deployProjects

public Deployment deployProjects(java.lang.String[] pProjectIDs,
                                 boolean pForceFull,
                                 java.util.Calendar pDeployTime,
                                 java.lang.String pInitiatorID,
                                 int pStrictFileOps,
                                 int pStrictRepoOps)
                          throws atg.deployment.common.DeploymentException
Deploys the specified Projects to this target.

Specifically, deployProjects() schedules or queues the deployment of a list of Projects. This deployment is considered a "standard" or "forward" deployment in that the Projects deployed should either be checked-in and never before deployed to this Target, not yet checked-in, or a mixture of the two. Projects that are not checked-in can be deployed and re-deployed without problem till they are checked-in. If this method is called with a project that has been checked-in and already deployed to this Target then a DeploymentException will be thrown (see deployPrevious()).

NOTE: if this method is called twice with the same valid Project, two separate deployments will be scheduled. This is okay. If the first deployment succeeds then the second one will be ignored when its deploy time is reached. This is because the deployment system knows that the second deployment was intended as a forward deployment, a forward deployment that has already occured.

If pForceFull is true, a full deployment will be forced, otherwise an incremental deployment will be used if possible.

If a deploy time is specified, the deployment will be scheduled for execution at the specified time. If no deploy time is provided, the deployment will either run immediately or be queued behind any deployments already queued to run immediately. As scheduled deployments become ready to run, they get queued behind existing deployments that are already queued to run immediately.

Use the Deployment.runNext() method to push any deployment to the head of the list of pending deployments, thus making it the next deployment to run. Any currently running deployment will be allowed to finish (or can be stopped). Calling runNext() on a scheduled deployment will supercede the scheduling request.

An optional string may be passed in to identify the initiator of this new deployment. The information is associated with the deployment history entry for this action and is mainly meant as a convenience for UIs. If calling code does not have a "user" then an identifying tag for the call would be appropriate.

Parameters:
pProjectIDs - the list of Project IDs (Project.getId()) for the Projects to deploy to the target
pForceFull - whether or not to require the deployment to be a full deployment
pDeploymentType - the type of deployment (e.g. init, standard, revert, back, one off)
pDeployTime - a specific time to run the deployment, or NULL if run as soon as possible
pInitiatorID - an identifying string of "who" is effectively performing this action
pStrictFileOps - an override to the global setting in /atg/deployment/DeploymentManager
pStrictRepoOps - an override to the global setting in /atg/deployment/DeploymentManager
Returns:
Deployment a deployment object representing the new deployment
Throws:
atg.deployment.common.DeploymentException
See Also:
Deployment

deployProjects

public Deployment deployProjects(java.lang.String[] pProjectIDs,
                                 boolean pForceFull,
                                 java.util.Calendar pDeployTime,
                                 java.lang.String pInitiatorID)
                          throws atg.deployment.common.DeploymentException
See deployProjects. This method doesn't specify strict file or repository update operations and will default to global settings in /atg/deployment/DeploymentManager.

Parameters:
pProjectIDs -
pForceFull -
pDeployTime -
pInitiatorID -
Returns:
Throws:
atg.deployment.common.DeploymentException

deployPrevious

public Deployment deployPrevious(java.lang.String pProjectID,
                                 boolean pForceFull,
                                 java.util.Calendar pDeployTime,
                                 java.lang.String pInitiatorID,
                                 int pStrictFileOps,
                                 int pStrictRepoOps)
                          throws atg.deployment.common.DeploymentException
Performs a "back deployment" to the Target returning it to the state when the given Project was deployed and checked-in.

The deployment of Projects to a Target produces a timeline for the Target. The list of deployed Projects serves as a series of markers indicating what content appeared on the Target and when. The deployPrevious() method is used with a Project from the list of deployed Projects to temporarily return a Target to the state when the Project was previously deployed. This is a useful feature if a target must be quickly reverted to some arbitrary point in its history until some emergency change can be prepared and deployed.

Back deploying a Target does not delete any of the Projects that were deployed after the Project back-deployed to. Such Projects continue to exist in the Publishing server, are still associated with the Target in the order they were deployed, but have merely been temporarily removed from the Target. Think of a back deployment simply as a quick re-winding of a tape cassette. Once back-deployed, the next new Project deployed to the Target will re-deploy all the "rewound" Projects. Calling deployPrevious() effectivly winds the deployment tape cassette to any point in its deployment history using the ordered list of previously deployed Projects.

If pForceFull is true, a full deployment will be forced, otherwise an incremental deployment will be used if possible.

If a deploy time is specified, the deployment will be scheduled for execution at the specified time. If no deploy time is provided, the deployment will either run immediately or be queued behind any deployments already queued to run immediately. As scheduled deployments become ready to run, they get queued behind existing deployments that are already queued to run immediately.

Use the Deployment.runNext() method to push any deployment to the head of the list of pending deployments, thus making it the next deployment to run. Any currently running deployment will be allowed to finish (or can be stopped). Calling runNext() on a scheduled deployment will supercede the scheduling request.

An optional string may be passed in to identify the initiator of this new deployment. The information is associated with the deployment history entry for this action and is mainly meant as a convenience for UIs. If calling code does not have a "user" then an identifying tag for the call would be appropriate.

Parameters:
pProjectIDs - the list of Project IDs (Project.getId()) for the Projects to deploy to the target
pForceFull - whether or not to require the deployment to be a full deployment
pDeployTime - a specific time to run the deployment, or NULL if run as soon as possible
pInitiatorID - an identifying string of "who" is effectively performing this action
pStrictFileOps - an override to the global setting in /atg/deployment/DeploymentManager
pStrictRepoOps - an override to the global setting in /atg/deployment/DeploymentManager
Returns:
Deployment a deployment object representing the new deployment
Throws:
atg.deployment.common.DeploymentException
See Also:
Deployment

deployPrevious

public Deployment deployPrevious(java.lang.String pProjectID,
                                 boolean pForceFull,
                                 java.util.Calendar pDeployTime,
                                 java.lang.String pInitiatorID)
                          throws atg.deployment.common.DeploymentException
See deployPrevious. This method doesn't specify strict file or repository update operations and will default to global settings in /atg/deployment/DeploymentManager.

Parameters:
pProjectID -
pForceFull -
pDeployTime -
pInitiatorID -
Returns:
Throws:
atg.deployment.common.DeploymentException

deployRevert

public Deployment deployRevert(java.lang.String pProjectID,
                               java.util.Calendar pDeployTime,
                               java.lang.String pInitiatorID)
                        throws atg.deployment.common.DeploymentException
Functions the same as deploy() Projects that have been checked-in cannot be reverted from a target. Passing such a Project into this method will result in a DeploymentException.

An optional string may be passed in to identify the initiator of this revert. The information is associated with the deployment history entry for this action and is mainly meant as a convenience for UIs. If calling code does not have a "user" then an identifying tag for the call would be appropriate.

Parameters:
pProjectID - Project.getId() from the Project to revert from the target
pForceFull - whether or not to require the deployment to be a full deployment
pDeployTime - a specific time to run the deployment, or NULL if run as soon as possible
pInitiatorID - an identifying string of "who" is effectively performing this action
Returns:
Deployment a deployment object representing the new deployment
Throws:
atg.deployment.common.DeploymentException
See Also:
Deployment

criticalReset

public void criticalReset(java.lang.String pInitiatorID)
                   throws atg.deployment.common.DeploymentException
Does a "hard" reset of the target and the target agents. This is a dangerous method but is provided for managing a target that is having stateful problems. It should only be used as a last resort when rebooting is not an option.

Parameters:
pInitiatorID - an identifier of who is requesting the reset
Throws:
atg.deployment.common.DeploymentException

getInstalledSnapshot

public java.lang.String getInstalledSnapshot()
                                      throws atg.deployment.common.DeploymentException
Returns the current snapshot on this Target by querying each target agent that has deployment responsibilities (as these are the only agents who actually maintain deployed data). Null is returned if all of the target agents have uninitialized snapshots. A DeploymentException is thrown if there is a snapshot mis-match.

Returns:
String the deployed snapshot
Throws:
atg.deployment.common.DeploymentException - on agent deployed snapshot mis-match

getEffectiveDeployedSnapshot

public Snapshot getEffectiveDeployedSnapshot()
                                      throws atg.deployment.common.DeploymentException
Find the snapshot that we should consider as deployed to the target this may be different than the snapshot that is installed on the target. Active projects are deployed without a snapshot and get a snapshot when they are checked in. As soon as they are checked in they are considered as deployed to all targets to which they were deployed before check in.

Parameters:
pTarget -
Returns:
Snapshot or null if installed snapshot cannot be read or there is a snapshot mismatch.
Throws:
atg.deployment.common.DeploymentException

isBackDeployed

protected boolean isBackDeployed()
                          throws atg.deployment.common.DeploymentException
If this target is not current i.e. last deployment done to this target was a back deployment.

Parameters:
pTarget -
Returns:
Snapshot or null if installed snapshot cannot be read or there is a snapshot mismatch.
Throws:
atg.deployment.common.DeploymentException

lastDeployedProjectSnapshot

protected Snapshot lastDeployedProjectSnapshot()
                                        throws javax.ejb.FinderException,
                                               VersionException
Throws:
javax.ejb.FinderException
VersionException

getDeployedSnapshotCreationTime

public java.lang.Long getDeployedSnapshotCreationTime()
                                               throws atg.deployment.common.DeploymentException
Returns the creation time (as a Long ) of the last deployed snapshot. The time known to the version manager. This is an expensive operation since it causes the target to

Returns:
the time as long
Throws:
atg.deployment.common.DeploymentException

getEffectiveDeployedSnapshotCreationTime

public java.lang.Long getEffectiveDeployedSnapshotCreationTime()
                                                        throws atg.deployment.common.DeploymentException
Returns the creation time (as a Long ) of the last effectively deployed snapshot.

Returns:
the time as long
Throws:
atg.deployment.common.DeploymentException

createOrGetDeploymentSnapshot

public Snapshot createOrGetDeploymentSnapshot(VersionManager versionManager,
                                              Project project)
                                       throws VersionException
Create a snapshot for the given project when its already deployed to this target. If snapshot already exist return existing one. If the project is not checked in and does not have a deployment snapshot no snapshot will be created and null will be returned.

Parameters:
versionManager -
project -
Returns:
Throws:
VersionException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException