@Override public void deleteDeployment(byte[] deploymentHash) { localRepository.deleteDeployment(deploymentHash); }
@Override public File getDeploymentRoot(ContentReference reference) { final File file = localRepository.getDeploymentRoot(reference); if (!file.exists()) { return getFile(reference, DomainServerProtocol.PARAM_ROOT_ID_DEPLOYMENT); } return file; }
byte[] addFromHash(byte[] hash, String deploymentOverlayName, final String contentName, final OperationContext context) throws OperationFailedException { if(remoteRepository != null) { remoteRepository.getDeploymentFiles(hash); } if (!contentRepository.syncContent(hash)) { 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.DEPLOYMENT_LOGGER.reportAdminOnlyMissingDeploymentOverlayContent(HashUtil.bytesToHexString(hash), deploymentOverlayName, contentName); } else { throw ServerMessages.MESSAGES.noSuchDeploymentOverlayContentAtBoot(HashUtil.bytesToHexString(hash), deploymentOverlayName, contentName); } } else { throw ServerMessages.MESSAGES.noSuchDeploymentOverlayContent(HashUtil.bytesToHexString(hash)); } } return hash; }
byte[] addFromHash(byte[] hash, String deploymentOverlayName, final String contentName, final OperationContext context) throws OperationFailedException { if(remoteRepository != null) { remoteRepository.getDeploymentFiles(hash); } if (!contentRepository.syncContent(hash)) { 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.DEPLOYMENT_LOGGER.reportAdminOnlyMissingDeploymentOverlayContent(HashUtil.bytesToHexString(hash), deploymentOverlayName, contentName); } else { throw ServerMessages.MESSAGES.noSuchDeploymentOverlayContentAtBoot(HashUtil.bytesToHexString(hash), deploymentOverlayName, contentName); } } else { throw ServerMessages.MESSAGES.noSuchDeploymentOverlayContent(HashUtil.bytesToHexString(hash)); } } return hash; }
@Override public File getDeploymentRoot(ContentReference reference) { final File file = localRepository.getDeploymentRoot(reference); if (!file.exists()) { return getFile(reference, DomainServerProtocol.PARAM_ROOT_ID_DEPLOYMENT); } return file; }
@Override public void deleteDeployment(byte[] deploymentHash) { localRepository.deleteDeployment(deploymentHash); }
byte[] addFromHash(byte[] hash, String deploymentOverlayName, final String contentName, final PathAddress address, final OperationContext context) throws OperationFailedException { ContentReference reference = ModelContentReference.fromModelAddress(address, hash); if(remoteRepository != null) { remoteRepository.getDeploymentFiles(reference); } 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.reportAdminOnlyMissingDeploymentOverlayContent(HashUtil.bytesToHexString(hash), deploymentOverlayName, contentName); } else { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentOverlayContentAtBoot(HashUtil.bytesToHexString(hash), deploymentOverlayName, contentName); } } else { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentOverlayContent(HashUtil.bytesToHexString(hash)); } } return hash; }
public File readRootFile(byte rootId, String filePath) throws RequestProcessingException { byte[] hash = HashUtil.hexStringToByteArray(filePath); return deploymentFileRepository.getDeploymentRoot(hash); } };
@Override void removeContent(String name, List<byte[]> hashes) { for (byte[] hash : hashes) { try { if (fileRepository != null) { fileRepository.deleteDeployment(hash); } } catch (Exception e) { DEPLOYMENT_LOGGER.debugf(e, "Exception occurred removing %s", Arrays.asList(hash)); } } } }
byte[] addFromHash(byte[] hash, String deploymentOverlayName, final String contentName, final PathAddress address, final OperationContext context) throws OperationFailedException { ContentReference reference = ModelContentReference.fromModelAddress(address, hash); if(remoteRepository != null) { remoteRepository.getDeploymentFiles(reference); } 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.reportAdminOnlyMissingDeploymentOverlayContent(HashUtil.bytesToHexString(hash), deploymentOverlayName, contentName); } else { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentOverlayContentAtBoot(HashUtil.bytesToHexString(hash), deploymentOverlayName, contentName); } } else { throw ServerLogger.ROOT_LOGGER.noSuchDeploymentOverlayContent(HashUtil.bytesToHexString(hash)); } } return hash; }
@Override public File getDeploymentRoot(byte[] deploymentHash) { String hex = deploymentHash == null ? "" : HashUtil.bytesToHexString(deploymentHash); final File file = localRepository.getDeploymentRoot(deploymentHash); if(! file.exists()) { return getFile(hex, DomainServerProtocol.PARAM_ROOT_ID_DEPLOYMENT); } return file; }
@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); } }
@Override public File getDeploymentRoot(byte[] deploymentHash) { String hex = deploymentHash == null ? "" : HashUtil.bytesToHexString(deploymentHash); final File file = localRepository.getDeploymentRoot(deploymentHash); if(! file.exists()) { return getFile(hex, DomainServerProtocol.PARAM_ROOT_ID_DEPLOYMENT); } return file; }
@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); } }
public File readRootFile(byte rootId, String filePath) throws RequestProcessingException { byte[] hash = HashUtil.hexStringToByteArray(filePath); return deploymentFileRepository.getDeploymentRoot(new ContentReference(filePath, 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)); } } } }
public File readRootFile(byte rootId, String filePath) throws RequestProcessingException { byte[] hash = HashUtil.hexStringToByteArray(filePath); return deploymentFileRepository.getDeploymentRoot(new ContentReference(filePath, 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)); } } } }