org.jboss.as.controller.PathElement Java Examples

The following examples show how to use org.jboss.as.controller.PathElement. 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: CoreModelTestDelegate.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void harmonizeModel(ModelVersion modelVersion, ModelNode legacyModel, ModelNode transformed,
                                              PathAddress address, ModelHarmonizer harmonizer) {

    if (address.size() > 0) {
        PathElement pathElement = address.getElement(0);
        if (legacyModel.hasDefined(pathElement.getKey()) && transformed.hasDefined(pathElement.getKey())) {
            ModelNode legacyType = legacyModel.get(pathElement.getKey());
            ModelNode transformedType = transformed.get(pathElement.getKey());
            PathAddress childAddress = address.size() > 1 ? address.subAddress(1) : PathAddress.EMPTY_ADDRESS;
            if (pathElement.isWildcard()) {
                for (String key : legacyType.keys()) {
                    if (transformedType.has(key)) {
                        harmonizeModel(modelVersion, legacyType.get(key),
                                transformedType.get(key), childAddress, harmonizer);
                    }
                }
            } else {
                harmonizeModel(modelVersion, legacyType.get(pathElement.getValue()),
                        transformedType.get(pathElement.getValue()), address, harmonizer);
            }
        }
    } else {
        harmonizer.harmonizeModel(modelVersion, legacyModel, transformed);
    }
}
 
Example #2
Source File: HandlerUtil.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
static void checkNoOtherHandlerWithTheSameName(OperationContext context) throws OperationFailedException {
    final PathAddress address = context.getCurrentAddress();
    final PathAddress parentAddress = address.subAddress(0, address.size() - 1);
    final Resource resource = context.readResourceFromRoot(parentAddress);

    final PathElement element = address.getLastElement();
    final String handlerType = element.getKey();
    final String handlerName = element.getValue();

    for (String otherHandler: HANDLER_TYPES) {
        if (handlerType.equals(otherHandler)) {
            // we need to check other handler types for the same name
            continue;
        }
        final PathElement check = PathElement.pathElement(otherHandler, handlerName);
        if (resource.hasChild(check)) {
            throw DomainManagementLogger.ROOT_LOGGER.handlerAlreadyExists(check.getValue(), parentAddress.append(check));
        }
    }
}
 
Example #3
Source File: AdminOnlyPolicyTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
    public void testFetchFromMasterWithDiscovery() throws URISyntaxException, IOException {
        String hostName = createSecondSlave(AdminOnlyDomainConfigPolicy.FETCH_FROM_MASTER, true, false);
        validateProfiles("default");

        // Now we validate that we can pull down further data if needed
        PathAddress pa = PathAddress.pathAddress(PathElement.pathElement(HOST, hostName), PathElement.pathElement(SERVER_CONFIG, "other1"));
        ModelNode op = Util.createAddOperation(pa);
        op.get(GROUP).set("other-server-group");
        executeForResult(domainSlaveLifecycleUtil.getDomainClient(), op);
        // This should have pulled down the 'other' profile
        validateProfiles("default", "other");

//        ModelNode remove = Util.createRemoveOperation(pa);
//        executeForResult(domainSlaveLifecycleUtil.getDomainClient(), remove);
//
//        // This should have pulled down the 'other' profile
//        validateProfiles("default");
    }
 
Example #4
Source File: DefaultResourceDescriptionProvider.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Creates an alias address by replacing all wildcard values by $ + key so that the address can be used to obtain a capability pattern.
 * @param pa the registration address to be aliased.
 * @return  the aliased address.
 */
