public static byte[] removeContentFromExplodedAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws OperationFailedException, ExplodedContentException {
        final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS);
        ModelNode contentItemNode = getContentItem(deploymentResource);
        final byte[] oldHash = CONTENT_HASH.resolveModelAttribute(context, contentItemNode).asBytes();
        final List<String> paths = REMOVED_PATHS.unwrap(context, operation);
        final byte[] hash = contentRepository.removeContentFromExploded(oldHash, paths);

        // Clear the contents and update with the hash
        final ModelNode slave = operation.clone();
        slave.get(CONTENT).setEmptyList().add().get(HASH).set(hash);
        slave.get(CONTENT).add().get(ARCHIVE).set(false);
        // Add the domain op transformer
        List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
        if (transformers == null) {
            context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
        }
        transformers.add(new CompositeOperationAwareTransmuter(slave));
        return hash;
    }
public static byte [ ] removeContentFromExplodedAndTransformOperation ( OperationContext context , ModelNode operation , ContentRepository contentRepository ) throws OperationFailedException , ExplodedContentException { final Resource deploymentResource = context . readResource ( PathAddress . EMPTY_ADDRESS ) ; ModelNode contentItemNode = getContentItem ( deploymentResource ) ; final byte [ ] oldHash = CONTENT_HASH . resolveModelAttribute ( context , contentItemNode ) . asBytes ( ) ; final List < String > paths = REMOVED_PATHS . unwrap ( context , operation ) ; final byte [ ] hash = contentRepository . removeContentFromExploded ( oldHash , paths ) ; final ModelNode slave = operation . clone ( ) ; slave . get ( CONTENT ) . setEmptyList ( ) . add ( ) . get ( HASH ) . set ( hash ) ; slave . get ( CONTENT ) . add ( ) . get ( ARCHIVE ) . set ( false ) ; List < DomainOperationTransmuter > transformers = context . getAttachment ( OperationAttachments . SLAVE_SERVER_OPERATION_TRANSMUTERS ) ; if ( transformers == null ) { context . attach ( OperationAttachments . SLAVE_SERVER_OPERATION_TRANSMUTERS , transformers = new ArrayList < > ( ) ) ; } transformers . add ( new CompositeOperationAwareTransmuter ( slave ) ) ; return hash ; }
Remove contents from the deployment and attach a "transformed" slave operation to the operation context.

@param context the operation context
@param operation the original operation
@param contentRepository the content repository
@return the hash of the uploaded deployment content
@throws IOException
@throws OperationFailedException