当前位置: 首页>>代码示例>>Java>>正文


Java OperationMessageHandler类代码示例

本文整理汇总了Java中org.jboss.as.controller.client.OperationMessageHandler的典型用法代码示例。如果您正苦于以下问题:Java OperationMessageHandler类的具体用法?Java OperationMessageHandler怎么用?Java OperationMessageHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OperationMessageHandler类属于org.jboss.as.controller.client包,在下文中一共展示了OperationMessageHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readLogFile

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
private void readLogFile(ModelNode opNode) throws IOException {

        Operation op = OperationBuilder.create(opNode).build();
        try (OperationResponse response = getModelControllerClient().executeOperation(op, OperationMessageHandler.DISCARD)) {

            ModelNode respNode = response.getResponseNode();
            Assert.assertEquals(respNode.toString(), "success", respNode.get("outcome").asString());
            Assert.assertEquals(respNode.toString(), ModelType.STRING, respNode.get("result").getType());
            String uuid = respNode.get("result").asString();
            List<? extends OperationResponse.StreamEntry> streams = response.getInputStreams();
            Assert.assertEquals(1, streams.size());
            OperationResponse.StreamEntry se = streams.get(0);
            Assert.assertEquals(uuid, se.getUUID());
            readLogStream(se.getStream());
        }

    }
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:ResponseAttachmentTestCase.java

示例2: readLogFile

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
private void readLogFile(ModelNode opNode, ModelControllerClient client, boolean forServer) throws IOException {
    Operation op = OperationBuilder.create(opNode).build();
    OperationResponse response = null;
    try {
        response = client.executeOperation(op, OperationMessageHandler.DISCARD);

        ModelNode respNode = response.getResponseNode();
        System.out.println(respNode.toString());
        Assert.assertEquals(respNode.toString(), "success", respNode.get("outcome").asString());
        ModelNode result = respNode.get("result");
        Assert.assertEquals(respNode.toString(), ModelType.STRING, result.getType());
        List<? extends OperationResponse.StreamEntry> streams = response.getInputStreams();
        Assert.assertEquals(1, streams.size());
        processResponseStream(response, result.asString(), forServer, client == masterClient);

    } finally {
        StreamUtils.safeClose(response);
    }

}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:ResponseStreamTestCase.java

示例3: execute

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
private OperationResponse execute(ModelNode request, boolean useWaitCursor) throws IOException {

        if(request.get(Util.OPERATION).asString().equals(Util.COMPOSITE) &&
                (!request.get(Util.STEPS).isDefined() || request.get(Util.STEPS).asList().isEmpty())) {
            return OperationResponse.Factory.createSimple(new ModelNode("WARN: no request was sent as there were no server-side operations to execute"));
        }

        try {
            if (useWaitCursor) {
                cliGuiCtx.getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            }
            return client.get().executeOperation(OperationBuilder.create(request).build(), OperationMessageHandler.DISCARD);
        } finally {
            if (useWaitCursor) {
                cliGuiCtx.getMainWindow().setCursor(Cursor.getDefaultCursor());
            }
        }
    }
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:19,代码来源:CommandExecutor.java

示例4: execute

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
/**
 * Executes an operation on the controller
 * @param operation the operation
 * @param handler the handler
 * @param control the transaction control
 * @param attachments the operation attachments
 * @return the result of the operation
 */
