• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SimpleResourceDefinition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testToPathAddress

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
@Test
public void testToPathAddress() {

    NonResolvingResourceDescriptionResolver resolver = new NonResolvingResourceDescriptionResolver();

    ManagementResourceRegistration rootRegistration = ManagementResourceRegistration.Factory.forProcessType(ProcessType.EMBEDDED_SERVER).createRegistration(rootResourceDef);
    ManagementResourceRegistration subsystemRegistration = rootRegistration.registerSubModel(new SimpleResourceDefinition(pathElement("subsystem", "foo"), resolver));
    ManagementResourceRegistration resourceRegistration = subsystemRegistration.registerSubModel(new SimpleResourceDefinition(pathElement("resource", "resourceA"), resolver));
    ManagementResourceRegistration subresourceRegistration = resourceRegistration.registerSubModel(new SimpleResourceDefinition(pathElement("subresource", "resourceB"), resolver));

    PathAddress pathAddress = PathAddress.pathAddress("subsystem", "foo")
            .append("resource", "resourceA")
            .append("subresource", "resourceB");
    ObjectName on = ObjectNameAddressUtil.createObjectName("jboss.as", pathAddress);

    PathAddress convertedAddress = ObjectNameAddressUtil.toPathAddress("jboss.as", rootRegistration, on);
    Assert.assertNotNull(convertedAddress);
    Assert.assertEquals(pathAddress, convertedAddress);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:ObjectNameAddressUtilTestCase.java


示例2: registerOverrideModel

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
@Override
public ManagementResourceRegistration registerOverrideModel(String name, OverrideDescriptionProvider descriptionProvider) {
    Assert.checkNotNullParam("name", name);
    Assert.checkNotNullParam("descriptionProvider", descriptionProvider);

    if (parent == null) {
        throw ControllerLogger.ROOT_LOGGER.cannotOverrideRootRegistration();
    }

    if (!PathElement.WILDCARD_VALUE.equals(valueString)) {
        throw ControllerLogger.ROOT_LOGGER.cannotOverrideNonWildCardRegistration(valueString);
    }
    PathElement pe = PathElement.pathElement(parent.getKeyName(), name);

    final SimpleResourceDefinition rd = new SimpleResourceDefinition(pe, new OverrideDescriptionCombiner(getModelDescription(PathAddress.EMPTY_ADDRESS), descriptionProvider)) {

        @Override
        public List<AccessConstraintDefinition> getAccessConstraints() {
            return AbstractResourceRegistration.this.getAccessConstraints();
        }
    };
    return parent.getParent().registerSubModel(rd);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:24,代码来源:AbstractResourceRegistration.java


示例3: setupResources

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
private void setupResources(boolean isA, boolean isB) {

        a.setConfiguredApplication(isA);
        b.setConfiguredApplication(isB);

        ResourceDefinition rootRd = new SimpleResourceDefinition(null, new NonResolvingResourceDescriptionResolver()) {
            @Override
            public List<AccessConstraintDefinition> getAccessConstraints() {
                return rootResourceConstraints;
            }
        };
        ManagementResourceRegistration rootRegistration = ManagementResourceRegistration.Factory.forProcessType(ProcessType.EMBEDDED_SERVER).createRegistration(rootRd);
        rootRegistration.registerOperationHandler(WRITE_CONFIG_DEF, NoopOperationStepHandler.WITHOUT_RESULT, true);

        PathElement childPE = PathElement.pathElement("child");
        ResourceDefinition childRd = new SimpleResourceDefinition(childPE, new NonResolvingResourceDescriptionResolver()) {
            @Override
            public List<AccessConstraintDefinition> getAccessConstraints() {
                return childResourceConstraints;
            }
        };
        ManagementResourceRegistration childRegistration = rootRegistration.registerSubModel(childRd);
        rootTarget = TargetResource.forStandalone(PathAddress.EMPTY_ADDRESS, rootRegistration, Resource.Factory.create());
        childTarget = TargetResource.forStandalone(PathAddress.pathAddress(childPE), childRegistration, Resource.Factory.create());
    }
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:ApplicationTypeConstraintUnitTestCase.java


示例4: setupResources

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
private void setupResources() {
    ResourceDefinition rootRd = new SimpleResourceDefinition(null, new NonResolvingResourceDescriptionResolver()) {
        @Override
        public List<AccessConstraintDefinition> getAccessConstraints() {
            return rootResourceConstraints;
        }
    };
    ManagementResourceRegistration rootRegistration = ManagementResourceRegistration.Factory.forProcessType(ProcessType.EMBEDDED_SERVER).createRegistration(rootRd);
    rootRegistration.registerOperationHandler(READ_CONFIG_DEF, NoopOperationStepHandler.WITH_RESULT, true);
    PathElement childPE = PathElement.pathElement("child");
    ResourceDefinition childRd = new SimpleResourceDefinition(childPE, new NonResolvingResourceDescriptionResolver()) {
        @Override
        public List<AccessConstraintDefinition> getAccessConstraints() {
            return childResourceConstraints;
        }
    };
    ManagementResourceRegistration childRegistration = rootRegistration.registerSubModel(childRd);

    rootTarget = TargetResource.forStandalone(PathAddress.EMPTY_ADDRESS, rootRegistration, Resource.Factory.create());
    childTarget = TargetResource.forStandalone(PathAddress.pathAddress(childPE), childRegistration, Resource.Factory.create());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:22,代码来源:SensitiveTargetConstraintUnitTestCase.java


示例5: initModel

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
@Override
protected void initModel(ManagementModel managementModel) {
    ManagementResourceRegistration registration = managementModel.getRootResourceRegistration();
    GlobalOperationHandlers.registerGlobalOperations(registration, ProcessType.EMBEDDED_SERVER);

    GlobalNotifications.registerGlobalNotifications(registration, ProcessType.EMBEDDED_SERVER);

    registration.registerSubModel(new SimpleResourceDefinition(
            new Parameters(pathElement(UNCONSTRAINED_RESOURCE), new NonResolvingResourceDescriptionResolver())
                .setAddHandler(new AbstractAddStepHandler() {})
                .setRemoveHandler(new AbstractRemoveStepHandler() {})));
    registration.registerSubModel(new SimpleResourceDefinition(
            new Parameters(pathElement(SENSITIVE_CONSTRAINED_RESOURCE), new NonResolvingResourceDescriptionResolver())
                .setAddHandler(new AbstractAddStepHandler() {})
                .setRemoveHandler(new AbstractRemoveStepHandler() {})
                .setAccessConstraints(MY_SENSITIVE_CONSTRAINT)));
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:FilteredReadChildrenResourcesTestCase.java


示例6: initModel

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
@Override
protected void initModel(ManagementModel managementModel) {
    ManagementResourceRegistration registration = managementModel.getRootResourceRegistration();
    GlobalOperationHandlers.registerGlobalOperations(registration, ProcessType.EMBEDDED_SERVER);
    GlobalNotifications.registerGlobalNotifications(registration, ProcessType.EMBEDDED_SERVER);

    registration.registerSubModel(new SimpleResourceDefinition(
            new Parameters(pathElement(UNCONSTRAINED_RESOURCE), new NonResolvingResourceDescriptionResolver())
                .setAddHandler(new AbstractAddStepHandler() {})
                .setRemoveHandler(new AbstractRemoveStepHandler() {})));
    registration.registerSubModel(new SimpleResourceDefinition(
            new Parameters(pathElement(SENSITIVE_CONSTRAINED_RESOURCE), new NonResolvingResourceDescriptionResolver())
                .setAddHandler(new AbstractAddStepHandler() {})
                .setRemoveHandler(new AbstractRemoveStepHandler() {})
                .setAccessConstraints(MY_SENSITIVE_CONSTRAINT)));
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:FilteredReadChildrenNamesTestCase.java


示例7: testInheritedAccessConstraints

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
@Test
public void testInheritedAccessConstraints() {

    ResourceDefinition rootRd = new SimpleResourceDefinition(new Parameters(null, new NonResolvingResourceDescriptionResolver())
        .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.EXTENSIONS, ApplicationTypeAccessConstraintDefinition.DEPLOYMENT));
    ManagementResourceRegistration root = ManagementResourceRegistration.Factory.forProcessType(ProcessType.EMBEDDED_SERVER).createRegistration(rootRd);

    List<AccessConstraintDefinition> acds = root.getAccessConstraints();
    assertEquals(2, acds.size());
    assertTrue(acds.contains(SensitiveTargetAccessConstraintDefinition.EXTENSIONS));
    assertTrue(acds.contains(ApplicationTypeAccessConstraintDefinition.DEPLOYMENT));

    ResourceDefinition childRd = new SimpleResourceDefinition(
            new Parameters(PathElement.pathElement("child"), new NonResolvingResourceDescriptionResolver())
                .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.SECURITY_DOMAIN, ApplicationTypeAccessConstraintDefinition.DEPLOYMENT));
    ManagementResourceRegistration child = root.registerSubModel(childRd);
    acds = child.getAccessConstraints();
    assertEquals(4, acds.size());
    assertTrue(acds.contains(SensitiveTargetAccessConstraintDefinition.EXTENSIONS));
    assertTrue(acds.contains(SensitiveTargetAccessConstraintDefinition.SECURITY_DOMAIN));
    assertTrue(acds.contains(ApplicationTypeAccessConstraintDefinition.DEPLOYMENT));
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:CoreManagementResourceRegistrationUnitTestCase.java


示例8: setup

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的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


示例9: initModel

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
@Override
protected void initModel(ManagementModel managementModel) {
    ManagementResourceRegistration registration = managementModel.getRootResourceRegistration();
    GlobalOperationHandlers.registerGlobalOperations(registration, processType);
    registration.registerOperationHandler(new SimpleOperationDefinitionBuilder("setup", new NonResolvingResourceDescriptionResolver())
            .setPrivateEntry()
            .build()
            , new OperationStepHandler() {
        @Override
        public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
            createModel(context, model);
        }
    });

    GlobalNotifications.registerGlobalNotifications(registration, processType);

    ManagementResourceRegistration child = registration.registerSubModel(new SimpleResourceDefinition(PathElement.pathElement("test"), new NonResolvingResourceDescriptionResolver()));
    child.registerReadOnlyAttribute(TestUtils.createNillableAttribute("prop", ModelType.STRING), null);

    managementModel.getRootResource().getModel().set(model);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:22,代码来源:ReadResourceChildOrderingTestCase.java


示例10: initialize

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
@Override
public void initialize(ExtensionContext context) {
    final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, ModelVersion.create(1));
    SimpleResourceDefinition subsystemResource = new SimpleResourceDefinition(new SimpleResourceDefinition.Parameters(
            PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME),
            new NonResolvingResourceDescriptionResolver())
    );
    final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(subsystemResource);
    //We always need to add an 'add' operation
    registration.registerOperationHandler(
            SimpleOperationDefinitionBuilder.of(ADD, NonResolvingResourceDescriptionResolver.INSTANCE)
                .setParameters(addAttributes)
                .build(),
            new AbstractAddStepHandler(addAttributes));

    //We always need to add a 'describe' operation
    registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);

    subsystem.registerXMLElementWriter(parser);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:ValidateSubsystemExtension.java


示例11: TestModelControllerService11_0_0

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
TestModelControllerService11_0_0(final Extension mainExtension, final ControllerInitializer controllerInitializer,
                                 final AdditionalInitialization additionalInit, final RunningModeControl runningModeControl, final ExtensionRegistry extensionRegistry,
                                 final StringConfigurationPersister persister, final ModelTestOperationValidatorFilter validateOpsFilter, final boolean registerTransformers) {
    super(AdditionalInitializationUtil.getProcessType(additionalInit), runningModeControl, extensionRegistry.getTransformerRegistry(), persister, validateOpsFilter,
            new SimpleResourceDefinition(null, new NonResolvingResourceDescriptionResolver()), new ControlledProcessState(true), Controller90x.INSTANCE);
    this.mainExtension = mainExtension;
    this.additionalInit = additionalInit;
    this.controllerInitializer = controllerInitializer;
    this.extensionRegistry = extensionRegistry;
    this.runningModeControl = runningModeControl;
    this.registerTransformers = registerTransformers;
}
 
开发者ID:wildfly,项目名称:wildfly-legacy-test,代码行数:13,代码来源:TestModelControllerService11_0_0.java


示例12: TestModelControllerService10_0_0

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
TestModelControllerService10_0_0(final Extension mainExtension, final ControllerInitializer controllerInitializer,
                                 final AdditionalInitialization additionalInit, final RunningModeControl runningModeControl, final ExtensionRegistry extensionRegistry,
                                 final StringConfigurationPersister persister, final ModelTestOperationValidatorFilter validateOpsFilter, final boolean registerTransformers) {
    super(AdditionalInitializationUtil.getProcessType(additionalInit), runningModeControl, extensionRegistry.getTransformerRegistry(), persister, validateOpsFilter,
            new SimpleResourceDefinition(null, new NonResolvingResourceDescriptionResolver()), new ControlledProcessState(true), Controller90x.INSTANCE);
    this.mainExtension = mainExtension;
    this.additionalInit = additionalInit;
    this.controllerInitializer = controllerInitializer;
    this.extensionRegistry = extensionRegistry;
    this.runningModeControl = runningModeControl;
    this.registerTransformers = registerTransformers;
}
 
开发者ID:wildfly,项目名称:wildfly-legacy-test,代码行数:13,代码来源:TestModelControllerService10_0_0.java


示例13: DirContextDefinition

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
DirContextDefinition() {
    super(new SimpleResourceDefinition.Parameters(PathElement.pathElement(ElytronDescriptionConstants.DIR_CONTEXT), ElytronExtension.getResourceDescriptionResolver(ElytronDescriptionConstants.DIR_CONTEXT))
            .setAddHandler(ADD)
            .setRemoveHandler(REMOVE)
            .setAddRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES)
            .setRemoveRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES)
            .setCapabilities(DIR_CONTEXT_RUNTIME_CAPABILITY));
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:9,代码来源:DirContextDefinition.java


示例14: forDomain

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
static ResourceDefinition forDomain() {
    return new SimpleResourceDefinition(new Parameters(PATH, DomainManagementResolver.getResolver(CORE, MANAGEMENT, SERVICE, CONFIGURATION_CHANGES))
            .setAddHandler(new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    String warning = DomainManagementLogger.ROOT_LOGGER.removedBrokenResource(context.getCurrentAddress().toCLIStyleString());
                    DomainManagementLogger.ROOT_LOGGER.warn(warning);
                    context.getResult().add(warning);
                }

            })
            .setDeprecatedSince(ModelVersion.create(4, 2)));
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:14,代码来源:LegacyConfigurationChangeResourceDefinition.java


