J2EE1.4 SDK

com.sun.appserv.management.deploy
Interface DeploymentMgr

All Superinterfaces:
AMX, AMXMBeanLogging, NotificationBroadcaster, NotificationEmitter, Singleton, Utility

public interface DeploymentMgr
extends AMX, Utility, Singleton

This interface provides facilities to deploy any type of J2EE module. Users of this interface are likely to do the following

- Start uploading the necessary file for deployment by using the initiateFileUpload and sendBytes APIs. Once the file(s) upload are completed the deploy operation can be initiated.

- Instead of uploading files or when dealing with redeployment with a partial archive delivery, a DeploymentSource object is used to retrieve the delivered files. This DeploymentSource is encoded as a Map.

- Deploy operations can be invoked either by using uploaded files ID (obtained from initiateFileUpload) or a DeploymentSource. DeploymentOptions can be passed as a Map of Deployment option name to deployment option value.

- Deploy operations are asynchronous therefore they can be monitored using the getDeploymentProgress and getStatusCode operations.

- To observe completion of a deployment, the client should register itself as a listener on the DeploymentMgr using addNotificationListener(). A Notification will be issued in which the value of notif.getUserData() will be the deployID used for the deployment. The notif will have the getType() of DEPLOYMENT_COMPLETED_NOTIFICATION_TYPE.

- In case the client wants to retrieve non portable artifacts after successful deployment the file download APIs should be used (initiateFileDownload and receiveBytes).

MBean API's concept of Deploy and Undeploy are different from the CLI and GUI concept. In order to have a fully functioning application for deploy or a fully removed application for undeploy, 3 steps must be performed in both cases. Associate and start (also, stop and disassociate) are always performed together in CLI and GUI. MBean API users must perform the 3 steps explicitly. I.e. Deploy and Undeploy in the MBean API performs only the transfer and registration of files in the AppServer.

These are the required steps:

Deploy Undeploy

Also, J2EEServer.getDeployedObjectsSet() is based on a running modules. Hence, a deployedObject will appear in the list only when the module is running


Field Summary
static java.lang.String DEPLOY_OPTION_AVAILABILITY_ENABLED_KEY
          Key for startDeploy) options-- This option controls whether availability is enabled for SFSB checkpointing (and potentially passivation).
static java.lang.String DEPLOY_OPTION_CASCADE_KEY
          Key for undeploy() options-- If set to true, it deletes all the connection pools and connector resources associated with the resource adapter (being undeployed).
static java.lang.String DEPLOY_OPTION_CONTEXT_ROOT_KEY
          Key for startDeploy) options-- The context root of the deployable web component.
static java.lang.String DEPLOY_OPTION_DESCRIPTION_KEY
          Key for startDeploy) options-- The description of the component being deployed.
static java.lang.String DEPLOY_OPTION_ENABLE_KEY
          Key for startDeploy) options-- Disables or enables the component after it is deployed.
static java.lang.String DEPLOY_OPTION_FORCE_KEY
          Key for startDeploy() options-- Forcefully (re)deploy the component even if the specified component has already been deployed.
static java.lang.String DEPLOY_OPTION_GENERATE_RMI_STUBS_KEY
          Key for startDeploy) options-- When true, will generate the static RMI-IIOP stubs and put it in the client.jar.
static java.lang.String DEPLOY_OPTION_NAME_KEY
          Key for startDeploy) options-- Registration name of the deployble component, its value should be unique across domain.
static java.lang.String DEPLOY_OPTION_VERIFY_KEY
          Key for startDeploy() options-- If set to true, verify the syntax and semantics of the deployment descriptor.
static java.lang.String DEPLOYMENT_ABORTED_NOTIFICATION_TYPE
          The type of the Notification emitted when a deployment is aborted via abortDeploy().
static java.lang.String DEPLOYMENT_COMPLETED_NOTIFICATION_TYPE
          The type of the Notification emitted when a deployment completes.
