@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 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 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 void execute(OperationContext context, ModelNode operation) throws OperationFailedException { if (context.getProcessType() == ProcessType.SELF_CONTAINED) { throw DomainControllerLogger.ROOT_LOGGER.cannotReadContentFromSelfContainedServer(); } final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS); ModelNode contentItemNode = getContentItem(deploymentResource); // Validate this op is available if (!isManaged(contentItemNode)) { throw DomainControllerLogger.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 new OperationFailedException(ex.getMessage()); } }
@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 void execute(OperationContext context, ModelNode operation) throws OperationFailedException { if (context.getProcessType() == ProcessType.SELF_CONTAINED) { throw DomainControllerLogger.ROOT_LOGGER.cannotReadContentFromSelfContainedServer(); } final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS); ModelNode contentItemNode = getContentItem(deploymentResource); // Validate this op is available if (!isManaged(contentItemNode)) { throw DomainControllerLogger.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 new OperationFailedException(ex.getMessage()); } }