示例15: bootEmptyConfig

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
private boolean bootEmptyConfig() throws OperationFailedException, ConfigurationPersistenceException {
    HostControllerLogger.ROOT_LOGGER.debug("Invoking initial empty config host controller boot");
    boolean ok = boot(Collections.emptyList(), true, true);
    // until a host is added with the host add op, there is no root description provider delegate. We just install a non-resolving one for now, so the
    // CLI doesn't get a lot of NPEs from :read-resource-description etc.
    SimpleResourceDefinition def = new SimpleResourceDefinition(new SimpleResourceDefinition.Parameters(null, new NonResolvingResourceDescriptionResolver()));
    rootResourceDefinition.setFakeDelegate(def);
    // just initialize the persister and return, we have to wait for /host=foo:add()
    hostControllerConfigurationPersister.initializeDomainConfigurationPersister(false);
    return ok;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:12,代码来源:DomainModelControllerService.java


示例16: registerIOExtension

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
static void registerIOExtension(ExtensionRegistry extensionRegistry, ManagementResourceRegistration rootRegistration) {
    ManagementResourceRegistration extReg = rootRegistration.registerSubModel(new SimpleResourceDefinition(PathElement.pathElement(EXTENSION, "org.wildfly.extension.io"),
            NonResolvingResourceDescriptionResolver.INSTANCE, new ModelOnlyAddStepHandler(), ModelOnlyRemoveStepHandler.INSTANCE));
    extReg.registerReadOnlyAttribute(new SimpleAttributeDefinitionBuilder("module", ModelType.STRING).build(), null);

    Extension ioe = new IOExtension();
    ioe.initialize(extensionRegistry.getExtensionContext("org.wildfly.extension.io", rootRegistration, ExtensionRegistryType.MASTER));

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


示例17: testHandlersOnChildResource

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

    ManagementResourceRegistration child = rootRegistration.registerSubModel(new SimpleResourceDefinition(childElement, new NonResolvingResourceDescriptionResolver()));
    child.registerOperationHandler(getOpDef("one"), TestHandler.ONE);
    child.registerOperationHandler(getOpDef("two", OperationEntry.Flag.READ_ONLY), TestHandler.TWO);


    OperationStepHandler oneHandler = child.getOperationHandler(PathAddress.EMPTY_ADDRESS, "one");
    assertSame(TestHandler.ONE, oneHandler);

    OperationStepHandler twoHandler = child.getOperationHandler(PathAddress.EMPTY_ADDRESS, "two");
    assertSame(TestHandler.TWO, twoHandler);

    oneHandler = rootRegistration.getOperationHandler(childAddress, "one");
    assertSame(TestHandler.ONE, oneHandler);

    twoHandler = rootRegistration.getOperationHandler(childAddress, "two");
    assertSame(TestHandler.TWO, twoHandler);

    oneHandler = rootRegistration.getOperationHandler(fullChildAddress, "one");
    assertSame(TestHandler.ONE, oneHandler);

    twoHandler = rootRegistration.getOperationHandler(fullChildAddress, "two");
    assertSame(TestHandler.TWO, twoHandler);

    oneHandler = rootRegistration.getOperationHandler(PathAddress.EMPTY_ADDRESS, "one");
    assertNull(oneHandler);

    twoHandler = rootRegistration.getOperationHandler(PathAddress.EMPTY_ADDRESS, "two");
    assertNull(twoHandler);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:33,代码来源:CoreManagementResourceRegistrationUnitTestCase.java


示例18: testFlagsOnChildResource

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

    ManagementResourceRegistration child = rootRegistration.registerSubModel(new SimpleResourceDefinition(childElement, new NonResolvingResourceDescriptionResolver()));
    child.registerOperationHandler(getOpDef("one"), TestHandler.INSTANCE);
    child.registerOperationHandler(getOpDef("two", OperationEntry.Flag.READ_ONLY), TestHandler.INSTANCE, false);

    Set<OperationEntry.Flag> oneFlags = child.getOperationFlags(PathAddress.EMPTY_ADDRESS, "one");
    assertNotNull(oneFlags);
    assertEquals(0, oneFlags.size());

    Set<OperationEntry.Flag> twoFlags = child.getOperationFlags(PathAddress.EMPTY_ADDRESS, "two");
    assertNotNull(twoFlags);
    assertEquals(1, twoFlags.size());

    oneFlags = rootRegistration.getOperationFlags(childAddress, "one");
    assertNotNull(oneFlags);
    assertEquals(0, oneFlags.size());

    twoFlags = rootRegistration.getOperationFlags(childAddress, "two");
    assertNotNull(twoFlags);
    assertEquals(1, twoFlags.size());

    oneFlags = rootRegistration.getOperationFlags(fullChildAddress, "one");
    assertNotNull(oneFlags);
    assertEquals(0, oneFlags.size());

    twoFlags = rootRegistration.getOperationFlags(fullChildAddress, "two");
    assertNotNull(twoFlags);
    assertEquals(1, twoFlags.size());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:32,代码来源:CoreManagementResourceRegistrationUnitTestCase.java


示例19: setup

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
@BeforeClass
public static void setup() {
    registration = ManagementResourceRegistration.Factory.forProcessType(ProcessType.EMBEDDED_SERVER).createRegistration(new SimpleResourceDefinition(PathElement.pathElement("root","root"), new NonResolvingResourceDescriptionResolver()));

    parentWildReg = registration.registerSubModel(new SimpleResourceDefinition(parentWild, new NonResolvingResourceDescriptionResolver()));
    parentWildReg.registerReadOnlyAttribute(wildAttr, parentWildAttr);
    parentWildReg.registerOperationHandler(getOpDef("wildOp"), parentWildOp);
    parentWildReg.registerReadOnlyAttribute(overrideAttr, parentWildOverrideAttr);
    parentWildReg.registerOperationHandler(getOpDef("overrideOp"), parentWildOverrideOp);

    parentExtReg = registration.registerSubModel(new SimpleResourceDefinition(parentExt, new NonResolvingResourceDescriptionResolver()));
    parentExtReg.registerReadOnlyAttribute(extAttr, parentExtAttr);
    parentExtReg.registerOperationHandler(getOpDef("extOp"), parentExtOp);
    parentExtReg.registerReadOnlyAttribute(overrideAttr, parentExtOverrideAttr);
    parentExtReg.registerOperationHandler(getOpDef("overrideOp"), parentExtOverrideOp);

    childWildReg = parentWildReg.registerSubModel(new SimpleResourceDefinition(childWild, new NonResolvingResourceDescriptionResolver()));
    childWildReg.registerReadOnlyAttribute(wildAttr, childWildAttr);
    childWildReg.registerOperationHandler(getOpDef("wildOp"), childWildOp);
    childWildReg.registerReadOnlyAttribute(overrideAttr, childWildOverrideAttr);
    childWildReg.registerOperationHandler(getOpDef("overrideOp"), childWildOverrideOp);

    childWildExtReg = parentWildReg.registerSubModel(new SimpleResourceDefinition(childWildExt, new NonResolvingResourceDescriptionResolver()));
    childWildExtReg.registerReadOnlyAttribute(wildExtAttr, childWildExtAttr);
    childWildExtReg.registerOperationHandler(getOpDef("wildExtOp"), childWildExtOp);

    childExtReg = parentExtReg.registerSubModel(new SimpleResourceDefinition(childExt, new NonResolvingResourceDescriptionResolver()));
    childExtReg.registerReadOnlyAttribute(extAttr, childExtAttr);
    childExtReg.registerOperationHandler(getOpDef("extOp"), childExtOp);
    childExtReg.registerReadOnlyAttribute(overrideAttr, childExtOverrideAttr);
    childExtReg.registerOperationHandler(getOpDef("overrideOp"), childExtOverrideOp);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:33,代码来源:ExtendWildCardRegistrationUnitTestCase.java


示例20: initModel

import org.jboss.as.controller.SimpleResourceDefinition; //导入依赖的package包/类
@Override
protected void initModel(ManagementModel managementModel) {
    ManagementResourceRegistration registration = managementModel.getRootResourceRegistration();
    GlobalOperationHandlers.registerGlobalOperations(registration, processType);
    GlobalNotifications.registerGlobalNotifications(registration, processType);

    ManagementResourceRegistration basicResourceRegistration = registration.registerSubModel(
            new SimpleResourceDefinition(PathElement.pathElement("subsystem", "basicSubsystem"), new NonResolvingResourceDescriptionResolver()));
    basicResourceRegistration.registerReadOnlyAttribute(TestUtils.createAttribute("first", ModelType.STRING, "group1", false), null);
    basicResourceRegistration.registerReadOnlyAttribute(TestUtils.createAttribute("second", ModelType.STRING, "group1", false), null);
    basicResourceRegistration.registerReadOnlyAttribute(TestUtils.createAttribute("third", ModelType.STRING, "group2", false), null);
    basicResourceRegistration.registerReadOnlyAttribute(TestUtils.createAttribute("fourth", ModelType.STRING, "group2", true), null);
    basicResourceRegistration.registerReadOnlyAttribute(TestUtils.createAttribute("fifth", ModelType.STRING, "group1", true), null);
    basicResourceRegistration.registerReadOnlyAttribute(TestUtils.createAttribute("sixth", ModelType.STRING, "group2", false, false), null);
    basicResourceRegistration.registerReadOnlyAttribute(TestUtils.createAttribute("seventh", ModelType.STRING, "group2", false, true), ShowModelAliasReadHandler.INSTANCE);
    basicResourceRegistration.registerReadOnlyAttribute(TestUtils.createAttribute("eigth", ModelType.STRING, "group1", false, false, true), null);

    registration.registerOperationHandler(TestUtils.SETUP_OPERATION_DEF, new OperationStepHandler() {
        @Override
        public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
            final ModelNode model = new ModelNode();
            //Atttributes
            model.get("subsystem", "basicSubsystem", "first").set("configuration1");
            model.get("subsystem", "basicSubsystem", "second").set(new ValueExpression("${my.value}"));
            model.get("subsystem", "basicSubsystem", "third").set("configuration3");
            model.get("subsystem", "basicSubsystem", "fourth").set("runtime4");
            model.get("subsystem", "basicSubsystem", "fifth").set("runtime5");
            model.get("subsystem", "basicSubsystem", "sixth").set("configuration6");
            model.get("subsystem", "basicSubsystem", "seventh").set("alias7");
            createModel(context, model);
        }
    }
    );
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:35,代码来源:ReadAttributeGroupTestCase.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StringMap类代码示例发布时间:2022-05-22
下一篇:
Java RowListener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap