/**
   * Initiates a deployment operation on the server, using a source archive abstraction and an
   * optional deployment plan if the server specific information is not embedded in the source
   * archive. The deploymentOptions is a key-value pair map of deployment options for this
   * operations. Once the deployment is successful, the targets server instances
   *
   * @param source is the j2ee module abstraction (with or without the server specific artifacts).
   * @param deploymenPlan is the optional deployment plan is the source archive is portable.
   * @param the deployment options
   * @return a JESProgressObject to receive deployment events.
   */
  public JESProgressObject deploy(
      Target[] targets, Archive source, Archive deploymentPlan, Map deploymentOptions) {
    if (!isConnected()) {
      throw new IllegalStateException(
          localStrings.getString("enterprise.deployment.client.disconnected_state"));
    }

    SunTarget[] targetList = getSunTargets(targets);
    ProgressObjectImpl progressObject = new DeployAction(targetList);
    Object args[] = new Object[8];
    args[0] = dasConnection;
    args[1] = source;
    args[2] = deploymentPlan;
    args[3] =
        (deploymentOptions == null)
            ? new HashMap()
            : DeploymentProperties.propsToMap((Properties) deploymentOptions);
    args[4] = targetList;
    args[5] = domain;
    args[6] = localConnection;
    args[7] = serverId;
    progressObject.setCommand(CommandType.DISTRIBUTE, args);
    Thread newThread = new Thread(progressObject);
    newThread.start();
    return progressObject;
  }
 private JESProgressObject changeState(Target[] targets, String moduleID, CommandType cmd) {
   if (!isConnected()) {
     throw new IllegalStateException(
         localStrings.getString("enterprise.deployment.client.disconnected_state"));
   }
   SunTarget[] targetList = getSunTargets(targets);
   ProgressObjectImpl progressObject = new ChangeStateAction(targetList);
   Object args[] = new Object[5];
   args[0] = dasConnection;
   args[1] = targetList;
   args[2] = moduleID;
   args[3] = cmd;
   args[4] = domain;
   progressObject.setCommand(cmd, args);
   Thread newThread = new Thread(progressObject);
   newThread.start();
   return progressObject;
 }
 private JESProgressObject doApplicationReferenceAction(
     Target[] targets, String moduleID, Map options, CommandType cmd) {
   if (!isConnected()) {
     throw new IllegalStateException(
         localStrings.getString("enterprise.deployment.client.disconnected_state"));
   }
   SunTarget[] targetList = getSunTargets(targets);
   ProgressObjectImpl progressObject = new ApplicationReferenceAction(targetList);
   Object args[] = new Object[5];
   args[0] = dasConnection;
   args[1] = targetList;
   args[2] = moduleID;
   args[3] = cmd;
   args[4] =
       (options == null) ? new HashMap() : DeploymentProperties.propsToMap((Properties) options);
   progressObject.setCommand(cmd, args);
   Thread newThread = new Thread(progressObject);
   newThread.start();
   return progressObject;
 }
 public JESProgressObject undeploy(Target[] targets, String moduleID, Map options) {
   if (!isConnected()) {
     throw new IllegalStateException(
         localStrings.getString("enterprise.deployment.client.disconnected_state"));
   }
   SunTarget[] targetList = getSunTargets(targets);
   ProgressObjectImpl progressObject = new UndeployAction(targetList);
   Object args[] = new Object[6];
   args[0] = dasConnection;
   args[1] = moduleID;
   args[2] =
       (options == null) ? new HashMap() : DeploymentProperties.propsToMap((Properties) options);
   args[3] = targetList;
   args[4] = domain;
   args[5] = localConnection;
   progressObject.setCommand(CommandType.UNDEPLOY, args);
   Thread newThread = new Thread(progressObject);
   newThread.start();
   return progressObject;
 }