private PathAddress createAliasPathAddress(PathAddress pa) {
    ImmutableManagementResourceRegistration registry = registration.getParent();
    List<PathElement> elements = new ArrayList<>();
    for(int i = pa.size() - 1; i >=0; i--) {
        PathElement elt = pa.getElement(i);
        ImmutableManagementResourceRegistration childRegistration = registry.getSubModel(PathAddress.pathAddress(PathElement.pathElement(elt.getKey())));
        if(childRegistration == null) {
            elements.add(elt);
        } else {
            elements.add(PathElement.pathElement(elt.getKey(), "$" + elt.getKey()));
        }
        registry = registry.getParent();
    }
    Collections.reverse(elements);
    return PathAddress.pathAddress(elements.toArray(new PathElement[elements.size()]));
}
 
Example #5
Source File: DomainModelControllerService.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public ModelNode getProfileOperations(String profileName) {
    ModelNode operation = new ModelNode();

    operation.get(OP).set(DESCRIBE);
    operation.get(OP_ADDR).set(PathAddress.pathAddress(PathElement.pathElement(PROFILE, profileName)).toModelNode());
    operation.get(SERVER_LAUNCH).set(true);

    ModelNode rsp = getValue().execute(operation, null, null, null);
    if (!rsp.hasDefined(OUTCOME) || !SUCCESS.equals(rsp.get(OUTCOME).asString())) {
        ModelNode msgNode = rsp.get(FAILURE_DESCRIPTION);
        String msg = msgNode.isDefined() ? msgNode.toString() : HostControllerLogger.ROOT_LOGGER.failedProfileOperationsRetrieval();
        throw new RuntimeException(msg);
    }
    return rsp.require(RESULT);
}
 
Example #6
Source File: RootResourceIterator.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void doIterate(final Resource current, final PathAddress address) {
    boolean handleChildren = false;

    ObjectName resourceObjectName = action.onAddress(address);
    if (resourceObjectName != null &&
            (accessControlUtil == null || accessControlUtil.getResourceAccess(address, false).isAccessibleResource())) {
        handleChildren = action.onResource(resourceObjectName);
    }

    if (handleChildren) {
        for (String type : current.getChildTypes()) {
            if (current.hasChildren(type)) {
                for (ResourceEntry entry : current.getChildren(type)) {
                    final PathElement pathElement = entry.getPathElement();
                    final PathAddress childAddress = address.append(pathElement);
                    doIterate(entry, childAddress);
                }
            }
        }
    }
}
 
Example #7
Source File: ChainedPlaceholderResolver.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public TransformerEntry resolveTransformerEntry(Iterator<PathElement> iterator) {
    if(!iterator.hasNext()) {
        return getTransformerEntry();
    } else {
        final PathElement element = iterator.next();
        SubRegistry sub = subRegistries.get(element.getKey());
        if(sub == null) {
            return null;
        }
        final ChainedPlaceholderResolver registry = sub.get(element.getValue());
        if(registry == null) {
            return null;
        }
        return registry.resolveTransformerEntry(iterator);
    }
}
 
Example #8
Source File: SocketBindingGroupIncludesHandlerTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testIncludesWithNoOverriddenSubsystems() throws Exception {
    //Here we test changing the includes attribute value
    //Testing what happens when adding subsystems at runtime becomes a bit too hard to mock up
    //so we test that in ServerManagementTestCase
    PathAddress addr = getSocketBindingGroupAddress("binding-four");
    ModelNode list = new ModelNode().add("binding-three");
    ModelNode op = Util.getWriteAttributeOperation(addr, INCLUDES, list);
    MockOperationContext operationContext = getOperationContextForSocketBindingIncludes(addr, new RootResourceInitializer() {
        @Override
        public void addAdditionalResources(Resource root) {
            Resource subsystemA = Resource.Factory.create();
            root.getChild(PathElement.pathElement(SOCKET_BINDING_GROUP, "binding-three"))
                    .registerChild(PathElement.pathElement(SUBSYSTEM, "a"), subsystemA);

            Resource subsystemB = Resource.Factory.create();
            Resource SocketBindingGroup4 = root.getChild(PathElement.pathElement(SOCKET_BINDING_GROUP, "binding-four"));
            SocketBindingGroup4.registerChild(PathElement.pathElement(SUBSYSTEM, "b"), subsystemB);
        }
    });
    SocketBindingGroupResourceDefinition.createIncludesValidationHandler().execute(operationContext, op);
    operationContext.executeNextStep();
}
 
