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


Java ModelDescriptionConstants类代码示例

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


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

示例1: performRuntime

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model,
                              ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
    final String moduleId = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).getLastElement().getValue();
    _componentNames.add(moduleId);

    context.addStep(new AbstractDeploymentChainStep() {
        protected void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(SwitchYardExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, _priority++, new SwitchYardModuleDependencyProcessor(moduleId));
        }
    }, OperationContext.Stage.RUNTIME);

    final SwitchYardComponentService componentService = new SwitchYardComponentService(moduleId, model);
    final ServiceBuilder<Component> componentServiceBuilder = context.getServiceTarget().addService(SwitchYardComponentService.SERVICE_NAME.append(moduleId), componentService);
    componentServiceBuilder.addDependency(SwitchYardInjectorService.SERVICE_NAME, Map.class, componentService.getInjectedValues())
            .addDependency(RA_REPOSITORY_SERVICE_NAME, ResourceAdapterRepository.class, componentService.getResourceAdapterRepository());
    componentServiceBuilder.addDependency(WebSubsystemServices.JBOSS_WEB);
    componentServiceBuilder.setInitialMode(Mode.ACTIVE);
    newControllers.add(componentServiceBuilder.install());
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:21,代码来源:SwitchYardModuleAdd.java

示例2: makePathAddressFullyQualified_WFLY6628

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
private ModelNode makePathAddressFullyQualified_WFLY6628(
        PathAddress queryPathAddress, ModelNode individualPathAddressNode) {
    // PathAddress strips out any /host=X/server=X found at the start of the address. We want it back in.
    if (queryPathAddress.size() > 2
            && ModelDescriptionConstants.HOST.equals(queryPathAddress.getElement(0).getKey())
            && ModelDescriptionConstants.SERVER.equals(queryPathAddress.getElement(1).getKey())) {

        PathAddress partialPathAddress = PathAddress.pathAddress(individualPathAddressNode);

        if (partialPathAddress.size() > 2
                && ModelDescriptionConstants.HOST.equals(partialPathAddress.getElement(0).getKey())
                && ModelDescriptionConstants.SERVER.equals(partialPathAddress.getElement(1).getKey())) {
            return individualPathAddressNode; // looks like the address is already fully qualified
        }

        PathAddress hostServerAddress = queryPathAddress.subAddress(0, 2);
        PathAddress fullPathAddress = hostServerAddress.append(partialPathAddress);
        return fullPathAddress.toModelNode();
    } else {
        return individualPathAddressNode; // nothing needs to be fixed
    }
}
 
开发者ID:hawkular,项目名称:hawkular-agent,代码行数:23,代码来源:DMRDriver.java

