RemoteFileRepositoryService(final File localDeploymentFolder, final File localTmpFolder) { this.localDeploymentFolder = localDeploymentFolder; this.contentRepository = ContentRepository.Factory.create(localDeploymentFolder, localTmpFolder); this.localRepository = new LocalDeploymentFileRepository(localDeploymentFolder); }
@Override public List<ContentRepositoryElement> listContent(byte[] deploymentHash, String path, ContentFilter filter) throws ExplodedContentException { return contentRepository.listContent(deploymentHash, path, filter); } }
@Override public void stop(StopContext context) { remoteFileRepositoryExecutor = null; contentRepository.readOnly(); }
public void handleResult(ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == ResultAction.KEEP) { contentRepository.addContentReference(contentHash, name); } } });
@Override public boolean syncContent(ContentReference reference) { if (!contentRepository.hasContent(reference.getHash())) { getDeploymentFiles(reference); // Make sure it's in sync } return contentRepository.hasContent(reference.getHash()); }
@Override public byte[] addContent(InputStream stream) throws IOException { return contentRepository.addContent(stream); }
@Override public void deleteDeployment(ContentReference reference) { if (hasContent(reference.getHash())) {//Don't delete referenced content in the back removeContent(reference); } else { localRepository.deleteDeployment(reference); removeContent(reference); } }
protected void addFromHash(ContentReference reference) throws OperationFailedException { if (!contentRepository.syncContent(reference)) { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentContent(reference.getHexHash()); } }
@Override public boolean syncContent(ContentReference reference) { return hasContent(reference.getHash()); }
@Override public void deleteDeployment(ContentReference reference) { localFileRepository.deleteDeployment(reference); } }
@Override public File getFile(String relativePath, byte repoId, HostFileRepository localFileRepository) { return localFileRepository.getFile(relativePath); } });
/** * Hashes a path, if the path points to a directory then hashes the contents recursively. * @param messageDigest the digest used to hash. * @param path the file/directory we want to hash. * @return the resulting hash. * @throws IOException */ public static byte[] hashPath(MessageDigest messageDigest, Path path) throws IOException { try (InputStream in = getRecursiveContentStream(path)) { return hashContent(messageDigest, in); } }
@Override public TypedInputStream readContent(byte[] deploymentHash, String path) throws ExplodedContentException { return contentRepository.readContent(deploymentHash, path); }
RemoteFileRepositoryService(final File localDeploymentFolder) { this.localDeploymentFolder = localDeploymentFolder; this.contentRepository = ContentRepository.Factory.create(localDeploymentFolder); this.localRepository = new LocalDeploymentFileRepository(localDeploymentFolder); }
public void handleResult(ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == ResultAction.KEEP) { contentRepository.addContentReference(contentHash, name); } } });
RemoteFileRepositoryService(final File localDeploymentFolder, final File localTmpFolder) { this.localDeploymentFolder = localDeploymentFolder; this.contentRepository = ContentRepository.Factory.create(localDeploymentFolder, localTmpFolder); this.localRepository = new LocalDeploymentFileRepository(localDeploymentFolder); }
public void handleResult(ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == ResultAction.KEEP) { contentRepository.addContentReference(contentHash, name); } } });
RemoteFileRepositoryService(final File localDeploymentFolder) { this.localDeploymentFolder = localDeploymentFolder; this.contentRepository = ContentRepository.Factory.create(localDeploymentFolder); this.localRepository = new LocalDeploymentFileRepository(localDeploymentFolder); }
@Override public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) { if (resultAction == OperationContext.ResultAction.KEEP) { //check that if this is a server group level op the referenced deployment overlay exists if (contentRepository != null && shouldCreateResource) { for(ContentReference reference : locallyAddedReferences) { contentRepository.addContentReference(reference); } } } } });
@Override public void addContentReference(ContentReference reference) { contentRepository.addContentReference(reference); }