@Override public byte[] addContent(InputStream stream) throws IOException { return contentRepository.addContent(stream); }
@Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == OperationContext.ResultAction.KEEP) { if (oldHash != null && contentRepository.hasContent(oldHash)) { contentRepository.removeContent(ModelContentReference.fromModelAddress(address, oldHash)); } if (contentRepository.hasContent(newHash)) { contentRepository.addContentReference(ModelContentReference.fromModelAddress(context.getCurrentAddress(), newHash)); } } // else the model update will be reverted and no ref content repo references changes will be made so // the newly exploded content will be eligible for content repo gc } });
@Override public VirtualFile getContent(byte[] hash) { return contentRepository.getContent(hash); }
@Override public void handleResult(ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == ResultAction.KEEP) { if (originalHash != null && newHash != null && !Arrays.equals(originalHash, newHash)) { contentRepository.removeContent(originalHash, name); if (contentRepository != null && newHash != null) { contentRepository.addContentReference(newHash, name); } } } else if (newHash != null) { contentRepository.removeContent(newHash, name); } } });
public void handleResult(ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == ResultAction.KEEP) { contentRepository.addContentReference(contentHash, name); } } });
@Override public void removeContent(ContentReference reference) { contentRepository.removeContent(reference); }
@Override public boolean hasContent(byte[] hash) { return contentRepository.hasContent(hash); }
@Override void removeContent(PathAddress address, Set<String> newHashes, List<byte[]> hashes) { for (byte[] hash : hashes) { try { if (contentRepository.hasContent(hash)) { contentRepository.removeContent(ModelContentReference.fromModelAddress(address, hash)); } else if (newHashes.isEmpty() || !newHashes.contains(HashUtil.bytesToHexString(hash))) { fileRepository.deleteDeployment(ModelContentReference.fromModelAddress(address, hash)); } else { ROOT_LOGGER.undeployingDeploymentHasBeenRedeployed(address.getLastElement().getValue()); } } catch (Exception e) { ROOT_LOGGER.debugf(e, "Exception occurred removing %s", Arrays.asList(hash)); } } } }
private void loadContent(byte[] initialHash) { VirtualFile vf = contentRepository.getContent(initialHash); if (vf == null) { throw ManagedDMRContentLogger.ROOT_LOGGER.noContentFoundWithHash(HashUtil.bytesToHexString(initialHash)); } InputStream is = null; try { is = vf.openStream(); ModelNode node = ModelNode.fromStream(is); if (node.isDefined()) { for (Property prop : node.asPropertyList()) { ModelNode value = prop.getValue(); byte[] hash = hashContent(value); synchronized (content) { content.put(prop.getName(), new ManagedContent(value, hash)); } } } this.model.get(ModelDescriptionConstants.HASH).set(initialHash); contentRepository.addContentReference(new ContentReference(address.toCLIStyleString(), initialHash)); } catch (IOException e) { throw new ContentStorageException(e); } finally { safeClose(is); } }
if (contentRepository != null && !contentRepository.hasContent(hash)) { if (context.isBooting()) { if (context.getRunningMode() == RunningMode.ADMIN_ONLY) { try { try { hash = contentRepository.addContent(in); } catch (IOException e) { throw createFailureException(e.toString());
protected void addFromHash(ContentReference reference) throws OperationFailedException { if (!contentRepository.syncContent(reference)) { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentContent(reference.getHexHash()); } }
final byte[] hash; if (explodedPath.isDefined()) { hash = contentRepository.explodeSubContent(oldHash, explodedPath.asString()); } else { hash = contentRepository.explodeContent(oldHash);
@Override public byte[] addContentToExploded(byte[] deploymentHash, List<ExplodedContent> addFiles, boolean overwrite) throws ExplodedContentException { return contentRepository.addContentToExploded(deploymentHash, addFiles, overwrite); }
@Override public byte[] explodeContent(byte[] hash) throws ExplodedContentException { return contentRepository.explodeContent(hash); }
@Override public byte[] explodeSubContent(byte[] deploymentHash, String relativePath) throws ExplodedContentException { return contentRepository.explodeSubContent(deploymentHash, relativePath); }
@Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == OperationContext.ResultAction.KEEP) { PathAddress address = context.getCurrentAddress(); contentRepository.removeContent(ModelContentReference.fromModelAddress(address, oldHash)); contentRepository.addContentReference(ModelContentReference.fromModelAddress(context.getCurrentAddress(), newHash)); } // else the model update will be reverted and no ref content repo references changes will be made so // the newly exploded content will be eligible for content repo gc } });
public void handleResult(ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == ResultAction.KEEP) { contentRepository.addContentReference(contentHash, name); } } });
@Override public void removeContent(byte[] hash, Object reference) { contentRepository.removeContent(hash, reference); }
@Override public boolean hasContent(byte[] hash) { return contentRepository.hasContent(hash); }
@Override void removeContent(PathAddress address, Set<String> newHashes, List<byte[]> hashes) { for (byte[] hash : hashes) { try { if (contentRepository.hasContent(hash)) { contentRepository.removeContent(ModelContentReference.fromModelAddress(address, hash)); } else if (newHashes.isEmpty() || !newHashes.contains(HashUtil.bytesToHexString(hash))) { fileRepository.deleteDeployment(ModelContentReference.fromModelAddress(address, hash)); } else { ROOT_LOGGER.undeployingDeploymentHasBeenRedeployed(address.getLastElement().getValue()); } } catch (Exception e) { ROOT_LOGGER.debugf(e, "Exception occurred removing %s", Arrays.asList(hash)); } } } }