Java Code Examples for org.jboss.as.controller.OperationContext#ResultAction

The following examples show how to use org.jboss.as.controller.OperationContext#ResultAction . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockerExtension.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) {
    if ((blockPoint == BlockPoint.COMMIT && resultAction == OperationContext.ResultAction.KEEP)
        || (blockPoint == BlockPoint.ROLLBACK && resultAction == OperationContext.ResultAction.ROLLBACK)) {
        block(blockTime);
    }
}
 
Example 2
Source File: GlobalOperationHandlers.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) {
    if(fakeOperationResponse != null && fakeOperationResponse.hasDefined(FAILURE_DESCRIPTION)) {
        context.getFailureDescription().set(fakeOperationResponse.get(FAILURE_DESCRIPTION));
        return;
    }
    // Report on filtering
    if (localFilteredData.hasFilteredData()) {
        context.getResponseHeaders().get(ACCESS_CONTROL).set(localFilteredData.toModelNode());
    }

    // Extract any failure info from the individual results and use them
    // to construct an overall failure description if necessary
    if (resultAction == OperationContext.ResultAction.ROLLBACK
            && !context.hasFailureDescription() && result.isDefined()) {
        String op = operation.require(OP).asString();
        Map<PathAddress, ModelNode> failures = new HashMap<PathAddress, ModelNode>();
        for (ModelNode resultItem : result.asList()) {
            if (resultItem.hasDefined(FAILURE_DESCRIPTION)) {
                final PathAddress failedAddress = PathAddress.pathAddress(resultItem.get(ADDRESS));
                ModelNode failedDesc = resultItem.get(FAILURE_DESCRIPTION);
                failures.put(failedAddress, failedDesc);
            }
        }

        if (failures.size() == 1) {
            Map.Entry<PathAddress, ModelNode> entry = failures.entrySet().iterator().next();
            if (entry.getValue().getType() == ModelType.STRING) {
                context.getFailureDescription().set(ControllerLogger.ROOT_LOGGER.wildcardOperationFailedAtSingleAddress(op, entry.getKey(), entry.getValue().asString()));
            } else {
                context.getFailureDescription().set(ControllerLogger.ROOT_LOGGER.wildcardOperationFailedAtSingleAddressWithComplexFailure(op, entry.getKey()));
            }
        } else if (failures.size() > 1) {
            context.getFailureDescription().set(ControllerLogger.ROOT_LOGGER.wildcardOperationFailedAtMultipleAddresses(op, failures.keySet()));
        }
    }
}
 
Example 3
Source File: TransactionalProtocolClientTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
OperationContext.ResultAction getAction() {
    try {
        return action.getIoFuture().getInterruptibly();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example 4
Source File: AuditLogger.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
void log(boolean readOnly, OperationContext.ResultAction resultAction, String userId, String domainUUID,
AccessMechanism accessMechanism, InetAddress remoteAddress, final Resource resultantModel, List<ModelNode> operations);
 
Example 5
Source File: TransactionalProtocolClientTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
OperationContext.ResultAction getResultAction() {
    return controller.getAction();
}
 
Example 6
Source File: TransactionalProtocolClientTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
void assertResultAction(final OperationContext.ResultAction expected) {
    Assert.assertEquals(expected, getResultAction());
    // controller.action = null;
}
 
Example 7
Source File: ServerSuspendHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void handleResult(OperationContext.ResultAction resultAction, OperationContext context, ModelNode operation) {
    if(resultAction == OperationContext.ResultAction.ROLLBACK) {
        controller.resume();
    }
}
 
Example 8
Source File: EarlyResponseSendListener.java    From wildfly-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Informs the management kernel that it is ok to send an early response to the operation.
 * <strong>Note:</strong> It is valid for this method to be invoked multiple times for the same
 * listener. It is the responsibility of the listener implementation to ensure that only one
 * response is sent to the caller.
 *
 * @param resultAction the result of the operation for which an early response is being sent
 */
void sendEarlyResponse(OperationContext.ResultAction resultAction);