示例3: tearDown

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
@Override
public void tearDown(ManagementClient managementClient, String containerId) throws Exception {
    ModelNode[] steps = new ModelNode[5];
    steps[0] = DMRUtils.createOpNode(ADDRESS_SUBSYSTEM_UNDERTOW_HTTPS_LISTENER, ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION);
    steps[0].get(ModelDescriptionConstants.NAME).set("verify-client");

    steps[1] = DMRUtils.createOpNode(ADDRESS_SUBSYSTEM_SECURITY_SECURITY_DOMAIN_CLIENT_CERT, ModelDescriptionConstants.REMOVE);

    steps[2] = DMRUtils.createOpNode(ADDRESS_SUBSYSTEM_SECURITY_SECURITY_DOMAIN_CERTIFICATE_TRUST_DOMAIN, ModelDescriptionConstants.REMOVE);

    steps[3] = DMRUtils.createOpNode(ADDRESS_SYSTEM_PROPERTY_TRUST_STORE, ModelDescriptionConstants.REMOVE);
    steps[4] = DMRUtils.createOpNode(ADDRESS_SYSTEM_PROPERTY_TRUST_STORE_PASSWORD, ModelDescriptionConstants.REMOVE);

    ModelNode compositeNode = DMRUtils.createCompositeNode(steps);
    managementClient.getControllerClient().execute(compositeNode);

    UserManager.removeApplicationUser(APPLICATION_USER);
    UserManager.revokeRoleFromApplicationUser(APPLICATION_USER, APPLICATION_ROLE);
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel-examples,代码行数:20,代码来源:CxfWsCdiSecureExampleTest.java

示例4: assertResourceCount

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
protected void assertResourceCount(ModelControllerClient mcc, ModelNode address, String childType,
        int expectedCount) throws IOException {
    ModelNode request = new ModelNode();
    request.get(ModelDescriptionConstants.ADDRESS).set(address);
    request.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.READ_CHILDREN_RESOURCES_OPERATION);
    request.get(ModelDescriptionConstants.CHILD_TYPE).set(childType);
    request.get(ModelDescriptionConstants.INCLUDE_RUNTIME).set(true);
    ModelNode response = mcc.execute(request);
    if (response.hasDefined(ModelDescriptionConstants.OUTCOME)
            && response.get(ModelDescriptionConstants.OUTCOME)
                    .asString().equals(ModelDescriptionConstants.SUCCESS)) {
        ModelNode result = response.get(ModelDescriptionConstants.RESULT);
        List<Property> nodes = result.asPropertyList();
        AssertJUnit.assertEquals("Number of child nodes of [" + address + "] " + response, expectedCount,
                nodes.size());
    } else if (expectedCount != 0) {
        AssertJUnit
                .fail("Path [" + address + "] has no child nodes, expected [" + expectedCount + "]: " + response);
    }

}
 
开发者ID:hawkular,项目名称:hawkular-agent,代码行数:22,代码来源:AbstractITest.java

示例5: executeOperation

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
private void executeOperation(final String serviceName, final String bindingName, final boolean start)
        throws Exception {
    final ModelNode operation = new ModelNode();
    operation.get(ModelDescriptionConstants.OP_ADDR).add("subsystem", "switchyard");
    operation.get("application-name").set(application);
    if (start) {
        operation.get(ModelDescriptionConstants.OP).set("start-gateway");
    } else {
        operation.get(ModelDescriptionConstants.OP).set("stop-gateway");
    }
    operation.get(ModelDescriptionConstants.NAME).set(bindingName);
    operation.get("service-name").set(serviceName);
    final ModelNode result = _client.getControllerClient().execute(operation);
    Assert.assertEquals("Failed to " + (start ? "start" : "stop") + " gateway: " + result.toString(),
            ModelDescriptionConstants.SUCCESS, result.get(ModelDescriptionConstants.OUTCOME).asString());
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:17,代码来源:CamelJpaBindingQuickstartTest.java

示例6: performRuntime

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    final String moduleId = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).getLastElement().getValue();
    _componentNames.add(moduleId);

    context.addStep(new AbstractDeploymentChainStep() {
        protected void execute(DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(SwitchYardExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, _priority++, new SwitchYardModuleDependencyProcessor(moduleId));
        }
    }, OperationContext.Stage.RUNTIME);

    final SwitchYardComponentService componentService = new SwitchYardComponentService(moduleId, model);
    final ServiceBuilder<Component> componentServiceBuilder = context.getServiceTarget().addService(SwitchYardComponentService.SERVICE_NAME.append(moduleId), componentService);
    componentServiceBuilder.addDependency(SwitchYardInjectorService.SERVICE_NAME, Map.class, componentService.getInjectedValues())
            .addDependency(RA_REPOSITORY_SERVICE_NAME, ResourceAdapterRepository.class, componentService.getResourceAdapterRepository());
    componentServiceBuilder.setInitialMode(Mode.ACTIVE);
    componentServiceBuilder.install();
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:19,代码来源:SwitchYardModuleAdd.java

