コード例 #1
0
ファイル: Facet.java プロジェクト: johnathonlee/teiid
  /**
   * Creates the necessary transfer objects to report a failed application deployment (update).
   *
   * @param errorMessage reason the deploy failed
   * @param packageDetails describes the update being made
   * @return response populated to reflect a failure
   */
  private DeployPackagesResponse failApplicationDeployment(
      String errorMessage, ResourcePackageDetails packageDetails) {
    DeployPackagesResponse response = new DeployPackagesResponse(ContentResponseResult.FAILURE);

    DeployIndividualPackageResponse packageResponse =
        new DeployIndividualPackageResponse(packageDetails.getKey(), ContentResponseResult.FAILURE);
    packageResponse.setErrorMessage(errorMessage);

    response.addPackageResponse(packageResponse);

    return response;
  }
コード例 #2
0
  public DeployPackagesResponse deployPackages(
      Set<ResourcePackageDetails> packages, ContentServices contentServices) {
    DeployPackagesResponse response = new DeployPackagesResponse();
    if (packages.size() != 1) {
      log.warn(
          "Request to deploy a script containing multiple files, which is obivously illegal: "
              + packages);
      response.setOverallRequestResult(ContentResponseResult.FAILURE);
      response.setOverallRequestErrorMessage("Only one script can be updated at a time.");
      return response;
    }

    try {
      String jbossHomeDir =
          resourceContext
              .getParentResourceComponent()
              .getResourceContext()
              .getPluginConfiguration()
              .getSimpleValue(ApplicationServerPluginConfigurationProperties.HOME_DIR, null);
      SystemInfo systemInfo = resourceContext.getSystemInformation();
      ProfileServiceConnection profileServiceConnection =
          resourceContext.getParentResourceComponent().getConnection();

      ScriptDeployer deployer =
          new ScriptDeployer(
              jbossHomeDir,
              systemInfo,
              new RemoteDownloader(resourceContext, true, profileServiceConnection));
      ResourcePackageDetails packageDetails = packages.iterator().next();

      DeployIndividualPackageResponse scriptUpdateResult =
          deployer.update(packageDetails, resourceContext.getResourceType());

      response.setOverallRequestResult(scriptUpdateResult.getResult());
      response.addPackageResponse(scriptUpdateResult);
    } catch (Exception e) {
      response.setOverallRequestErrorMessage(e.getMessage());
      response.setOverallRequestResult(ContentResponseResult.FAILURE);
    }

    return response;
  }