static java.lang.String DEPLOYMENT_PROGRESS_NOTIFICATION_TYPE
          The type of the Notification emitted for deployment progress.
static java.lang.String DEPLOYMENT_STARTED_NOTIFICATION_TYPE
          The type of the Notification emitted when a deployment starts.
static java.lang.String J2EE_TYPE
          The j2eeType as returned by AMX.getJ2EEType().
static java.lang.String KEY_PREFIX
          Prefix for all keys used by DeploymentMgr
static int MAX_DOWNLOAD_CHUNK_SIZE
          The maximum allowed transfer size for downloading.
static java.lang.String NOTIF_DEPLOYMENT_COMPLETED_STATUS_KEY
          Key within the Map of a Notification of type DEPLOYMENT_COMPLETED_NOTIFICATION_TYPE, indicating the final status of the deployment.
static java.lang.String NOTIF_DEPLOYMENT_ID_KEY
          Key within the Map of a Notification indicating deployment ID.
static java.lang.String NOTIF_DEPLOYMENT_PROGRESS_KEY
          Key within the Map of a Notification of type DEPLOYMENT_PROGRESS_NOTIFICATION_TYPE, indicating a DeploymentProgress, as a Map.
static java.lang.String STUBS_JARFILENAME
           
 
Fields inherited from interface com.sun.appserv.management.base.AMX
FULL_TYPE_DELIM, GROUP_CONFIGURATION, GROUP_JSR77, GROUP_MONITORING, GROUP_OTHER, GROUP_UTILITY, J2EE_TYPE_KEY, NAME_KEY, NO_NAME, NULL_NAME
 
Fields inherited from interface com.sun.appserv.management.base.AMXMBeanLogging
LOG_RECORD_KEY, LOG_RECORD_NOTIFICATION_TYPE
 
Method Summary
 boolean abortDeploy(java.lang.Object deployID)
          abort a given deployment operation, all modification to the server must be rollbacked and all resources cleaned.
 byte[] downloadBytes(java.lang.Object downloadID, int requestSize)
          Download byte chunks from the server using a file operation id obtained via initiateFileDownload API.
 long getDownloadLength(java.lang.Object downloadID)
          Get the total length the download will be, in bytes.
 java.util.Map getFinalDeploymentStatus(java.lang.Object deployID)
          Return the final DeploymentStatus once the deployment has finished.
 java.lang.Object initDeploy()
          Create a new deploy ID which may be used via startDeploy() to start a new deployment operation.
 java.lang.Object initiateFileDownload(java.lang.String moduleID, java.lang.String fileName)
          Initiates a file download with the given filename.
 java.lang.Object initiateFileUpload(long totalSize)
          initiatiate a new deployment operation, the id returned will be used to transfer the appropriate files on the server.
 void startDeploy(java.lang.Object deployID, java.util.Map source, java.util.Map plan, java.util.Map options)
          Start a new deployment operation given a deployment source and a list of options.
 void startDeploy(java.lang.Object deployID, java.lang.Object uploadID, java.lang.Object planUploadID, java.util.Map options)
          Start the deployment operation using file(s) previously uploaded by initializeFileUpload() and uploadBytes().
 Notification[] takeNotifications(java.lang.Object deployID)
          Return all Notifications, which have already been sent, but which are also queued waiting for this request.
 java.util.Map undeploy(java.lang.String moduleID, java.util.Map optionalParams)
          Undeploys a module or application from the server, cleans all associated resources and removed the module from the list of installed components.
 boolean uploadBytes(java.lang.Object uploadID, byte[] bytes)
          For an upload id obtained from initiateFileUpload(), send another chunk of bytes for that upload.
 
Methods inherited from interface com.sun.appserv.management.base.AMX
getContainer, getDomainRoot, getFullType, getGroup, getJ2EEType, getName
 