@Override
public ModelNode execute(final ModelNode operation, final OperationMessageHandler handler, final OperationTransactionControl control, final OperationAttachments attachments) {
    SecurityIdentity securityIdentity = securityIdentitySupplier.get();
    OperationResponse or = securityIdentity.runAs((PrivilegedAction<OperationResponse>) () -> internalExecute(operation,
            handler, control, attachments, prepareStep, false, partialModelIndicator.isModelPartial()));

    ModelNode result = or.getResponseNode();
    try {
        or.close();
    } catch (IOException e) {
        ROOT_LOGGER.debugf(e, "Caught exception closing response to %s whose associated streams, " +
                "if any, were not wanted", operation);
    }
    return result;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:24,代码来源:ModelControllerImpl.java

示例5: setup

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
@Before
public void setup() {
    root = ManagementResourceRegistration.Factory.forProcessType(ProcessType.HOST_CONTROLLER).createRegistration(new SimpleResourceDefinition(null, new NonResolvingResourceDescriptionResolver()));
    proxyController = new ProxyController() {
        @Override
        public PathAddress getProxyNodeAddress() {
            return PathAddress.pathAddress(PROXY_ELEMENT);
        }

        @Override
        public void execute(ModelNode operation, OperationMessageHandler handler, ProxyOperationControl control, OperationAttachments attachments, BlockingTimeout blockingTimeout) {
            throw new UnsupportedOperationException();
        }
    };
    root.registerProxyController(PROXY_ELEMENT, proxyController);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:ProxyControllerRegistrationUnitTestCase.java

示例6: execute

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
@Override
public void execute(ModelNode operation, OperationMessageHandler handler, final ProxyOperationControl control, OperationAttachments attachments, BlockingTimeout blockingTimeout) {
    final ModelNode response = new ModelNode();
    response.get("outcome").set("success");
    response.get("result", "attr").set(true);

    control.operationPrepared(new ModelController.OperationTransaction() {
        @Override
        public void commit() {
            control.operationCompleted(OperationResponse.Factory.createSimple(response));
        }

        @Override
        public void rollback() {
            control.operationCompleted(OperationResponse.Factory.createSimple(response));
        }
    }, response);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:19,代码来源:ReadResourceWithRuntimeResourceTestCase.java

示例7: readResource

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
/**
 * This returns information on the resource at the given address, recursively
 * returning child nodes with the result if recursive argument is set to <code>true</code>.
 * This will not return an exception if the address points to a non-existent resource, rather,
 * it will just return null. You can use this as a test for resource existence.
 *
 * @param addr the address of the resource
 * @param recursive if true, return all child data within the resource node
 * @return the found item or null if not found
 * @throws Exception if some error prevented the lookup from even happening
 */
public ModelNode readResource(Address addr, boolean recursive) throws Exception {
    final ModelNode request = createRequest(READ_RESOURCE, addr);
    request.get("recursive").set(recursive);
    final ModelNode results = getModelControllerClient().execute(request, OperationMessageHandler.logging);
    if (isSuccess(results)) {
        final ModelNode resource = getResults(results);
        return resource;
    } else {
        return null;
    }
}
 
开发者ID:hawkular,项目名称:hawkular-agent,代码行数:23,代码来源:JBossASClient.java

示例8: block

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
private Future<ModelNode> block(String host, String server, BlockerExtension.BlockPoint blockPoint) {
    ModelNode op = BLOCK_OP.clone();
    op.get(TARGET_HOST.getName()).set(host);
    if (server != null) {
        op.get(TARGET_SERVER.getName()).set(server);
    }
    op.get(BLOCK_POINT.getName()).set(blockPoint.toString());
    op.get(CALLER.getName()).set(getTestMethod());
    return masterClient.executeAsync(op, OperationMessageHandler.DISCARD);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:11,代码来源:OperationTimeoutTestCase.java

示例9: before

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
@Before
public void before() throws IOException {

    logMessageContent = String.valueOf(System.currentTimeMillis());
    ModelNode opNode = Util.createAddOperation(PathAddress.pathAddress(SYSTEM_PROPERTY, LogStreamExtension.LOG_MESSAGE_PROP));
    opNode.get(VALUE).set(logMessageContent);
    Operation op = OperationBuilder.create(opNode).build();
    masterClient.executeOperation(op, OperationMessageHandler.DISCARD);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:10,代码来源:ResponseStreamTestCase.java

示例10: after

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
@After
public void after() throws IOException {
    ModelNode opNode = Util.createEmptyOperation(REMOVE, PathAddress.pathAddress(SYSTEM_PROPERTY, LogStreamExtension.LOG_MESSAGE_PROP));
    Operation op = OperationBuilder.create(opNode).build();
    masterClient.executeOperation(op, OperationMessageHandler.DISCARD);

    shutdownHttpClient();

}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:10,代码来源:ResponseStreamTestCase.java

示例11: testComposite

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
@Test
public void testComposite() throws IOException {
    ModelNode composite = Util.createEmptyOperation(COMPOSITE, PathAddress.EMPTY_ADDRESS);
    ModelNode steps = composite.get(STEPS);
    steps.add(createReadAttributeOp(PathAddress.pathAddress(PROFILE, "default")));
    steps.add(createReadAttributeOp(PathAddress.pathAddress(HOST, "master").append(SERVER, "main-one")));
    steps.add(createReadAttributeOp(PathAddress.pathAddress(HOST, "slave").append(SERVER, "main-three")));
    Operation op = OperationBuilder.create(composite).build();
    OperationResponse response = null;
    try {
        response = masterClient.executeOperation(op, OperationMessageHandler.DISCARD);

        ModelNode respNode = response.getResponseNode();
        System.out.println(respNode.toString());
        Assert.assertEquals(respNode.toString(), "success", respNode.get("outcome").asString());
        List<? extends OperationResponse.StreamEntry> streams = response.getInputStreams();
        //Assert.assertEquals(3, streams.size());

        ModelNode result0 = respNode.get(RESULT, "step-1", RESULT);
        Assert.assertEquals(ModelType.STRING, result0.getType());
        String uuid = result0.asString();
        processResponseStream(response, uuid, false, true);

        ModelNode result1 = respNode.get(RESULT, "step-2", RESULT);
        Assert.assertEquals(ModelType.STRING, result1.getType());
        uuid = result1.asString();
        processResponseStream(response, uuid, true, false);

        ModelNode result2 = respNode.get(RESULT, "step-3", RESULT);
        Assert.assertEquals(ModelType.STRING, result2.getType());
        uuid = result2.asString();
        processResponseStream(response, uuid, true, false);

    } finally {
        StreamUtils.safeClose(response);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:38,代码来源:ResponseStreamTestCase.java

示例12: testSlaveBlockOtherOpCancelMaster

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
@Test
public void testSlaveBlockOtherOpCancelMaster() throws Exception {
    long start = System.currentTimeMillis();
    Future<ModelNode> blockFuture = block("slave", null, BlockerExtension.BlockPoint.MODEL);
    String blockId = findActiveOperation(masterClient, "slave", null, "block", null, start);
    Future<ModelNode> writeFuture = masterClient.executeAsync(WRITE_FOO_OP, OperationMessageHandler.DISCARD);
    cancel(masterClient, "master", null, "write-attribute", OperationContext.ExecutionStatus.AWAITING_OTHER_OPERATION, start, false);
    ModelNode response = writeFuture.get(GET_TIMEOUT, TimeUnit.MILLISECONDS);
    assertEquals(response.asString(), CANCELLED, response.get(OUTCOME).asString());
    blockFuture.cancel(true);
    validateNoActiveOperation(masterClient, "slave", null, blockId, true);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:13,代码来源:OperationCancellationTestCase.java

示例13: execute

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
@Override
public ModelNode execute(Operation operation, OperationMessageHandler handler, OperationTransactionControl control,
        OperationStepHandler step) {
    Function<DomainModelControllerService, OperationResponse> function = new Function<DomainModelControllerService, OperationResponse>() {
        @Override
        public OperationResponse apply(DomainModelControllerService controllerService) {
            return InVmAccess.runInVm((PrivilegedAction<OperationResponse>) () -> controllerService.internalExecute(operation, handler, control, step));
        }
    };
    return SecurityActions.privilegedExecution(function, DomainModelControllerService.this).getResponseNode();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:12,代码来源:DomainModelControllerService.java

示例14: installSlaveExtensions

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
@Override
public ModelNode installSlaveExtensions(List<ModelNode> extensions) {
    Operation operation = ApplyExtensionsHandler.getOperation(extensions);
    OperationStepHandler stepHandler = modelNodeRegistration.getOperationHandler(PathAddress.EMPTY_ADDRESS, ApplyExtensionsHandler.OPERATION_NAME);
    Function<DomainModelControllerService, OperationResponse> function = new Function<DomainModelControllerService, OperationResponse>() {
        @Override
        public OperationResponse apply(DomainModelControllerService controllerService) {
            return InVmAccess.runInVm((PrivilegedAction<OperationResponse>) () -> controllerService.internalExecute(operation, OperationMessageHandler.logging, OperationTransactionControl.COMMIT, stepHandler, false, true));
        }
    };
    return SecurityActions.privilegedExecution(function, DomainModelControllerService.this).getResponseNode();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:13,代码来源:DomainModelControllerService.java

示例15: joinActiveOperation

import org.jboss.as.controller.client.OperationMessageHandler; //导入依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public ModelNode joinActiveOperation(ModelNode operation, OperationMessageHandler handler,
                                     OperationTransactionControl control,
                                     OperationStepHandler step, int permit) {
    Function<DomainModelControllerService, ModelNode> function = new Function<DomainModelControllerService, ModelNode>() {
        @Override
        public ModelNode apply(DomainModelControllerService controllerService) {
            return InVmAccess.runInVm((PrivilegedAction<ModelNode>) () -> controllerService.executeReadOnlyOperation(operation, handler, control, step, permit));
        }
    };
    return SecurityActions.privilegedExecution(function, DomainModelControllerService.this);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:14,代码来源:DomainModelControllerService.java


注:本文中的org.jboss.as.controller.client.OperationMessageHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。