Example #9
Source File: OperationTransformerRegistry.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void resolvePathTransformers(Iterator<PathElement> iterator, List<PathAddressTransformer> list, PlaceholderResolver placeholderResolver) {
    if(iterator.hasNext()) {
        final PathElement element = iterator.next();
        SubRegistry sub = subRegistriesUpdater.get(this, element.getKey());
        if(sub != null) {
            final OperationTransformerRegistry reg = sub.get(element.getValue());
            if(reg != null) {
                list.add(reg.getPathAddressTransformer());
                if (reg.isPlaceholder() && placeholderResolver != null) {
                    placeholderResolver.resolvePathTransformers(iterator, list);
                } else {
                    reg.resolvePathTransformers(iterator, list, placeholderResolver);
                }
                return;
            }
        }
        list.add(PathAddressTransformer.DEFAULT);
        return;
    }
}
 
Example #10
Source File: IgnoredNonAffectedServerGroupsUtil.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private boolean ignoreSocketBindingGroups(final Resource domainResource, final Collection<ServerConfigInfo> serverConfigs, final String name) {
    Set<String> seenGroups = new HashSet<>();
    Set<String> socketBindingGroups = new HashSet<>();
    for (ServerConfigInfo serverConfig : serverConfigs) {
        final String socketBindingGroup;
        if (serverConfig.getSocketBindingGroup() != null) {
            if (serverConfig.getSocketBindingGroup().equals(name)) {
                return false;
            }
            socketBindingGroup = serverConfig.getSocketBindingGroup();
        } else {
            if (seenGroups.contains(serverConfig.getServerGroup())) {
                continue;
            }
            seenGroups.add(serverConfig.getServerGroup());
            Resource serverGroupResource = domainResource.getChild(PathElement.pathElement(SERVER_GROUP, serverConfig.getServerGroup()));
            socketBindingGroup = serverGroupResource.getModel().get(SOCKET_BINDING_GROUP).asString();
            if (socketBindingGroup.equals(name)) {
                return false;
            }
        }
        processSocketBindingGroups(domainResource, socketBindingGroup, socketBindingGroups);
    }
    return !socketBindingGroups.contains(name);
}
 
Example #11
Source File: ReadMasterDomainModelUtil.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Determine the relevant pieces of configuration which need to be included when processing the domain model.
 *
 * @param root                 the resource root
 * @param requiredConfigurationHolder    the resolution context
 * @param serverConfig         the server config
 * @param extensionRegistry    the extension registry
 */
static void processServerConfig(final Resource root, final RequiredConfigurationHolder requiredConfigurationHolder, final IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo serverConfig, final ExtensionRegistry extensionRegistry) {

    final Set<String> serverGroups = requiredConfigurationHolder.serverGroups;
    final Set<String> socketBindings = requiredConfigurationHolder.socketBindings;

    String sbg = serverConfig.getSocketBindingGroup();
    if (sbg != null && !socketBindings.contains(sbg)) {
        processSocketBindingGroup(root, sbg, requiredConfigurationHolder);
    }

    final String groupName = serverConfig.getServerGroup();
    final PathElement groupElement = PathElement.pathElement(SERVER_GROUP, groupName);
    // Also check the root, since this also gets executed on the slave which may not have the server-group configured yet
    if (!serverGroups.contains(groupName) && root.hasChild(groupElement)) {

        final Resource serverGroup = root.getChild(groupElement);
        final ModelNode groupModel = serverGroup.getModel();
        serverGroups.add(groupName);

        // Include the socket binding groups
        if (groupModel.hasDefined(SOCKET_BINDING_GROUP)) {
            final String socketBindingGroup = groupModel.get(SOCKET_BINDING_GROUP).asString();
            processSocketBindingGroup(root, socketBindingGroup, requiredConfigurationHolder);
        }

        final String profileName = groupModel.get(PROFILE).asString();
        processProfile(root, profileName, requiredConfigurationHolder, extensionRegistry);
    }
}
 