Methods inherited from interface com.sun.appserv.management.base.AMXMBeanLogging
getMBeanEmitLogNotifications, getMBeanLoggerName, getMBeanLogLevel, setMBeanEmitLogNotifications, setMBeanLogLevel
 
Methods inherited from interface javax.management.NotificationEmitter
removeNotificationListener
 
Methods inherited from interface javax.management.NotificationBroadcaster
addNotificationListener, getNotificationInfo, removeNotificationListener
 

Field Detail

J2EE_TYPE

public static final java.lang.String J2EE_TYPE
The j2eeType as returned by AMX.getJ2EEType().

See Also:
Constant Field Values

KEY_PREFIX

public static final java.lang.String KEY_PREFIX
Prefix for all keys used by DeploymentMgr

See Also:
Constant Field Values

NOTIF_DEPLOYMENT_ID_KEY

public static final java.lang.String NOTIF_DEPLOYMENT_ID_KEY
Key within the Map of a Notification indicating deployment ID.

See Also:
Constant Field Values

NOTIF_DEPLOYMENT_COMPLETED_STATUS_KEY

public static final java.lang.String NOTIF_DEPLOYMENT_COMPLETED_STATUS_KEY
Key within the Map of a Notification of type DEPLOYMENT_COMPLETED_NOTIFICATION_TYPE, indicating the final status of the deployment.

See Also:
Constant Field Values

NOTIF_DEPLOYMENT_PROGRESS_KEY

public static final java.lang.String NOTIF_DEPLOYMENT_PROGRESS_KEY
Key within the Map of a Notification of type DEPLOYMENT_PROGRESS_NOTIFICATION_TYPE, indicating a DeploymentProgress, as a Map.

See Also:
Constant Field Values

DEPLOYMENT_STARTED_NOTIFICATION_TYPE

public static final java.lang.String DEPLOYMENT_STARTED_NOTIFICATION_TYPE
The type of the Notification emitted when a deployment starts. The user data field contains a Map keyed by NOTIF_*_KEY.

See Also:
Constant Field Values

DEPLOYMENT_COMPLETED_NOTIFICATION_TYPE

public static final java.lang.String DEPLOYMENT_COMPLETED_NOTIFICATION_TYPE
The type of the Notification emitted when a deployment completes. The user data field contains a Map keyed by NOTIF_*_KEY.

See Also:
Constant Field Values

DEPLOYMENT_ABORTED_NOTIFICATION_TYPE

public static final java.lang.String DEPLOYMENT_ABORTED_NOTIFICATION_TYPE
The type of the Notification emitted when a deployment is aborted via abortDeploy(). The user data field contains a Map keyed by NOTIF_*_KEY.

See Also:
Constant Field Values

DEPLOYMENT_PROGRESS_NOTIFICATION_TYPE

public static final java.lang.String DEPLOYMENT_PROGRESS_NOTIFICATION_TYPE
The type of the Notification emitted for deployment progress. The user data field contains a Map keyed by NOTIF_*_KEY.

See Also:
Constant Field Values

STUBS_JARFILENAME

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

DEPLOY_OPTION_FORCE_KEY

public static final java.lang.String DEPLOY_OPTION_FORCE_KEY
Key for startDeploy() options-- Forcefully (re)deploy the component even if the specified component has already been deployed. The default value is true.

See Also:
Constant Field Values

DEPLOY_OPTION_CASCADE_KEY

public static final java.lang.String DEPLOY_OPTION_CASCADE_KEY
Key for undeploy() options-- If set to true, it deletes all the connection pools and connector resources associated with the resource adapter (being undeployed). If set to false, the undeploy fails if any pools and resources are still associated with the resource adapter.

This option is applicable to connectors(resource adapters) and applications(J2EE apps i.e .ear files can contain the resource adapters *.rar). The default value is false.

See Also:
Constant Field Values

DEPLOY_OPTION_VERIFY_KEY

