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


Java Util.createEmptyOperation方法代码示例

本文整理汇总了Java中org.jboss.as.controller.operations.common.Util.createEmptyOperation方法的典型用法代码示例。如果您正苦于以下问题:Java Util.createEmptyOperation方法的具体用法?Java Util.createEmptyOperation怎么用?Java Util.createEmptyOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.as.controller.operations.common.Util的用法示例。


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

示例1: updateConfiguration

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
@Override
protected ServerMigrationTaskResult updateConfiguration(ModelNode config, S source, SubsystemResource subsystemResource, TaskContext taskContext, TaskEnvironment taskEnvironment) {
    final PathAddress subsystemPathAddress = subsystemResource.getResourcePathAddress();
    final ManageableServerConfiguration serverConfiguration = subsystemResource.getServerConfiguration();
    // read env properties
    final String httpConnectorName = taskEnvironment.getPropertyAsString(EnvironmentProperties.HTTP_CONNECTOR_NAME, DEFAULT_HTTP_CONNECTOR_NAME);
    final String connectorRefName = taskEnvironment.getPropertyAsString(EnvironmentProperties.CONNECTOR_REF_NAME, DEFAULT_CONNECTOR_REF_NAME);
    final String securityRealmName = taskEnvironment.getPropertyAsString(EnvironmentProperties.SECURITY_REALM_NAME, DEFAULT_SECURITY_REALM_NAME);
    // if not defined add http connector
    if (!config.hasDefined(HTTP_CONNECTOR, httpConnectorName)) {
        final PathAddress httpRemotingConnectorPathAddress = subsystemPathAddress.append(PathElement.pathElement(HTTP_CONNECTOR, httpConnectorName));
        final ModelNode httpRemotingConnectorAddOp = Util.createEmptyOperation(ADD, httpRemotingConnectorPathAddress);
        httpRemotingConnectorAddOp.get(CONNECTOR_REF).set(connectorRefName);
        httpRemotingConnectorAddOp.get(SECURITY_REALM).set(securityRealmName);
        serverConfiguration.executeManagementOperation(httpRemotingConnectorAddOp);
        taskContext.getLogger().debugf("Http connector %s added to Remoting subsystem configuration.", httpConnectorName);
        return ServerMigrationTaskResult.SUCCESS;
    } else {
        return ServerMigrationTaskResult.SKIPPED;
    }
}
 
开发者ID:emmartins,项目名称:wildfly-server-migration,代码行数:22,代码来源:AddHttpConnectorIfMissing.java

示例2: updateConfiguration

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
@Override
protected ServerMigrationTaskResult updateConfiguration(ModelNode config, S source, SubsystemResource subsystemResource, TaskContext context, TaskEnvironment taskEnvironment) {
    if (!config.hasDefined(DEFAULT_SFSB_CACHE_ATTR_NAME) || config.hasDefined(DEFAULT_SFSB_PASSIVATION_DISABLED_CACHE_ATTR_NAME)) {
        return ServerMigrationTaskResult.SKIPPED;
    }
    final PathAddress subsystemPathAddress = subsystemResource.getResourcePathAddress();
    final ManageableServerConfiguration configurationManagement = subsystemResource.getServerConfiguration();
    // /subsystem=ejb3:write-attribute(name=default-sfsb-passivation-disabled-cache,value=defaultSFSBCache)
    final String defaultSFSBCache = config.get(DEFAULT_SFSB_CACHE_ATTR_NAME).asString();
    final ModelNode op = Util.createEmptyOperation(WRITE_ATTRIBUTE_OPERATION, subsystemPathAddress);
    op.get(NAME).set(DEFAULT_SFSB_PASSIVATION_DISABLED_CACHE_ATTR_NAME);
    op.get(VALUE).set(defaultSFSBCache);
    configurationManagement.executeManagementOperation(op);
    context.getLogger().debugf("EJB3 subsystem's 'default-sfsb-passivation-disabled-cache' attribute set to %s.", defaultSFSBCache);
    return ServerMigrationTaskResult.SUCCESS;
}
 
开发者ID:emmartins,项目名称:wildfly-server-migration,代码行数:17,代码来源:DefinePassivationDisabledCacheRef.java

