@Override public final ExplodedContentException archiveNotFound(final String path) { final ExplodedContentException result = new ExplodedContentException(String.format(getLoggingLocale(), archiveNotFound$str(), path)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } @Override
@Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); Resource resource = context.getOriginalRootResource(); for (final PathElement element : address) { resource = resource.getChild(element); } byte[] contentHash = resource.getModel().get(CONTENT).asBytes(); try { TypedInputStream inputStream = contentRepository.readContent(contentHash, ""); String uuid = context.attachResultStream(inputStream.getContentType(), inputStream); context.getResult().get(UUID).set(uuid); } catch (ExplodedContentException ex) { throw new RuntimeException(ex.getMessage(), ex); } } }
@Override public byte[] addContentToExploded(byte[] deploymentHash, List<ExplodedContent> addFiles, boolean overwrite) throws ExplodedContentException { byte[] result = super.addContentToExploded(deploymentHash, addFiles, overwrite); if (!Arrays.equals(deploymentHash, result)) { final Path realFile = getDeploymentContentFile(result, true); try (Git git = gitRepository.getGit()) { git.add().addFilepattern(gitRepository.getPattern(realFile)).call(); } catch (GitAPIException ex) { throw new ExplodedContentException(ex.getMessage(), ex); } } return result; }
throw createFailureException(ex.toString());
@Override public byte[] removeContentFromExploded(byte[] deploymentHash, List<String> paths) throws ExplodedContentException { byte[] result = super.removeContentFromExploded(deploymentHash, paths); if (!Arrays.equals(deploymentHash, result)) { final Path realFile = getDeploymentContentFile(result, true); try (Git git = gitRepository.getGit()) { git.add().addFilepattern(gitRepository.getPattern(realFile)).call(); } catch (GitAPIException ex) { throw new ExplodedContentException(ex.getMessage(), ex); } } return result; }
throw createFailureException(ex.toString());
@Override public final ExplodedContentException errorLockingDeployment() { final ExplodedContentException result = new ExplodedContentException(String.format(getLoggingLocale(), errorLockingDeployment$str())); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String errorAccessingDeployment = "WFLYDR0020: Error accessing deployment files";
@Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); Resource resource = context.getOriginalRootResource(); for (final PathElement element : address) { resource = resource.getChild(element); } byte[] contentHash = resource.getModel().get(CONTENT).asBytes(); try { TypedInputStream inputStream = contentRepository.readContent(contentHash, ""); String uuid = context.attachResultStream(inputStream.getContentType(), inputStream); context.getResult().get(UUID).set(uuid); } catch (ExplodedContentException ex) { throw new RuntimeException(ex.getMessage(), ex); } } }
@Override public byte[] explodeSubContent(byte[] deploymentHash, String relativePath) throws ExplodedContentException { byte[] result = super.explodeSubContent(deploymentHash, relativePath); if (!Arrays.equals(deploymentHash, result)) { final Path realFile = getDeploymentContentFile(result, true); try (Git git = gitRepository.getGit()) { git.add().addFilepattern(gitRepository.getPattern(realFile)).call(); } catch (GitAPIException ex) { throw new ExplodedContentException(ex.getMessage(), ex); } } return result; }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { if (context.getProcessType() == ProcessType.SELF_CONTAINED) { throw ServerLogger.ROOT_LOGGER.cannotReadContentFromSelfContainedServer(); } final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS); ModelNode contentItemNode = getContentItem(deploymentResource); // Validate this op is available if (!isManaged(contentItemNode)) { throw ServerLogger.ROOT_LOGGER.cannotReadContentFromUnmanagedDeployment(); } final byte[] deploymentHash = CONTENT_HASH.resolveModelAttribute(context, contentItemNode).asBytes(); final ModelNode contentPath = CONTENT_PATH.resolveModelAttribute(context, operation); final String path = contentPath.isDefined() ? contentPath.asString() : ""; try { TypedInputStream inputStream = contentRepository.readContent(deploymentHash, path); String uuid = context.attachResultStream(inputStream.getContentType(), inputStream); context.getResult().get(UUID).set(uuid); } catch (ExplodedContentException ex) { throw createFailureException(ex.toString()); } }
@Override public final ExplodedContentException errorUpdatingDeployment(final Exception ex) { final ExplodedContentException result = new ExplodedContentException(String.format(getLoggingLocale(), errorUpdatingDeployment$str()), ex); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String errorCopyingDeployment = "WFLYDR0022: Error copying files of exploded deployment to %s";
newHash = DeploymentUploadUtil.removeContentFromExplodedAndTransformOperation(context, operation, contentRepository); } catch (ExplodedContentException e) { throw new OperationFailedException(e.getMessage());
@Override public byte[] explodeContent(byte[] deploymentHash) throws ExplodedContentException { byte[] result = super.explodeContent(deploymentHash); if (!Arrays.equals(deploymentHash, result)) { final Path realFile = getDeploymentContentFile(result, true); try (Git git = gitRepository.getGit()) { git.add().addFilepattern(gitRepository.getPattern(realFile)).call(); } catch (GitAPIException ex) { throw new ExplodedContentException(ex.getMessage(), ex); } } return result; }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { if (context.getProcessType() == ProcessType.SELF_CONTAINED) { throw ServerLogger.ROOT_LOGGER.cannotReadContentFromSelfContainedServer(); } final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS); ModelNode contentItemNode = getContentItem(deploymentResource); // Validate this op is available if (!isManaged(contentItemNode)) { throw ServerLogger.ROOT_LOGGER.cannotReadContentFromUnmanagedDeployment(); } final byte[] deploymentHash = CONTENT_HASH.resolveModelAttribute(context, contentItemNode).asBytes(); final ModelNode contentPath = CONTENT_PATH.resolveModelAttribute(context, operation); final String path = contentPath.isDefined() ? contentPath.asString() : ""; try { TypedInputStream inputStream = contentRepository.readContent(deploymentHash, path); String uuid = context.attachResultStream(inputStream.getContentType(), inputStream); context.getResult().get(UUID).set(uuid); } catch (ExplodedContentException ex) { throw createFailureException(ex.toString()); } }
@Override public final ExplodedContentException errorExplodingContent(final Exception ex, final String path) { final ExplodedContentException result = new ExplodedContentException(String.format(getLoggingLocale(), errorExplodingContent$str(), path), ex); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String errorLockingDeployment = "WFLYDR0019: Deployment is locked by another operation";
newHash = DeploymentUploadUtil.removeContentFromExplodedAndTransformOperation(context, operation, contentRepository); } catch (ExplodedContentException e) { throw new OperationFailedException(e.getMessage());
@Override public byte[] addContentToExploded(byte[] deploymentHash, List<ExplodedContent> addFiles, boolean overwrite) throws ExplodedContentException { byte[] result = super.addContentToExploded(deploymentHash, addFiles, overwrite); if (!Arrays.equals(deploymentHash, result)) { final Path realFile = getDeploymentContentFile(result, true); try (Git git = gitRepository.getGit()) { git.add().addFilepattern(gitRepository.getPattern(realFile)).call(); } catch (GitAPIException ex) { throw new ExplodedContentException(ex.getMessage(), ex); } } return result; }
newHash = contentRepository.addContentToExploded(oldHash, addedFiles, overwrite); } catch (ExplodedContentException e) { throw createFailureException(e.toString());
@Override public final ExplodedContentException errorAccessingDeployment(final Exception ex) { final ExplodedContentException result = new ExplodedContentException(String.format(getLoggingLocale(), errorAccessingDeployment$str()), ex); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String errorUpdatingDeployment = "WFLYDR0021: Error updating content of exploded deployment";
newHash = DeploymentUploadUtil.addContentToExplodedAndTransformOperation(context, operation, contentRepository); } catch (ExplodedContentException e) { throw new OperationFailedException(e.getMessage(), e);