FileDocCategorySizeDatePackage
DeploymentMgr.javaAPI DocGlassfish v2 API18917Fri May 04 22:30:48 BST 2007com.sun.appserv.management.deploy

DeploymentMgr

public interface DeploymentMgr implements com.sun.appserv.management.base.Utility, com.sun.appserv.management.base.Singleton, com.sun.appserv.management.base.AMX
deprecated
Please use JSR 88 instead This interface and associated items have been deprecated. Please see javax.management.deploy.* at {@link http://java.sun.com/javaee/5/docs/api/} and also {@link http://jcp.org/en/jsr/detail?id=88}

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
  • Deploy
  • Associate
  • Start
Undeploy
  • Stop
  • Disassociate
  • 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
Util#getAMXNotificationValue

Fields Summary
public static final String
J2EE_TYPE
The j2eeType as returned by {@link com.sun.appserv.management.base.AMX#getJ2EEType}.
public static final String
KEY_PREFIX
Prefix for all keys used by DeploymentMgr
public final String
NOTIF_DEPLOYMENT_ID_KEY
Key within the Map of a Notification indicating deployment ID.
public 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.
public 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.
public 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.
public 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.
public 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.
public 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.
public static final String
STUBS_JARFILENAME
public 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.
public 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.

public 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.
public 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.
public 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.
public static final String
DEPLOY_OPTION_NAME_KEY
Key for startDeploy) options-- Registration name of the deployble component, its value should be unique across domain.
public static final String
DEPLOY_OPTION_DESCRIPTION_KEY
Key for startDeploy) options-- The description of the component being deployed.
public 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".
public 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".
public 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.
public static final String
DEPLOY_OPTION_LIBRARIES_KEY
Key for startDeploy) options-- This option specifies additional libraries. Applicable for a J2EEApplication, WebModule, or EJBModule.
public static final int
MAX_DOWNLOAD_CHUNK_SIZE
The maximum allowed transfer size for downloading.
Constructors Summary
Methods Summary
public booleanabortDeploy(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.

param
deployID the id obtained from initDeploy()
return
true if the operation was successfully aborted

public byte[]downloadBytes(java.lang.Object downloadID, int requestSize)
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().

param
downloadID the file download operation id, from initiateFileDownload()
param
requestSize
return
bytes from the file.

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

param
downloadID the file download operation id, from initiateFileDownload()

public java.util.MapgetFinalDeploymentStatus(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

param
deployID the id obtained from initDeploy()
return
a DeploymentStatus, as a Map, or null if not yet finished

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

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

public java.lang.ObjectinitiateFileDownload(java.lang.String moduleID, java.lang.String fileName)
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.

param
moduleID the deployed component moduleID this file download is related to.
param
fileName the desired file name corresponding to this module
return
the operation id

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

param
totalSize total size of the file to upload
return
an identifier describing this file upload

public java.lang.ObjectinitiateFileUpload(java.lang.String name, long totalSize)
This variant allows a name to be specified.

param
name name to be used for the temp file
param
totalSize total size of the file to upload
return
an identifier describing this file upload

public voidstartDeploy(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:

  • {@link #DEPLOY_OPTION_FORCE_KEY}
  • {@link #DEPLOY_OPTION_CASCADE_KEY}
  • {@link #DEPLOY_OPTION_VERIFY_KEY}
  • {@link #DEPLOY_OPTION_ENABLE_KEY}
  • {@link #DEPLOY_OPTION_CONTEXT_ROOT_KEY}
  • {@link #DEPLOY_OPTION_NAME_KEY}
  • {@link #DEPLOY_OPTION_DESCRIPTION_KEY}
  • {@link #DEPLOY_OPTION_GENERATE_RMI_STUBS_KEY}
  • {@link #DEPLOY_OPTION_AVAILABILITY_ENABLED_KEY}
  • {@link #DEPLOY_OPTION_JAVA_WEB_START_ENABLED_KEY}
  • {@link #DEPLOY_OPTION_LIBRARIES_KEY}

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

public voidstartDeploy(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:

  • {@link #DEPLOY_OPTION_FORCE_KEY}
  • {@link #DEPLOY_OPTION_CASCADE_KEY}
  • {@link #DEPLOY_OPTION_VERIFY_KEY}
  • {@link #DEPLOY_OPTION_ENABLE_KEY}
  • {@link #DEPLOY_OPTION_CONTEXT_ROOT_KEY}
  • {@link #DEPLOY_OPTION_NAME_KEY}
  • {@link #DEPLOY_OPTION_DESCRIPTION_KEY}
  • {@link #DEPLOY_OPTION_GENERATE_RMI_STUBS_KEY}
  • {@link #DEPLOY_OPTION_AVAILABILITY_ENABLED_KEY}

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

public javax.management.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 {@link #DEPLOYMENT_COMPLETED_NOTIFICATION_TYPE} or {@link #DEPLOYMENT_ABORTED_NOTIFICATION_TYPE}. The deployment is not otherwise affected; you may still call {@link #getFinalDeploymentStatus}.

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

param
deployID
return
any accumulated Notifications
deprecated

public java.util.Mapundeploy(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.

param
moduleID the application module ID
param
optionalParams optional parameters
return
a DeploymentStatus for the completed operation, as a Map

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

param
uploadID the id obtained from initiateFileUpload()
param
bytes the bytes to upload
return
true if the total upload has been completed, false otherwise