public static final java.lang.String DEPLOY_OPTION_VERIFY_KEY
Key for startDeploy() options-- If set to true, verify the syntax and semantics of the deployment descriptor. The default value is false.

See Also:
Constant Field Values

DEPLOY_OPTION_ENABLE_KEY

public static final java.lang.String DEPLOY_OPTION_ENABLE_KEY
Key for startDeploy) options-- Disables or enables the component after it is deployed. The default value is true.

See Also:
Constant Field Values

DEPLOY_OPTION_CONTEXT_ROOT_KEY

public static final java.lang.String DEPLOY_OPTION_CONTEXT_ROOT_KEY
Key for startDeploy) options-- The context root of the deployable web component. Only applies to web module.

See Also:
Constant Field Values

DEPLOY_OPTION_NAME_KEY

public static final java.lang.String DEPLOY_OPTION_NAME_KEY
Key for startDeploy) options-- Registration name of the deployble component, its value should be unique across domain.

See Also:
Constant Field Values

DEPLOY_OPTION_DESCRIPTION_KEY

public static final java.lang.String DEPLOY_OPTION_DESCRIPTION_KEY
Key for startDeploy) options-- The description of the component being deployed.

See Also:
Constant Field Values

DEPLOY_OPTION_GENERATE_RMI_STUBS_KEY

public static final java.lang.String DEPLOY_OPTION_GENERATE_RMI_STUBS_KEY
Key for startDeploy) options-- When true, will generate the static RMI-IIOP stubs and put it in the client.jar. Default value for this option is "false".

See Also:
Constant Field Values

DEPLOY_OPTION_AVAILABILITY_ENABLED_KEY

public static final java.lang.String DEPLOY_OPTION_AVAILABILITY_ENABLED_KEY
Key for startDeploy) options-- This option controls whether availability is enabled for SFSB checkpointing (and potentially passivation). When false, then all SFSB checkpointing is disabled for either the given j2ee app or the given ejb module. When true, the j2ee app or stand-alone ejb modules may be enabled. Default value is "false".

See Also:
Constant Field Values

MAX_DOWNLOAD_CHUNK_SIZE

public static final int MAX_DOWNLOAD_CHUNK_SIZE
The maximum allowed transfer size for downloading.

See Also:
Constant Field Values
Method Detail

initiateFileUpload

public java.lang.Object initiateFileUpload(long totalSize)
                                    throws java.io.IOException
initiatiate a new deployment operation, the id returned will be used to transfer the appropriate files on the server.

Parameters:
totalSize - total size of the file to upload
Returns:
an identifier describing this file upload
Throws:
java.io.IOException

uploadBytes

public boolean uploadBytes(java.lang.Object uploadID,
                           byte[] bytes)
                    throws java.io.IOException
For an upload id obtained from initiateFileUpload(), send another chunk of bytes for that upload.

Parameters:
uploadID - the id obtained from initiateFileUpload()
bytes - the bytes to upload
Returns:
true if the total upload has been completed, false otherwise
Throws:
java.io.IOException

initDeploy

public java.lang.Object initDeploy()
Create a new deploy ID which may be used via startDeploy() to start a new deployment operation.

Returns:
an new opaque identifier which can be used in startDeploy()

startDeploy

public void startDeploy(java.lang.Object deployID,
                        java.lang.Object uploadID,
                        java.lang.Object planUploadID,
                        java.util.Map options)
Start the deployment operation using file(s) previously uploaded by initializeFileUpload() and uploadBytes().

When the runtime deployment descriptors and other server specific configuration are embedded in the deployable archive, null should be passed for the planUploadID.

Legal keys for use within the options Map include:

Parameters:
deployID - an id obtained from initDeploy()
uploadID - an id obtained from initiateFileUpload()
planUploadID - an id obtained from initiateFileUpload(), may be null
options - contains the list of deployment options

startDeploy

