Java EE 5 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

See Also:
Util.getAMXNotificationValue(javax.management.Notification, java.lang.String)

Field Summary
static String DEPLOY_OPTION_AVAILABILITY_ENABLED_KEY
          Key for startDeploy) options-- This option controls whether availability is enabled for SFSB checkpointing (and potentially passivation).
static 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 String DEPLOY_OPTION_CONTEXT_ROOT_KEY
          Key for startDeploy) options-- The context root of the deployable web component.
static String DEPLOY_OPTION_DESCRIPTION_KEY
          Key for startDeploy) options-- The description of the component being deployed.
static String DEPLOY_OPTION_ENABLE_KEY
          Key for startDeploy) options-- Disables or enables the component after it is deployed.
static String DEPLOY_OPTION_FORCE_KEY
          Key for startDeploy() options-- Forcefully (re)deploy the component even if the specified component has already been deployed.
static 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 String DEPLOY_OPTION_JAVA_WEB_START_ENABLED_KEY
          Key for startDeploy) options-- This option controls whether java web start is enabled.
static String DEPLOY_OPTION_LIBRARIES_KEY
          Key for startDeploy) options-- This option specifies additional libraries.
static String DEPLOY_OPTION_NAME_KEY
          Key for startDeploy) options-- Registration name of the deployble component, its value should be unique across domain.
static String DEPLOY_OPTION_VERIFY_KEY
          Key for startDeploy() options-- If set to true, verify the syntax and semantics of the deployment descriptor.
static String DEPLOYMENT_ABORTED_NOTIFICATION_TYPE
          The type of the Notification emitted when a deployment is aborted via abortDeploy().
static String DEPLOYMENT_COMPLETED_NOTIFICATION_TYPE
          The type of the Notification emitted when a deployment completes.
static String DEPLOYMENT_PROGRESS_NOTIFICATION_TYPE
          The type of the Notification emitted for deployment progress.
static String DEPLOYMENT_STARTED_NOTIFICATION_TYPE
          The type of the Notification emitted when a deployment starts.
static String J2EE_TYPE
          The j2eeType as returned by AMX.getJ2EEType().
static String KEY_PREFIX
          Prefix for all keys used by DeploymentMgr
static int MAX_DOWNLOAD_CHUNK_SIZE
          The maximum allowed transfer size for downloading.
static 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 String NOTIF_DEPLOYMENT_ID_KEY
          Key within the Map of a Notification indicating deployment ID.
static 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 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, JMX_DOMAIN, NAME_KEY, NO_NAME, NOTIFICATION_PREFIX, NULL_NAME
 
Method Summary
 boolean abortDeploy(Object deployID)
          abort a given deployment operation, all modification to the server must be rollbacked and all resources cleaned.
 byte[] downloadBytes(Object downloadID, int requestSize)
          Download byte chunks from the server using a file operation id obtained via initiateFileDownload API.
 long getDownloadLength(Object downloadID)
          Get the total length the download will be, in bytes.
 Map<String,Serializable> getFinalDeploymentStatus(Object deployID)
          Return the final DeploymentStatus once the deployment has finished.
 Object initDeploy()
          Create a new deploy ID which may be used via startDeploy() to start a new deployment operation.
 Object initiateFileDownload(String moduleID, String fileName)
          Initiates a file download with the given filename.
 Object initiateFileUpload(long totalSize)
          initiatiate a new deployment operation, the id returned will be used to transfer the appropriate files on the server.
 Object initiateFileUpload(String name, long totalSize)
          This variant allows a name to be specified.