示例7: testAddSubsystem

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
@Test
public void testAddSubsystem() throws Exception {

    final ModelVersion subsystem = ModelVersion.create(1, 2);
    final TransformerRegistry registry = TransformerRegistry.Factory.create();
    TransformersSubRegistration sub = registry.registerSubsystemTransformers("test", subsystem, ResourceTransformer.DISCARD);
    sub.registerOperationTransformer("test", OPERATION_TRANSFORMER);

    final TransformationTarget host = create(registry, ModelVersion.create(1, 2, 3));
    host.addSubsystemVersion("test", subsystem);

    final PathAddress profile = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.PROFILE, "test"));
    final PathAddress serverAddress = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.HOST, "test"), PathElement.pathElement(ModelDescriptionConstants.RUNNING_SERVER, "test"));
    final PathAddress subsytemAddress = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "test"));

    final OperationTransformer profileTransformer = host.resolveTransformer(new MockTransformationContext(), profile.append(subsytemAddress), "test");
    Assert.assertEquals(profileTransformer, OPERATION_TRANSFORMER);

    final OperationTransformer serverTransformer = host.resolveTransformer(new MockTransformationContext(), serverAddress.append(subsytemAddress), "test");
    Assert.assertEquals(serverTransformer, OPERATION_TRANSFORMER);

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

示例8: isOperationAttributeSupported

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
/**
 * Checks to see if the attribute is a valid attribute for the operation. This is useful to determine if the running
 * container supports an attribute for the version running.
 *
 * @param address       the address or {@code null} for the root resource
 * @param operationName the operation name
 * @param attributeName the attribute name
 *
 * @return {@code true} if the attribute is supported or {@code false} if the attribute was not found on the
 * operation description
 *
 * @throws IOException           if an error occurs while attempting to execute the operation
 * @throws IllegalStateException if the operation fails
 */
protected boolean isOperationAttributeSupported(final ModelNode address, final String operationName, final String attributeName) throws IOException {
    final ModelControllerClient client = getModelControllerClient();
    final ModelNode op;
    if (address == null) {
        op = Operations.createOperation(ModelDescriptionConstants.READ_OPERATION_DESCRIPTION_OPERATION);
    } else {
        op = Operations.createOperation(ModelDescriptionConstants.READ_OPERATION_DESCRIPTION_OPERATION, address);
    }
    op.get(ModelDescriptionConstants.NAME).set(operationName);
    final ModelNode result = client.execute(op);
    if (Operations.isSuccessfulOutcome(result)) {
        final ModelNode params = Operations.readResult(result).get(ModelDescriptionConstants.REQUEST_PROPERTIES);
        return params.keys().contains(attributeName);
    }
    final String msg;
    if (address == null) {
        msg = String.format("Failed to determine if attribute %s is supported for operation %s. %s", attributeName, operationName, Operations.getFailureDescription(result));
    } else {
        msg = String.format("Failed to determine if attribute %s is supported for operation %s:%s. %s", attributeName, addressToCliString(address), operationName, Operations.getFailureDescription(result));
    }
    throw new IllegalStateException(msg);
}
 
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:37,代码来源:CommonDeployableContainer.java

示例9: storeResult

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
static void storeResult(final String name, final ModelNode store) {

        if (PlatformMBeanConstants.OBJECT_NAME.getName().equals(name)) {
            store.set(ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME);
        } else if (ModelDescriptionConstants.NAME.equals(name)) {
            store.set(ManagementFactory.getOperatingSystemMXBean().getName());
        } else if (PlatformMBeanConstants.ARCH.equals(name)) {
            store.set(ManagementFactory.getOperatingSystemMXBean().getArch());
        } else if (PlatformMBeanConstants.VERSION.equals(name)) {
            store.set(ManagementFactory.getOperatingSystemMXBean().getVersion());
        } else if (PlatformMBeanConstants.AVAILABLE_PROCESSORS.equals(name)) {
            store.set(ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors());
        } else if (PlatformMBeanConstants.SYSTEM_LOAD_AVERAGE.equals(name)) {
            store.set(ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage());
        } else if (OperatingSystemResourceDefinition.OPERATING_SYSTEM_READ_ATTRIBUTES.contains(name)
                || OperatingSystemResourceDefinition.OPERATING_SYSTEM_METRICS.contains(name)) {
            // Bug
            throw PlatformMBeanLogger.ROOT_LOGGER.badReadAttributeImpl(name);
        }
    }
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:OperatingSystemMXBeanAttributeHandler.java

