/** Refresh a bundle revision. */
 public void doRefreshBundle() throws IOException, MojoFailureException {
   try {
     logger.info("\n\n=============Refresh Bundle================\n\n");
     state = State.ACTIVATING;
     RestUtil.refreshBundle(super.getProfile(), this.bundleRevision);
   } catch (IOException e) {
     throw e;
   } catch (RuntimeException e) {
     throw e;
   }
 }
 /** Deactivae a bundle revision. */
 public void doDeactivae() throws IOException, MojoFailureException, Exception {
   try {
     logger.info("\n\n=============Deactivating App================\n\n");
     state = State.DEACTIVATING;
     RestUtil.deactivateBundle(super.getProfile());
   } catch (IOException e) {
     throw e;
   } catch (RuntimeException e) {
     throw e;
   } catch (Exception e) {
     throw e;
   }
 }
  /** Activate a bundle revision. */
  public void doDelete(String revision) throws IOException, MojoFailureException, Exception {
    try {
      logger.info("/n/n=============Deleting App================/n/n");
      state = State.DELETING;
      RestUtil.deleteBundle(this.getProfile(), revision);

    } catch (IOException e) {
      throw e;
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      throw e;
    }
  }
  protected void doImport() throws IOException, MojoFailureException, Exception {
    try {

      logger.info("\n\n=============Importing App================\n\n");
      state = State.IMPORTING;
      bundleRevision = RestUtil.uploadBundle(super.getProfile(), super.getApplicationBundlePath());

    } catch (IOException e) {
      throw e;
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      // This "throws Exception" bothers me so much
      throw e;
    }
  }
  /** Entry point for the mojo. */
  public void execute() throws MojoExecutionException, MojoFailureException {

    try {
      fixOSXNonProxyHosts();

      init();

      switch (buildOption) {
        case NULL:
          if (Options.override) {
            activeRevision = RestUtil.getDeployedRevision(this.getProfile());
            if (activeRevision.length() > 0) {
              doImport();
              doActivateBundle();
            } else {
              Options.override = false;
              doImport();
              doActivateBundle();
            }
          } else if (Options.update) {
            activeRevision = RestUtil.getDeployedRevision(this.getProfile());
            if (activeRevision.length() > 0) doUpdate(activeRevision);
            else {
              doImport();
              doActivateBundle();
            }
          } else if (Options.clean) {
            activeRevision = RestUtil.getDeployedRevision(this.getProfile());
            if (this.activeRevision.length() > 0) {
              doDelete(this.activeRevision);
            } else {
              logger.info(
                  "No active revision for "
                      + this.getProfile().getEnvironment()
                      + "environment. Nothing to delete");
            }
          } else {
            doImport();
            if (!Options.inactive) doRefreshBundle();
          }

          break;
        case deployinactive:
          logger.warn(
              "Note: -Dbuild.option=deploy-inactive   is Deprecated, use -Dapigee.options=inactive instead");
          doImport();
          break;
        case undeploy:
          logger.warn(
              "Note: -Dbuild.option=undeploy is Deprecated, use -Dapigee.options=clean instead");
          doDeactivae();
          break;

        case delete:
          activeRevision = RestUtil.getDeployedRevision(this.getProfile());
          doDelete(activeRevision);
          break;
        default:
          break;
      }

      state = State.COMPLETE;

    } catch (MojoFailureException e) {
      processHelpfulErrorMessage(e);
    } catch (RuntimeException e) {
      processHelpfulErrorMessage(e);
    } catch (Exception e) {
      processHelpfulErrorMessage(e);
    } finally {

    }
  }