/** * Synchronize the required files to a slave HC from the master DC if this is required. * @param fileRepository the HostFileRepository of the HC. * @param contentRepository the ContentRepository of the HC. * @param backup inidcates if this is a DC backup HC. * @param oldHash the hash of the deployment to be replaced. * @return true if the content should be pulled by the slave HC - false otherwise. */ public static byte[] synchronizeSlaveHostController(ModelNode operation, final PathAddress address, HostFileRepository fileRepository, ContentRepository contentRepository, boolean backup, byte[] oldHash) { ModelNode operationContentItem = operation.get(DeploymentAttributes.CONTENT_RESOURCE_ALL.getName()).get(0); byte[] newHash = operationContentItem.require(CONTENT_HASH.getName()).asBytes(); if (needRemoteContent(fileRepository, contentRepository, backup, oldHash)) { // backup DC needs to pull the content fileRepository.getDeploymentFiles(ModelContentReference.fromModelAddress(address, newHash)); } return newHash; }
/** * Synchronize the required files to a slave HC from the master DC if this is required. * @param fileRepository the HostFileRepository of the HC. * @param contentRepository the ContentRepository of the HC. * @param backup inidcates if this is a DC backup HC. * @param oldHash the hash of the deployment to be replaced. * @return true if the content should be pulled by the slave HC - false otherwise. */ public static byte[] synchronizeSlaveHostController(ModelNode operation, final PathAddress address, HostFileRepository fileRepository, ContentRepository contentRepository, boolean backup, byte[] oldHash) { ModelNode operationContentItem = operation.get(DeploymentAttributes.CONTENT_RESOURCE_ALL.getName()).get(0); byte[] newHash = operationContentItem.require(CONTENT_HASH.getName()).asBytes(); if (needRemoteContent(fileRepository, contentRepository, backup, oldHash)) { // backup DC needs to pull the content fileRepository.getDeploymentFiles(ModelContentReference.fromModelAddress(address, newHash)); } return newHash; }
if ((content.hasDefined(HASH))) { byte[] hash = content.require(HASH).asBytes(); File[] files = domainController.getLocalFileRepository().getDeploymentFiles(hash); if (files == null || files.length == 0) { remoteRepository.getDeploymentFiles(hash);
@Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == OperationContext.ResultAction.KEEP) { if (contentRepository != null) { //Master DC or backup if (oldHash != null && (newHash == null || !Arrays.equals(oldHash, newHash))) { // The old content is no longer used; clean from repos contentRepository.removeContent(ModelContentReference.fromModelAddress(address, oldHash)); } if (newHash != null) { contentRepository.addContentReference(ModelContentReference.fromModelAddress(address, newHash)); } } } else { if (fileRepository != null) { // backup DC needs to pull the content fileRepository.getDeploymentFiles(ModelContentReference.fromModelAddress(address, newHash)); } if (contentRepository != null) { if (newHash != null && (oldHash == null || !Arrays.equals(oldHash, newHash))) { // Due to rollback, the new content isn't used; clean from repos contentRepository.removeContent(ModelContentReference.fromModelAddress(address, newHash)); } } } } });
byte[] hash = content.require(HASH).asBytes(); ContentReference reference = ModelContentReference.fromModelAddress(addr, hash); File[] files = domainController.getLocalFileRepository().getDeploymentFiles(reference); if (files == null || files.length == 0) { remoteRepository.getDeploymentFiles(reference);
@Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == OperationContext.ResultAction.KEEP) { if (contentRepository != null) { //Master DC or backup if (oldHash != null && (newHash == null || !Arrays.equals(oldHash, newHash))) { // The old content is no longer used; clean from repos contentRepository.removeContent(ModelContentReference.fromModelAddress(address, oldHash)); } if (newHash != null) { contentRepository.addContentReference(ModelContentReference.fromModelAddress(address, newHash)); } } } else { if (fileRepository != null) { // backup DC needs to pull the content fileRepository.getDeploymentFiles(ModelContentReference.fromModelAddress(address, newHash)); } if (contentRepository != null) { if (newHash != null && (oldHash == null || !Arrays.equals(oldHash, newHash))) { // Due to rollback, the new content isn't used; clean from repos contentRepository.removeContent(ModelContentReference.fromModelAddress(address, newHash)); } } } } });
parameters.getFileRepository().getDeploymentFiles(reference); parameters.getContentRepository().addContentReference(reference);
byte[] hash = content.require(HASH).asBytes(); ContentReference reference = ModelContentReference.fromModelAddress(addr, hash); File[] files = domainController.getLocalFileRepository().getDeploymentFiles(reference); if (files == null || files.length == 0) { remoteRepository.getDeploymentFiles(reference);
parameters.getFileRepository().getDeploymentFiles(reference); parameters.getContentRepository().addContentReference(reference);
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); byte[] hash = HASH.validateOperation(operation).asBytesOrNull(); if (hash != null && fileRepository != null) { // Ensure the local repo has the files fileRepository.getDeploymentFiles(new ContentReference(address.toCLIStyleString(), hash)); } // Create and add the specialized resource type we use for this resource tree ManagedDMRContentTypeResource resource = new ManagedDMRContentTypeResource(address, childType, hash, contentRepository); context.addResource(PathAddress.EMPTY_ADDRESS, resource); } }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); byte[] hash = HASH.validateOperation(operation).asBytesOrNull(); if (hash != null && fileRepository != null) { // Ensure the local repo has the files fileRepository.getDeploymentFiles(new ContentReference(address.toCLIStyleString(), hash)); } // Create and add the specialized resource type we use for this resource tree ManagedDMRContentTypeResource resource = new ManagedDMRContentTypeResource(address, childType, hash, contentRepository); context.addResource(PathAddress.EMPTY_ADDRESS, resource); } }
final ModelNode contentDetails = content.getValue(); byte[] hash = contentDetails.require(CONTENT).asBytes(); File[] files = domainController.getLocalFileRepository().getDeploymentFiles(hash); if (files == null || files.length == 0) { if (remoteRepository != null) { remoteRepository.getDeploymentFiles(hash);
byte[] hash = contentDetails.require(CONTENT).asBytes(); ContentReference reference = ModelContentReference.fromModelAddress(addr, hash); File[] files = domainController.getLocalFileRepository().getDeploymentFiles(reference); if (files == null || files.length == 0) { if (remoteRepository != null) { remoteRepository.getDeploymentFiles(reference);
byte[] hash = contentDetails.require(CONTENT).asBytes(); ContentReference reference = ModelContentReference.fromModelAddress(addr, hash); File[] files = domainController.getLocalFileRepository().getDeploymentFiles(reference); if (files == null || files.length == 0) { if (remoteRepository != null) { remoteRepository.getDeploymentFiles(reference);
ContentReference reference = ModelContentReference.fromModelAddress(address, content.require(HASH).asBytes()); fileRepository.getDeploymentFiles(reference); locallyAddedReferences.add(reference);
ContentReference reference = ModelContentReference.fromModelAddress(address, content.require(HASH).asBytes()); fileRepository.getDeploymentFiles(reference); locallyAddedReferences.add(reference);
byte[] hash = content.require(HASH).asBytes(); fileRepository.getDeploymentFiles(hash);
CONTENT_HASH.validateOperation(content); fileRepository.getDeploymentFiles(CONTENT_HASH.resolveModelAttribute(context, content).asBytes());
fileRepository.getDeploymentFiles(reference); if (contentRepository != null) { contentRepository.addContentReference(reference);
fileRepository.getDeploymentFiles(reference); if (contentRepository != null) { contentRepository.addContentReference(reference);