示例10: executeReadAttribute

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
@Override
protected void executeReadAttribute(OperationContext context, ModelNode operation) throws OperationFailedException {

    final String name = operation.require(ModelDescriptionConstants.NAME).asString();

    if (PlatformMBeanConstants.OBJECT_NAME.getName().equals(name)) {
        context.getResult().set(ManagementFactory.CLASS_LOADING_MXBEAN_NAME);
    } else if (PlatformMBeanConstants.TOTAL_LOADED_CLASS_COUNT.equals(name)) {
        context.getResult().set(ManagementFactory.getClassLoadingMXBean().getTotalLoadedClassCount());
    } else if (PlatformMBeanConstants.LOADED_CLASS_COUNT.equals(name)) {
        context.getResult().set(ManagementFactory.getClassLoadingMXBean().getLoadedClassCount());
    } else if (PlatformMBeanConstants.UNLOADED_CLASS_COUNT.equals(name)) {
        context.getResult().set(ManagementFactory.getClassLoadingMXBean().getUnloadedClassCount());
    } else if (PlatformMBeanConstants.VERBOSE.equals(name)) {
        context.getResult().set(ManagementFactory.getClassLoadingMXBean().isVerbose());
    } else if (CLASSLOADING_METRICS.contains(name)
            || CLASSLOADING_READ_WRITE_ATTRIBUTES.contains(name)) {
        // Bug
        throw PlatformMBeanLogger.ROOT_LOGGER.badReadAttributeImpl(name);
    } else {
        // Shouldn't happen; the global handler should reject
        throw unknownAttribute(operation);
    }

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

示例11: testRejectingTransformers

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
private void testRejectingTransformers(ModelTestControllerVersion controllerVersion) throws Exception {
    ModelVersion elytronVersion = controllerVersion.getSubsystemModelVersion(getMainSubsystemName());

    //Boot up empty controllers with the resources needed for the ops coming from the xml to work
    KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT);
    builder.createLegacyKernelServicesBuilder(AdditionalInitialization.MANAGEMENT, controllerVersion, elytronVersion)
            .addMavenResourceURL(controllerVersion.getCoreMavenGroupId() + ":wildfly-elytron-integration:" + controllerVersion.getCoreVersion())
            .dontPersistXml();

    KernelServices mainServices = builder.build();
    assertTrue(mainServices.isSuccessfulBoot());
    assertTrue(mainServices.getLegacyServices(elytronVersion).isSuccessfulBoot());

    List<ModelNode> ops = builder.parseXmlResource("elytron-transformers-1.2-reject.xml");
    PathAddress subsystemAddress = PathAddress.pathAddress(ModelDescriptionConstants.SUBSYSTEM, ElytronExtension.SUBSYSTEM_NAME);
    ModelTestUtils.checkFailedTransformedBootOperations(mainServices, elytronVersion, ops, new FailedOperationTransformationConfig()
            .addFailedAttribute(subsystemAddress.append(PathElement.pathElement(ElytronDescriptionConstants.KERBEROS_SECURITY_FACTORY)),
                    new FailedOperationTransformationConfig.NewAttributesConfig(AuthenticationClientDefinitions.FORWARDING_MODE)
            )
    );
    /*ModelTestUtils.checkFailedTransformedBootOperations(mainServices, elytronVersion, ops, new FailedOperationTransformationConfig()
           ...
    );*/
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:25,代码来源:SubsystemTransformerTestCase.java

示例12: executeReadAttribute

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
@Override
protected void executeReadAttribute(OperationContext context, ModelNode operation) throws OperationFailedException {

    final String name = operation.require(ModelDescriptionConstants.NAME).asString();

    try {
        if ((PlatformMBeanConstants.OBJECT_NAME.getName().equals(name))
                || COMPILATION_READ_ATTRIBUTES.contains(name)
                || COMPILATION_METRICS.contains(name)) {
            storeResult(name, context.getResult());
        } else {
            // Shouldn't happen; the global handler should reject
            throw unknownAttribute(operation);
        }
    } catch (UnsupportedOperationException e) {
        throw new OperationFailedException(e.toString());
    }

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

示例13: execute

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
    AuthorizationResult authorizationResult = context.authorize(operation);
    if (authorizationResult.getDecision() == AuthorizationResult.Decision.DENY) {
        throw ControllerLogger.ROOT_LOGGER.unauthorized(operation.get(OP).asString(), context.getCurrentAddress(), authorizationResult.getExplanation());
    }

    try {
        SnapshotInfo info = persister.listSnapshots();
        ModelNode result = context.getResult();
        result.get(ModelDescriptionConstants.DIRECTORY).set(info.getSnapshotDirectory());
        result.get(ModelDescriptionConstants.NAMES).setEmptyList();
        for (String name : info.names()) {
            result.get(ModelDescriptionConstants.NAMES).add(name);
        }
    } catch (Exception e) {
        throw new OperationFailedException(e);
    }
    context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:SnapshotListHandler.java

示例14: getServiceName

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
private static ServiceName getServiceName(final OperationContext context) {
    String deploymentName = null;
    String subdeploymentName = null;
    final PathAddress address = context.getCurrentAddress();
    for (PathElement element : address) {
        if (ModelDescriptionConstants.DEPLOYMENT.equals(element.getKey())) {
            deploymentName = getRuntimeName(context, element);
            //deploymentName = element.getValue();
        } else if (ModelDescriptionConstants.SUBDEPLOYMENT.endsWith(element.getKey())) {
            subdeploymentName = element.getValue();
        }
    }
    if (deploymentName == null) {
        throw LoggingLogger.ROOT_LOGGER.deploymentNameNotFound(address);
    }
    final ServiceName result;
    if (subdeploymentName == null) {
        result = Services.deploymentUnitName(deploymentName);
    } else {
        result = Services.deploymentUnitName(deploymentName, subdeploymentName);
    }
    return result.append("logging", "configuration");
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:24,代码来源:LoggingConfigurationReadStepHandler.java

示例15: sendUntilFailure

import org.jboss.as.controller.descriptions.ModelDescriptionConstants; //导入依赖的package包/类
private ModelNode sendUntilFailure(ModelNode readResource, int existingFailures) throws Exception{
    //Since syslog does not have app-layer acks, the failure handling at the TCP layer when the remote socket is shut down is not immediate
    //so we loop around a few times until it eventually fails.
    //Some background information here:
    //      http://blog.gerhards.net/2008/04/on-unreliability-of-plain-tcp-syslog.html
    //      http://blog.gerhards.net/2008/05/why-you-cant-build-reliable-tcp.html

    int expectedFailures = existingFailures + 1;
    for (int i = 0 ; i < 1000 ; i++) {
        ModelNode result = executeForResult(readResource);
        if (expectedFailures == result.get(ModelDescriptionConstants.SYSLOG_HANDLER, "syslog").get(AuditLogHandlerResourceDefinition.FAILURE_COUNT.getName()).asInt()) {
            System.out.println("Number of messages sent until the TCP buffer was full " + i);
            return result;
        }
    }
    throw new AssertionError("Failure count never got incremented");
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:AuditLogSyslogReconnectTestCase.java


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