示例3: SetManagementInterfacesHttpUpgradeEnabled

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
protected SetManagementInterfacesHttpUpgradeEnabled() {
    name(SUBTASK_NAME);
    skipPolicy(TaskSkipPolicy.skipIfDefaultTaskSkipPropertyIsSet());
    final ManageableResourceTaskRunnableBuilder<S, ManagementInterfaceResource> runnableBuilder = params -> context -> {
        // check if attribute is defined
        final ManagementInterfaceResource resource = params.getResource();
        final ModelNode resourceConfig = resource.getResourceConfiguration();
        if (resourceConfig.hasDefined(HTTP_UPGRADE_ENABLED) && resourceConfig.get(HTTP_UPGRADE_ENABLED).asBoolean()) {
            context.getLogger().debugf("Management interface %s http upgrade already enabled.", MANAGEMENT_INTERFACE_NAME);
            return ServerMigrationTaskResult.SKIPPED;
        }
        // set attribute value
        final PathAddress pathAddress = resource.getResourcePathAddress();
        final ModelNode writeAttrOp = Util.createEmptyOperation(WRITE_ATTRIBUTE_OPERATION, pathAddress);
        writeAttrOp.get(NAME).set(HTTP_UPGRADE_ENABLED);
        writeAttrOp.get(VALUE).set(true);
        resource.getServerConfiguration().executeManagementOperation(writeAttrOp);
        context.getLogger().debugf("Management interface '%s' http upgrade enabled.", MANAGEMENT_INTERFACE_NAME);
        return ServerMigrationTaskResult.SUCCESS;
    };
    runBuilder(ManagementInterfaceResource.class, MANAGEMENT_INTERFACE_NAME, runnableBuilder);
}
 
开发者ID:emmartins,项目名称:wildfly-server-migration,代码行数:23,代码来源:SetupHttpUpgradeManagement.java

示例4: UpdateManagementHttpsSocketBindingPort

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
protected UpdateManagementHttpsSocketBindingPort() {
    name(SUBTASK_NAME);
    skipPolicyBuilders(buildParameters -> TaskSkipPolicy.skipIfDefaultTaskSkipPropertyIsSet(),
        buildParameters -> context -> !(buildParameters.getServerConfiguration() instanceof StandaloneServerConfiguration));
    final ManageableResourceTaskRunnableBuilder<S, SocketBindingResource> runnableBuilder = params -> context -> {
        final SocketBindingResource resource = params.getResource();
        final TaskEnvironment taskEnvironment = new TaskEnvironment(context.getMigrationEnvironment(), context.getTaskName());
        String envPropertyPort = taskEnvironment.getPropertyAsString("port");
        if (envPropertyPort == null || envPropertyPort.isEmpty()) {
            envPropertyPort = DEFAULT_PORT;
        }
        // management-https binding found, update port
        final PathAddress pathAddress = resource.getResourcePathAddress();
        final ModelNode writeAttrOp = Util.createEmptyOperation(WRITE_ATTRIBUTE_OPERATION, pathAddress);
        writeAttrOp.get(NAME).set(SOCKET_BINDING_PORT_ATTR);
        writeAttrOp.get(VALUE).set(envPropertyPort);
        resource.getServerConfiguration().executeManagementOperation(writeAttrOp);
        context.getLogger().debugf("Socket binding '%s' port set to "+envPropertyPort+".", SOCKET_BINDING_NAME);
        return ServerMigrationTaskResult.SUCCESS;
    };
    runBuilder(SocketBindingResource.class, SOCKET_BINDING_NAME, runnableBuilder);
}
 
开发者ID:emmartins,项目名称:wildfly-server-migration,代码行数:23,代码来源:SetupHttpUpgradeManagement.java

