public ResourceConfigurationUpdate updateResourceConfiguration(Configuration configuration) { ResourceConfigurationUpdate update = remoteClient .getConfigurationManager() .updateResourceConfiguration( remoteClient.getSubject(), resourceClientProxy.getId(), configuration); return update; }
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"); }
public ResourceClientProxy getChild(String name) { for (ResourceClientProxy child : getChildren()) { if (name.equals(child.getName())) return child; } return null; }