Example #12
Source File: ChainedPlaceholderResolver.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private ChainedPlaceholderResolver resolveChild(final Iterator<PathElement> iterator) {

        if(! iterator.hasNext()) {
            return this;
        } else {
            final PathElement element = iterator.next();
            SubRegistry sub = subRegistries.get(element.getKey());
            if(sub == null) {
                return null;
            }
            return sub.get(element.getValue(), iterator);
        }
    }
 
Example #13
Source File: SSLSessionDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
SSLSessionDefinition(boolean server) {
    super(new Parameters(PathElement.pathElement(ElytronDescriptionConstants.SSL_SESSION), RESOURCE_DESCRIPTION_RESOLVER)
        .setAddRestartLevel(OperationEntry.Flag.RESTART_NONE)
        .setRemoveRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES)
        .setRuntime());
    this.server = server;
}
 
Example #14
Source File: UtilTest.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Test of getNameFromAddress method, of class Util.
 */
@Test
public void testGetNameFromAddress_PathAddress() {
    System.out.println("getNameFromAddress");
    PathAddress address = PathAddress.EMPTY_ADDRESS;
    assertThat(Util.getNameFromAddress(address), is(nullValue()));
    address = PathAddress.pathAddress(PathElement.pathElement("subsystem"));
    assertThat(Util.getNameFromAddress(address), is(PathElement.WILDCARD_VALUE));
    address = PathAddress.pathAddress("subsystem", "test");
    assertThat(Util.getNameFromAddress(address), is("test"));
}
 
Example #15
Source File: ConcreteResourceRegistration.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
ProxyController getProxyController(ListIterator<PathElement> iterator) {
    if (iterator.hasNext()) {
        final PathElement next = iterator.next();
        final NodeSubregistry subregistry = getSubregistry(next.getKey());
        if (subregistry == null) {
            return null;
        }
        return subregistry.getProxyController(iterator, next.getValue());
    } else {
        return null;
    }
}
 
Example #16
Source File: AbstractClassificationResource.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Resource requireChild(PathElement address) {
    final Resource resource = getChild(address);
    if (resource == null) {
        throw new NoSuchResourceException(address);
    }
    return resource;
}
 
Example #17
Source File: GlobalOperationHandlers.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private boolean isWFCORE621Needed(ImmutableManagementResourceRegistration registration, PathAddress remaining) {
    if (remaining.size() > 0) {
        PathElement pe = remaining.getElement(0);
        if (pe.isMultiTarget() && RUNNING_SERVER.equals(pe.getKey())) {
            // We only need this for WildFly 8 and earlier (including EAP 6),
            // so that's proxied controllers running kernel version 1.x or 2.x
            ModelVersion modelVersion = registration.getProxyController(PathAddress.EMPTY_ADDRESS).getKernelModelVersion();
            return modelVersion.getMajor() < 3;
        }
    }
    return false;
}
 
Example #18
Source File: JdbcRealmDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
JdbcRealmDefinition() {
    super(new Parameters(PathElement.pathElement(ElytronDescriptionConstants.JDBC_REALM), ElytronExtension.getResourceDescriptionResolver(ElytronDescriptionConstants.JDBC_REALM))
            .setAddHandler(ADD)
            .setRemoveHandler(REMOVE)
            .setAddRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES)
            .setRemoveRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES)
            .setCapabilities(SECURITY_REALM_RUNTIME_CAPABILITY));
}
 
Example #19
Source File: SubsystemTestDelegate.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public ManagementResourceRegistration getSubModel(PathAddress address) {
    if (address.size() == 0) {
        return MOCK_RESOURCE_REG;
    } else if (address.size() == 1) {
        PathElement pe = address.getElement(0);
        String key = pe.getKey();
        if (pe.isWildcard()
                && (ModelDescriptionConstants.PROFILE.equals(key) || ModelDescriptionConstants.DEPLOYMENT.equals(key))) {
            return MOCK_RESOURCE_REG;
        }
    }
    return null;
}
 