<T1 extends Serializable,T2 extends Serializable>
void
startDeploy(Object deployID, Map<String,T1> source, Map<String,T2> plan, Map<String,String> options)
          Start a new deployment operation given a deployment source and a list of options.
 void startDeploy(Object deployID, Object uploadID, Object planUploadID, Map<String,String> options)
          Start the deployment operation using file(s) previously uploaded by initializeFileUpload() and uploadBytes().
 Notification[] takeNotifications(Object deployID)
          Deprecated.  
 Map<String,Serializable> undeploy(String moduleID, Map<String,String> 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(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, isDAS
 
Methods inherited from interface javax.management.NotificationEmitter
removeNotificationListener
 
Methods inherited from interface javax.management.NotificationBroadcaster
addNotificationListener, getNotificationInfo, removeNotificationListener
 
Methods inherited from interface com.sun.appserv.management.base.AMXMBeanLogging
getMBeanLoggerName, getMBeanLogLevel, setMBeanLogLevel
 

Field Detail

J2EE_TYPE

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

See Also:
Constant Field Values

KEY_PREFIX

static final String KEY_PREFIX
Prefix for all keys used by DeploymentMgr

See Also:
Constant Field Values

NOTIF_DEPLOYMENT_ID_KEY

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

See Also:
Util.getAMXNotificationValue(javax.management.Notification, java.lang.String), Constant Field Values

NOTIF_DEPLOYMENT_COMPLETED_STATUS_KEY

static final 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:
Util.getAMXNotificationValue(javax.management.Notification, java.lang.String), Constant Field Values

NOTIF_DEPLOYMENT_PROGRESS_KEY

static final 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:
Util.getAMXNotificationValue(javax.management.Notification, java.lang.String), Constant Field Values

DEPLOYMENT_STARTED_NOTIFICATION_TYPE

static final 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

static final 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

static final 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

static final 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

static final String STUBS_JARFILENAME
See Also:
Constant Field Values

DEPLOY_OPTION_FORCE_KEY

static final 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

static final 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

static final 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

static final 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

static final 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

static final 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

static final 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

static final 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

static final 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

DEPLOY_OPTION_JAVA_WEB_START_ENABLED_KEY

static final String DEPLOY_OPTION_JAVA_WEB_START_ENABLED_KEY
Key for startDeploy) options-- This option controls whether java web start is enabled. Applicable for a J2EEApplication or AppClientModule.

See Also:
Constant Field Values

DEPLOY_OPTION_LIBRARIES_KEY

static final String DEPLOY_OPTION_LIBRARIES_KEY
Key for startDeploy) options-- This option specifies additional libraries. Applicable for a J2EEApplication, WebModule, or EJBModule.

See Also:
Libraries, Constant Field Values

MAX_DOWNLOAD_CHUNK_SIZE

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

See Also:
Constant Field Values
Method Detail

initiateFileUpload

Object initiateFileUpload(long totalSize)
                          throws 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:
IOException

initiateFileUpload

Object initiateFileUpload(String name,
                          long totalSize)
                          throws IOException
This variant allows a name to be specified.

Parameters:
name - name to be used for the temp file
totalSize - total size of the file to upload
Returns:
an identifier describing this file upload
Throws:
IOException

uploadBytes

boolean uploadBytes(Object uploadID,
                    byte[] bytes)
                    throws 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:
IOException

initDeploy

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

void startDeploy(Object deployID,
                 Object uploadID,
                 Object planUploadID,
                 Map<String,String> 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

<T1 extends Serializable,T2 extends Serializable> void startDeploy(Object deployID,
                                                                   Map<String,T1> source,
                                                                   Map<String,T2> plan,
                                                                   Map<String,String> 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

Notification[] takeNotifications(Object deployID)
Deprecated. 

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

boolean abortDeploy(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

Map<String,Serializable> getFinalDeploymentStatus(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

Map<String,Serializable> undeploy(String moduleID,
                                  Map<String,String> 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

Object initiateFileDownload(String moduleID,
                            String fileName)
                            throws 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:
IOException

getDownloadLength

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

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

downloadBytes

byte[] downloadBytes(Object downloadID,
                     int requestSize)
                     throws 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:
IOException

Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.