/** {@inheritDoc} */ @Override public File getDeploymentRoot(ContentReference reference) { if (reference == null || reference.getHexHash().isEmpty()) { return deploymentRoot; } File first = new File(deploymentRoot, reference.getHexHash().substring(0,2)); return new File(first, reference.getHexHash().substring(2)); }
@Override public void addContentReference(ContentReference reference) { if(!this.readWrite) { return; } synchronized (contentHashReferences) { Set<ContentReference> references = contentHashReferences.get(reference.getHexHash()); if (references == null) { references = new HashSet<>(); contentHashReferences.put(reference.getHexHash(), references); } references.add(reference); } }
/** {@inheritDoc} */ @Override public File getDeploymentRoot(ContentReference reference) { if (reference == null || reference.getHexHash().isEmpty()) { return deploymentRoot; } String hex = reference.getHexHash(); File first = new File(deploymentRoot, hex.substring(0,2)); return new File(first, hex.substring(2)); }
/** * Mark content as obsolete. If content was already marked for obsolescenceTimeout ms then it is removed. * * @param ref the content refrence to be marked as obsolete. * * @return true if the content refrence is removed, fale otherwise. */ private boolean markAsObsolete(ContentReference ref) { if (obsoleteContents.containsKey(ref.getHexHash())) { //This content is already marked as obsolete if (obsoleteContents.get(ref.getHexHash()) + obsolescenceTimeout < System.currentTimeMillis()) { DeploymentRepositoryLogger.ROOT_LOGGER.obsoleteContentCleaned(ref.getContentIdentifier()); removeContent(ref); return true; } } else { obsoleteContents.put(ref.getHexHash(), System.currentTimeMillis()); //Mark content as obsolete } return false; }
@Override public File getDeploymentRoot(ContentReference reference) { File file = localFileRepository.getDeploymentRoot(reference); if(! file.exists()) { return getFile(reference.getHexHash(), DomainControllerProtocol.PARAM_ROOT_ID_DEPLOYMENT); } return file; }
@Override public File getDeploymentRoot(ContentReference reference) { File file = localFileRepository.getDeploymentRoot(reference); if(! file.exists()) { return getFile(reference.getHexHash(), DomainControllerProtocol.PARAM_ROOT_ID_DEPLOYMENT); } return file; }
protected void addFromHash(ContentReference reference) throws OperationFailedException { if (!contentRepository.syncContent(reference)) { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentContent(reference.getHexHash()); } }
protected void addFromHash(ContentReference reference) throws OperationFailedException { if (!contentRepository.syncContent(reference)) { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentContent(reference.getHexHash()); } }
return Collections.emptyMap(); if (!contentHashReferences.containsKey(fsContent.getHexHash())) { //We have no reference to this content if (markAsObsolete(fsContent)) { cleanedContents.get(DELETED_CONTENT).add(fsContent.getContentIdentifier()); obsoleteContents.remove(fsContent.getHexHash()); //Remove existing references from obsoleteContents
private File getFile(final ContentReference reference, final byte repoId) { final RemoteFileRepositoryExecutor executor = this.remoteFileRepositoryExecutor; if (executor == null) { throw ServerLogger.ROOT_LOGGER.couldNotFindHcFileRepositoryConnection(); } File file = remoteFileRepositoryExecutor.getFile(reference.getHexHash(), repoId, localDeploymentFolder); addContentReference(reference); return file; }
private File getFile(final ContentReference reference, final byte repoId) { final RemoteFileRepositoryExecutor executor = this.remoteFileRepositoryExecutor; if (executor == null) { throw ServerLogger.ROOT_LOGGER.couldNotFindHcFileRepositoryConnection(); } File file = remoteFileRepositoryExecutor.getFile(reference.getHexHash(), repoId, localDeploymentFolder); addContentReference(reference); return file; }
DeploymentHandlerUtil.ContentItem addFromHash(ContentReference reference) throws OperationFailedException { if (!contentRepository.syncContent(reference)) { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentContent(reference.getHexHash()); } return new DeploymentHandlerUtil.ContentItem(reference.getHash()); }
final Set<ContentReference> references = contentHashReferences.get(reference.getHexHash()); if (references != null) { references.remove(reference); return; contentHashReferences.remove(reference.getHexHash()); if (!HashUtil.isEachHexHashInTable(reference.getHexHash())) { contentPath = Paths.get(reference.getContentIdentifier()); } else { if (HashUtil.isEachHexHashInTable(reference.getHexHash()) && this.readWrite) { //Otherwise this is not a deployment content if(!lock(reference.getHash())) { DeploymentRepositoryLogger.ROOT_LOGGER.contentDeletionError(DeploymentRepositoryLogger.ROOT_LOGGER.errorLockingDeployment(), contentPath.toString()); DeploymentRepositoryLogger.ROOT_LOGGER.contentDeletionError(ex, contentPath.toString()); } finally { if (HashUtil.isEachHexHashInTable(reference.getHexHash())) { unlock(reference.getHash());
DeploymentHandlerUtil.ContentItem addFromHash(ContentReference reference) throws OperationFailedException { if (!contentRepository.syncContent(reference)) { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentContent(reference.getHexHash()); } return new DeploymentHandlerUtil.ContentItem(reference.getHash()); }
public static byte[] addFromHash(ContentRepository contentRepository, ModelNode contentItemNode, String deploymentName, PathAddress address, OperationContext context) throws OperationFailedException { byte[] hash = contentItemNode.require(CONTENT_HASH.getName()).asBytes(); ContentReference reference = ModelContentReference.fromModelAddress(address, hash); if (!contentRepository.syncContent(reference)) { if (context.isBooting()) { if (context.getRunningMode() == RunningMode.ADMIN_ONLY) { // The deployment content is missing, which would be a fatal boot error if we were going to actually // install services. In ADMIN-ONLY mode we allow it to give the admin a chance to correct the problem ServerLogger.ROOT_LOGGER.reportAdminOnlyMissingDeploymentContent(reference.getHexHash(), deploymentName); } else { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentContentAtBoot(reference.getHexHash(), deploymentName); } } else { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentContent(reference.getHexHash()); } } return hash; } }
public static byte[] addFromHash(ContentRepository contentRepository, ModelNode contentItemNode, String deploymentName, PathAddress address, OperationContext context) throws OperationFailedException { byte[] hash = contentItemNode.require(CONTENT_HASH.getName()).asBytes(); ContentReference reference = ModelContentReference.fromModelAddress(address, hash); if (!contentRepository.syncContent(reference)) { if (context.isBooting()) { if (context.getRunningMode() == RunningMode.ADMIN_ONLY) { // The deployment content is missing, which would be a fatal boot error if we were going to actually // install services. In ADMIN-ONLY mode we allow it to give the admin a chance to correct the problem ServerLogger.ROOT_LOGGER.reportAdminOnlyMissingDeploymentContent(reference.getHexHash(), deploymentName); } else { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentContentAtBoot(reference.getHexHash(), deploymentName); } } else { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentContent(reference.getHexHash()); } } return hash; } }