public static byte [ ] storeContentAndTransformOperation ( OperationContext context , ModelNode operation , ContentRepository contentRepository ) throws IOException , OperationFailedException { if ( ! operation . hasDefined ( CONTENT ) ) { throw createFailureException ( DomainControllerLogger . ROOT_LOGGER . invalidContentDeclaration ( ) ) ; } final ModelNode content = operation . get ( CONTENT ) . get ( 0 ) ; if ( content . hasDefined ( HASH ) ) { // This should be handled as part of the OSH throw createFailureException ( DomainControllerLogger . ROOT_LOGGER . invalidContentDeclaration ( ) ) ; } final byte [ ] hash = storeDeploymentContent ( context , operation , contentRepository ) ; // Clear the contents and update with the hash final ModelNode slave = operation . clone ( ) ; slave . get ( CONTENT ) . setEmptyList ( ) . add ( ) . get ( HASH ) . set ( hash ) ; // 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 ; }
Store the deployment contents and attach a transformed slave operation to the operation context .