Ejemplo n.º 1
0
    public ResourceConfigurationUpdate updateResourceConfiguration(Configuration configuration) {
      ResourceConfigurationUpdate update =
          remoteClient
              .getConfigurationManager()
              .updateResourceConfiguration(
                  remoteClient.getSubject(), resourceClientProxy.getId(), configuration);

      return update;
    }
Ejemplo n.º 2
0
    public void updateBackingContent(String filename, String displayVersion) {
      File file = new File(filename);
      if (!file.exists()) {
        throw new IllegalArgumentException("File not found: " + file.getAbsolutePath());
      }
      if (file.isDirectory()) {
        throw new IllegalArgumentException(
            "File expected, found directory: " + file.getAbsolutePath());
      }

      byte[] fileContents = new ScriptUtil(remoteClient).getFileBytes(filename);
      String sha = null;
      try {
        sha =
            new MessageDigestGenerator(MessageDigestGenerator.SHA_256)
                .calcDigestString(fileContents);
      } catch (Exception e) {
        // do nothing because the sha will remain null.
        LOG.error("Message digest for the package bits failed.", e);
      }

      String packageVersion = "[sha256=" + sha + "]";

      InstalledPackage oldPackage = getBackingContent();

      PackageVersion pv =
          remoteClient
              .getContentManager()
              .createPackageVersionWithDisplayVersion(
                  remoteClient.getSubject(),
                  oldPackage.getPackageVersion().getGeneralPackage().getName(),
                  oldPackage.getPackageVersion().getGeneralPackage().getPackageType().getId(),
                  packageVersion,
                  displayVersion,
                  oldPackage.getPackageVersion().getArchitecture().getId(),
                  fileContents);

      remoteClient
          .getContentManager()
          .deployPackagesWithNote(
              remoteClient.getSubject(),
              new int[] {resourceClientProxy.getId()},
              new int[] {pv.getId()},
              "CLI deployment request");
    }
Ejemplo n.º 3
0
 public ResourceClientProxy getChild(String name) {
   for (ResourceClientProxy child : getChildren()) {
     if (name.equals(child.getName())) return child;
   }
   return null;
 }