Example #20
Source File: JMXSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource,
                                ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) {
    super.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration, capabilityRegistry);

    Resource coreManagement = Resource.Factory.create();
    rootResource.registerChild(CoreManagementResourceDefinition.PATH_ELEMENT, coreManagement);
    Resource auditLog = Resource.Factory.create();
    coreManagement.registerChild(AccessAuditResourceDefinition.PATH_ELEMENT, auditLog);

    Resource testFileHandler = Resource.Factory.create();
    testFileHandler.getModel().setEmptyObject();
    auditLog.registerChild(PathElement.pathElement(FILE_HANDLER, "test"), testFileHandler);

}
 
Example #21
Source File: TransformerRegistry.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public TransformersSubRegistration registerSubResource(PathElement element, boolean discard) {
    if(discard) {
        final PathAddress address = current.append(element);
        for(final ModelVersion version : range.getVersions()) {
            registry.createDiscardingChildRegistry(address, version);
        }
        return new TransformersSubRegistrationImpl(range, registry, address);
    }
    return registerSubResource(element, ResourceTransformer.DEFAULT, OperationTransformer.DEFAULT);
}
 
Example #22
Source File: FileSystemDeploymentServiceUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Test that a scanner does not interfere with a deployment it does not own. WFCORE-65 case. where external deployment
 * is owned by a different scanner.
 */
@Test
public void testIgnoreExternalScannerDeployment() throws Exception {
    PathAddress externalScanner = PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, DeploymentScannerExtension.SUBSYSTEM_NAME),
            PathElement.pathElement(DeploymentScannerExtension.SCANNERS_PATH.getKey(), "other"));

    testIgnoreExternalDeployment(new ExternalDeployment(externalScanner, false));
}
 
Example #23
Source File: StoppedServerResource.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void readResourceServerConfig(OperationContext context) {
    final PathAddress address = context.getCurrentAddress();
    final String hostName = address.getElement(0).getValue();
    final PathElement element = address.getLastElement();
    final String serverName = element.getValue();

    final ModelNode addr = new ModelNode();
    addr.add(HOST, hostName);
    addr.add(SERVER_CONFIG, serverName);
    context.readResourceFromRoot(PathAddress.pathAddress(addr), false);
}
 
Example #24
Source File: SubsystemTestDelegate.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void removeIgnoredChildren(final Collection<PathAddress> ignoredChildAddresses, final Collection<PathAddress> addresses) {
    // Remove all known ignored children
    addresses.removeAll(ignoredChildAddresses);
    // Checked for wildcards removals
    for (PathAddress ignoredChildAddress : ignoredChildAddresses) {
        final PathElement lastIgnoredElement = ignoredChildAddress.getLastElement();
        if (lastIgnoredElement.isWildcard()) {
            // Check each address
            for (final Iterator<PathAddress> iterator = addresses.iterator(); iterator.hasNext(); ) {
                final PathAddress childAddress = iterator.next();
                if (childAddress.size() == ignoredChildAddress.size()) {
                    // Check the last element key for a match
                    if (lastIgnoredElement.getKey().equals(childAddress.getLastElement().getKey())) {
                        boolean match = true;
                        // Check for matches on previous elements
                        for (int i = 0; i < ignoredChildAddress.size() - 1; i++) {
                            final PathElement e1 = ignoredChildAddress.getElement(i);
                            final PathElement e2 = childAddress.getElement(i);
                            if (!e1.equals(e2)) {
                                match = false;
                                break;
                            }
                        }
                        if (match) {
                            iterator.remove();
                        }
                    }
                }
            }
        }
    }
}
 