示例5: transformOperation

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
@Override
public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) throws OperationFailedException {
    ModelNode properties = operation.remove("properties");

    ModelNode composite = Util.createEmptyOperation("composite", PathAddress.EMPTY_ADDRESS);
    ModelNode steps = composite.get("steps");
    steps.add(operation);

    for (ModelNode property : properties.asList()) {
        Property prop = property.asProperty();
        ModelNode addProp = Util.createAddOperation(address.append("property", prop.getName()));
        addProp.get("value").set(prop.getValue());
        steps.add(addProp);
    }

    return new TransformedOperation(composite, TransformedOperation.ORIGINAL_RESULT);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:NewExtension.java

示例6: testListResourceLoaderPaths

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
@Test
public void testListResourceLoaderPaths() throws Exception {

    ModelNode op = Util.createEmptyOperation("list-resource-loader-paths", RESOURCE);
    op.get(MODULE).set("org.jboss.dmr");

    ModelNode response = getModelControllerClient().execute(op);
    List<ModelNode> hostResult = validateResponse(response).asList();
    Assert.assertTrue(hostResult.size() > 0);
    /* resource loader paths may come from maven repo
    for (ModelNode path : hostResult) {
        //result will different depending on if artifact or resource is in use
        Assert.assertTrue("Failed " + hostResult, path.asString().contains(LAYERS_BASE) || path.asString().matches(".*org.jboss.jboss-dmr.*"));
    }
    */
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:ModuleLoadingManagementTestCase.java

示例7: blockInVerifyTest

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
private void blockInVerifyTest(ModelNode header) throws InterruptedException, ExecutionException, TimeoutException {
    ModelNode op = Util.createEmptyOperation("block", null);
    op.get("start").set(true);
    if (header != null) {
        op.get(OPERATION_HEADERS, BLOCKING_TIMEOUT).set(header);
        System.setProperty(BlockingTimeout.SYSTEM_PROPERTY, "300");
    }

    Future<ModelNode> future = client.executeAsync(op, null);

    ModelNode response = future.get(20, TimeUnit.SECONDS);
    assertEquals(response.toString(), FAILED, response.get(OUTCOME).asString());
    assertTrue(response.toString(), response.get(FAILURE_DESCRIPTION).asString().contains(ControllerLogger.MGMT_OP_LOGGER.timeoutExecutingOperation()));

    assertEquals(ControlledProcessState.State.RESTART_REQUIRED, controllerService.getCurrentProcessState());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:OperationTimeoutUnitTestCase.java

示例8: createConfigurationChanges

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
public void createConfigurationChanges(ModelControllerClient client) throws Exception {
    ModelNode setAllowedOrigins = Util.createEmptyOperation("list-add", ALLOWED_ORIGINS_ADDRESS);
    setAllowedOrigins.get(ModelDescriptionConstants.NAME).set(ModelDescriptionConstants.ALLOWED_ORIGINS);
    setAllowedOrigins.get(ModelDescriptionConstants.VALUE).set("http://www.wildfly.org");
    client.execute(setAllowedOrigins);
    ModelNode setSystemProperty = Util.createAddOperation(SYSTEM_PROPERTY_ADDRESS);
    setSystemProperty.get(ModelDescriptionConstants.VALUE).set("changeConfig");
    client.execute(setSystemProperty);
    ModelNode unsetAllowedOrigins = Util.getUndefineAttributeOperation(ALLOWED_ORIGINS_ADDRESS, ModelDescriptionConstants.ALLOWED_ORIGINS);
    client.execute(unsetAllowedOrigins);
    ModelNode unsetSystemProperty = Util.createRemoveOperation(SYSTEM_PROPERTY_ADDRESS);
    client.execute(unsetSystemProperty);
    //read
    client.execute(Util.getReadAttributeOperation(ALLOWED_ORIGINS_ADDRESS, ModelDescriptionConstants.ALLOWED_ORIGINS));
    //invalid operation
    client.execute(Util.getUndefineAttributeOperation(ALLOWED_ORIGINS_ADDRESS, "not-exists-attribute"));
    //invalid operation
    client.execute(Util.getWriteAttributeOperation(ALLOWED_ORIGINS_ADDRESS, "not-exists-attribute", "123456"));
    //write operation, failed
    ModelNode setAllowedOriginsFails = Util.getWriteAttributeOperation(ALLOWED_ORIGINS_ADDRESS, ModelDescriptionConstants.ALLOWED_ORIGINS, "123456"); //wrong type, expected is LIST, op list-add
    client.execute(setAllowedOriginsFails);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:AbstractConfigurationChangesTestCase.java

示例9: executeInMainAndGetTheTransformedOperation

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
@Override
public TransformedOperation executeInMainAndGetTheTransformedOperation(ModelNode op, ModelVersion modelVersion) {
    try {
        ModelNode wrapper = Util.createEmptyOperation(TransformerAttachmentGrabber.DESC.getName(), PathAddress.EMPTY_ADDRESS);
        wrapper.get(VALUE).set(op);
        ModelTestUtils.checkOutcome(executeOperation(wrapper));

        try {
            return transformOperation(modelVersion, op, TransformerAttachmentGrabber.getAttachment());
        } catch (OperationFailedException e) {
            throw new RuntimeException(e);
        }
    } finally {
        TransformerAttachmentGrabber.clear();
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:MainKernelServicesImpl.java

示例10: validateNoActiveOperation

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
private void validateNoActiveOperation(DomainClient client, String host, String server, String id,
                                       boolean patient) throws Exception {
    PathAddress address = getManagementControllerAddress(host, server);
    address = address.append(PathElement.pathElement(ACTIVE_OPERATION, id));
    ModelNode op = Util.createEmptyOperation(READ_ATTRIBUTE_OPERATION, address);
    op.get(NAME).set(OP);

    // The op should clear w/in a few ms but we'll wait up to 5 secs just in case
    // something strange is happening on the machine is overloaded
    long timeout = patient ? System.currentTimeMillis() + TimeoutUtil.adjust(5000) : 0;
    MgmtOperationException failure;
    do {
        try {
            executeForFailure(op, client);
            return;
        } catch (MgmtOperationException moe) {
            if (!patient) {
                throw moe;
            }
            failure = moe;
        }
        Thread.sleep(50);
    } while (System.currentTimeMillis() < timeout);

    throw failure;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:27,代码来源:OperationCancellationTestCase.java

示例11: getResourceConfiguration

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
@Override
public ModelNode getResourceConfiguration() {
    // ensure resource exists
    if (!isExistentResource()) {
        return null;
    }
    // get resource
    final PathAddress address = getResourcePathAddress();
    final ModelNode op = Util.createEmptyOperation(READ_RESOURCE_OPERATION, address);
    op.get(RECURSIVE).set(true);
    final ModelNode result = serverConfiguration.executeManagementOperation(op);
    return result.get(RESULT);
}
 
开发者ID:emmartins,项目名称:wildfly-server-migration,代码行数:14,代码来源:AbstractManageableResource.java

示例12: SetUnsecureInterfaceInetAddress

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
protected SetUnsecureInterfaceInetAddress() {
    name(SUBTASK_NAME);
    skipPolicy(skipIfDefaultTaskSkipPropertyIsSet());
    final ManageableResourceTaskRunnableBuilder<S, InterfaceResource> runnableBuilder = params -> context -> {
        final InterfaceResource resource = params.getResource();
        final ModelNode resourceConfig = params.getResource().getResourceConfiguration();
        if (resourceConfig == null) {
            context.getLogger().debugf("Interface %s does not exists.", INTERFACE_NAME);
            return ServerMigrationTaskResult.SKIPPED;
        }
        // check if attribute is defined
        if (resourceConfig.hasDefined(INET_ADDRESS)) {
            context.getLogger().debugf("Interface %s inet address already defined.", INTERFACE_NAME);
            return ServerMigrationTaskResult.SKIPPED;
        }
        // set attribute value
        final ValueExpression valueExpression = new ValueExpression("${jboss.bind.address.unsecure:127.0.0.1}");
        final PathAddress pathAddress = resource.getResourcePathAddress();
        final ModelNode writeAttrOp = Util.createEmptyOperation(WRITE_ATTRIBUTE_OPERATION, pathAddress);
        writeAttrOp.get(NAME).set(INET_ADDRESS);
        writeAttrOp.get(VALUE).set(valueExpression);
        resource.getServerConfiguration().executeManagementOperation(writeAttrOp);
        context.getLogger().debugf("Interface %s inet address value set as %s.", INTERFACE_NAME, valueExpression.getExpressionString());
        return ServerMigrationTaskResult.SUCCESS;
    };
    runBuilder(runnableBuilder);
}
 
开发者ID:emmartins,项目名称:wildfly-server-migration,代码行数:28,代码来源:UpdateUnsecureInterface.java

示例13: UpdateSocketBindings

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
protected UpdateSocketBindings() {
    nameBuilder(params -> new ServerMigrationTaskName.Builder(TASK_NAME+".update-socket-binding-group-"+params.getResource().getResourceName()).build());
    skipPolicy(TaskSkipPolicy.skipIfDefaultTaskSkipPropertyIsSet());
    final ManageableResourceTaskRunnableBuilder<S, SocketBindingGroupResource> runnableBuilder = params -> context -> {
        final List<String> updated = new ArrayList<>();
        for (String socketBinding : SOCKET_BINDING_NAMES) {
            SocketBindingResource socketBindingResource = params.getResource().getSocketBindingResource(socketBinding);
            if (socketBindingResource != null) {
                ModelNode config = socketBindingResource.getResourceConfiguration();
                if (config != null) {
                    if (!config.hasDefined(INTERFACE) || !config.get(INTERFACE).asString().equals(INTERFACE_NAME)) {
                        final PathAddress pathAddress = socketBindingResource.getResourcePathAddress();
                        final ModelNode writeAttrOp = Util.createEmptyOperation(WRITE_ATTRIBUTE_OPERATION, pathAddress);
                        writeAttrOp.get(NAME).set(INTERFACE);
                        writeAttrOp.get(VALUE).set(INTERFACE_NAME);
                        socketBindingResource.getServerConfiguration().executeManagementOperation(writeAttrOp);
                        context.getLogger().debugf("Socket binding %s interface set to %s", socketBindingResource.getResourceAbsoluteName(), INTERFACE_NAME);
                        updated.add(socketBinding);
                    }
                }
            }
        }
        if (updated.isEmpty()) {
            return ServerMigrationTaskResult.SKIPPED;
        } else {
            return new ServerMigrationTaskResult.Builder().success().addAttribute("updated", updated.toString()).build();
        }
    };
    runBuilder(runnableBuilder);
}
 
开发者ID:emmartins,项目名称:wildfly-server-migration,代码行数:31,代码来源:AddPrivateInterface.java

示例14: updateConfiguration

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
@Override
protected ServerMigrationTaskResult updateConfiguration(ModelNode config, S source, SubsystemResource subsystemResource, TaskContext context, TaskEnvironment taskEnvironment) {
    final PathAddress subsystemPathAddress = subsystemResource.getResourcePathAddress();
    final ManageableServerConfiguration configurationManagement = subsystemResource.getServerConfiguration();
    // read env properties
    final List<String> legacyModuleNames = taskEnvironment.getPropertyAsList(EnvironmentProperties.LEGACY_MODULE_NAMES, DEFAULT_LEGACY_MODULE_NAMES);
    final String newModuleName = taskEnvironment.getPropertyAsString(EnvironmentProperties.NEW_MODULE_NAME, DEFAULT_NEW_MODULE_NAME);
    // do migration
    if (!config.hasDefined(CACHE_CONTAINER)) {
        context.getLogger().debugf("No Cache container");
        return ServerMigrationTaskResult.SKIPPED;
    }
    boolean configUpdated = false;
    for (String cacheName : config.get(CACHE_CONTAINER).keys()) {
        final ModelNode cache = config.get(CACHE_CONTAINER, cacheName);
        if (cache.hasDefined(MODULE_ATTR_NAME)) {
            if (legacyModuleNames.contains(cache.get(MODULE_ATTR_NAME).asString())) {
                // /subsystem=infinispan/cache-container=cacheName:write-attribute(name=MODULE_ATTR_NAME,value=MODULE_ATTR_NEW_VALUE)
                final ModelNode op = Util.createEmptyOperation(WRITE_ATTRIBUTE_OPERATION, subsystemPathAddress.append(pathElement(CACHE_CONTAINER, cacheName)));
                op.get(NAME).set(MODULE_ATTR_NAME);
                op.get(VALUE).set(newModuleName);
                configurationManagement.executeManagementOperation(op);
                configUpdated = true;
                context.getLogger().debugf("Infinispan subsystem's cache %s 'module' attribute updated to %s.", cacheName, newModuleName);
            }
        }
    }
    return configUpdated ? ServerMigrationTaskResult.SUCCESS : ServerMigrationTaskResult.SKIPPED;
}
 
开发者ID:emmartins,项目名称:wildfly-server-migration,代码行数:30,代码来源:FixHibernateCacheModuleName.java

示例15: updateConfiguration

import org.jboss.as.controller.operations.common.Util; //导入方法依赖的package包/类
@Override
protected ServerMigrationTaskResult updateConfiguration(ModelNode config, S source, SubsystemResource subsystemResource, TaskContext context, TaskEnvironment taskEnvironment) {
    if (!config.hasDefined(SERVICE,"remote")) {
        return ServerMigrationTaskResult.SKIPPED;
    }
    final PathAddress subsystemPathAddress = subsystemResource.getResourcePathAddress();
    final ManageableServerConfiguration configurationManagement = subsystemResource.getServerConfiguration();
    // /subsystem=ejb3/service=remote:write-attribute(name=connector-ref,value=http-remoting-connector)
    final ModelNode op = Util.createEmptyOperation(WRITE_ATTRIBUTE_OPERATION,  subsystemPathAddress.append(pathElement(SERVICE,"remote")));
    op.get(NAME).set("connector-ref");
    op.get(VALUE).set("http-remoting-connector");
    configurationManagement.executeManagementOperation(op);
    context.getLogger().debugf("EJB3 subsystem's remote service configured to use HTTP Remoting connector.");
    return ServerMigrationTaskResult.SUCCESS;
}
 
开发者ID:emmartins,项目名称:wildfly-server-migration,代码行数:16,代码来源:RefHttpRemotingConnectorInEJB3Remote.java


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