public void startDeploy(java.lang.Object deployID,
                        java.util.Map source,
                        java.util.Map plan,
                        java.util.Map options)
Start a new deployment operation given a deployment source and a list of options. The DeploymentPlan is null when the runtime deployment descriptors and other server specific configuration is embedded in the deployable archive.

Legal keys for use within the options Map include:

Parameters:
deployID - an id obtained from initDeploy()
source - a DeploymentSource as a Map
plan - will contain the deployment plan for this, may be null deployment operation if the deployable archive is portable
options - contains the list of deployment options.

takeNotifications

public Notification[] takeNotifications(java.lang.Object deployID)
Return all Notifications, which have already been sent, but which are also queued waiting for this request.

The deployment is done if the last Notification is of type DEPLOYMENT_COMPLETED_NOTIFICATION_TYPE or DEPLOYMENT_ABORTED_NOTIFICATION_TYPE. The deployment is not otherwise affected; you may still call getFinalDeploymentStatus(java.lang.Object).

WARNING: This routine is for internal use only, and may not be supported in the future. External users should use the standard Notification mechanisms by registering as a listener

Parameters:
deployID -
Returns:
any accumulated Notifications

abortDeploy

public boolean abortDeploy(java.lang.Object deployID)
abort a given deployment operation, all modification to the server must be rollbacked and all resources cleaned. If the abortion operation cannot be successfully completed (because it's too late for instance), it is the responsibility of the client to undeploy the application.

Parameters:
deployID - the id obtained from initDeploy()
Returns:
true if the operation was successfully aborted

getFinalDeploymentStatus

public java.util.Map getFinalDeploymentStatus(java.lang.Object deployID)
Return the final DeploymentStatus once the deployment has finished. or null if the deployment has not yet finished. Once called, the state associated with this deployment is removed, and the deployID is no longer valid. All outstanding notifications pending for takeNotifications() are also removed and become unavailable.

WARNING: This routine is for internal use only, and may not be supported in the future. External users should use the standard Notification mechanisms by registering as a listener

Parameters:
deployID - the id obtained from initDeploy()
Returns:
a DeploymentStatus, as a Map, or null if not yet finished

undeploy

public java.util.Map undeploy(java.lang.String moduleID,
                              java.util.Map optionalParams)
Undeploys a module or application from the server, cleans all associated resources and removed the module from the list of installed components.

Parameters:
moduleID - the application module ID
optionalParams - optional parameters
Returns:
a DeploymentStatus for the completed operation, as a Map

initiateFileDownload

public java.lang.Object initiateFileDownload(java.lang.String moduleID,
                                             java.lang.String fileName)
                                      throws java.io.IOException
Initiates a file download with the given filename. The filename is relative to the application or module URL. If the filename is STUBS_JARFILENAME, the application client stubs jar file will be downloaded. This API can also be used for downloading final WSDL files.

Parameters:
moduleID - the deployed component moduleID this file download is related to.
fileName - the desired file name corresponding to this module
Returns:
the operation id
Throws:
java.io.IOException

getDownloadLength

public long getDownloadLength(java.lang.Object downloadID)
Get the total length the download will be, in bytes.

Parameters:
downloadID - the file download operation id, from initiateFileDownload()

downloadBytes

public byte[] downloadBytes(java.lang.Object downloadID,
                            int requestSize)
                     throws java.io.IOException
Download byte chunks from the server using a file operation id obtained via initiateFileDownload API. The bufferSize is the requested number of bytes to be received. If the size of the returned byte[] is less than the requestSize, then the transfer has completed, and the downloadID is no longer valid. An attempt to read more than the allowed maximum size will throw an exception. The caller can check the total download size in advance via getDownloadLength().

Parameters:
downloadID - the file download operation id, from initiateFileDownload()
requestSize -
Returns:
bytes from the file.
Throws:
java.io.IOException

J2EE1.4 SDK

Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.