Example #25
Source File: SyncModelOperationHandlerWrapper.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static void processSocketBindingGroup(final Resource domain, final String name, final Set<String> socketBindings) {
    if (!socketBindings.contains(name)) {
        socketBindings.add(name);
        final PathElement pathElement = PathElement.pathElement(SOCKET_BINDING_GROUP, name);
        if (domain.hasChild(pathElement)) {
            final Resource resource = domain.getChild(pathElement);
            final ModelNode model = resource.getModel();
            if (model.hasDefined(INCLUDES)) {
                for (final ModelNode include : model.get(INCLUDES).asList()) {
                    processSocketBindingGroup(domain, include.asString(), socketBindings);
                }
            }
        }
    }
}
 
Example #26
Source File: PropertiesAuthorizationResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public PropertiesAuthorizationResourceDefinition() {
    super(new Parameters(PathElement.pathElement(ModelDescriptionConstants.AUTHORIZATION, ModelDescriptionConstants.PROPERTIES),
            ControllerResolver.getDeprecatedResolver(SecurityRealmResourceDefinition.DEPRECATED_PARENT_CATEGORY,
                      "core.management.security-realm.authorization.properties"))
            .setAddHandler(new SecurityRealmChildAddHandler(false, true, ATTRIBUTE_DEFINITIONS))
            .setAddRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setRemoveHandler(new SecurityRealmChildRemoveHandler(false))
            .setRemoveRestartLevel(OperationEntry.Flag.RESTART_ALL_SERVICES)
            .setDeprecatedSince(ModelVersion.create(1, 7)));
}
 
Example #27
Source File: SSLServerIdentityResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public SSLServerIdentityResourceDefinition() {
    super(new Parameters(PathElement.pathElement(ModelDescriptionConstants.SERVER_IDENTITY, ModelDescriptionConstants.SSL),
            ControllerResolver.getDeprecatedResolver(SecurityRealmResourceDefinition.DEPRECATED_PARENT_CATEGORY, "core.management.security-realm.server-identity.ssl"))
            .setAddHandler(new SecurityRealmChildAddHandler(false, false, ATTRIBUTE_DEFINITIONS))
            .setAddRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES)
            .setRemoveHandler(new SecurityRealmChildRemoveHandler(false))
            .setRemoveRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES)
            .setDeprecatedSince(ModelVersion.create(1, 7)));
}
 
Example #28
Source File: ConcreteResourceRegistration.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
ManagementResourceRegistration getResourceRegistration(ListIterator<PathElement> iterator) {
    if (! iterator.hasNext()) {
        checkPermission();
        return this;
    } else {
        final PathElement address = iterator.next();
        final NodeSubregistry subregistry = getSubregistry(address.getKey());
        if (subregistry != null) {
            return subregistry.getResourceRegistration(iterator, address.getValue());
        } else {
            return null;
        }
    }
}
 
Example #29
Source File: AbstractTransformationDescriptionBuilder.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected AbstractTransformationDescriptionBuilder(PathElement pathElement, PathAddressTransformer pathAddressTransformer,
                                         ResourceTransformer resourceTransformer,
                                         OperationTransformer operationTransformer,
                                         DynamicDiscardPolicy dynamicDiscardPolicy) {
    this.pathElement = pathElement;
    this.pathAddressTransformer = pathAddressTransformer;
    this.resourceTransformer = resourceTransformer;
    this.operationTransformer = operationTransformer;
    this.dynamicDiscardPolicy = dynamicDiscardPolicy;
}
 
Example #30
Source File: SyncModelServerStateTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void registerRootDeployment(Resource root, String deploymentName, byte[] bytes) {
    Resource deployment = Resource.Factory.create();
    deployment.getModel().get(NAME).set(deploymentName);
    deployment.getModel().get(RUNTIME_NAME).set(deploymentName);
    setDeploymentBytes(deployment, bytes);
    root.registerChild(PathElement.pathElement(DEPLOYMENT, deploymentName), deployment);
}