Java Code Examples for org.jboss.as.controller.registry.ManagementResourceRegistration#getSubModel()

The following examples show how to use org.jboss.as.controller.registry.ManagementResourceRegistration#getSubModel() . 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: DomainModelControllerService.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void registerRunningServer(final ProxyController serverControllerClient) {
    PathAddress pa = serverControllerClient.getProxyNodeAddress();
    PathElement pe = pa.getElement(1);
    if (modelNodeRegistration.getProxyController(pa) != null) {
        throw HostControllerLogger.ROOT_LOGGER.serverNameAlreadyRegistered(pe.getValue());
    }
    ROOT_LOGGER.registeringServer(pe.getValue());
    // Register the proxy
    final ManagementResourceRegistration hostRegistration = modelNodeRegistration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(HOST, hostControllerInfo.getLocalHostName())));
    hostRegistration.registerProxyController(pe, serverControllerClient);
    // Register local operation overrides
    final ManagementResourceRegistration serverRegistration = hostRegistration.getSubModel(PathAddress.EMPTY_ADDRESS.append(pe));
    ServerConfigResourceDefinition.registerServerLifecycleOperations(serverRegistration, serverInventory);
    serverProxies.put(pe.getValue(), serverControllerClient);
}
 
Example 2
Source File: ExtensionRegistry.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Gets an {@link ExtensionContext} for use when handling an {@code add} operation for
 * a resource representing an {@link org.jboss.as.controller.Extension}.
 *
 * @param moduleName the name of the extension's module. Cannot be {@code null}
 * @param rootRegistration the root management resource registration
 * @param extensionRegistryType the type of registry we are working on, which has an effect on things like whether extensions get registered etc.
 *
 * @return  the {@link ExtensionContext}.  Will not return {@code null}
 */
public ExtensionContext getExtensionContext(final String moduleName, ManagementResourceRegistration rootRegistration, ExtensionRegistryType extensionRegistryType) {
    // Can't use processType.isServer() to determine where to look for profile reg because a lot of test infrastructure
    // doesn't add the profile mrr even in HC-based tests
    ManagementResourceRegistration profileRegistration = rootRegistration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(PROFILE)));
    if (profileRegistration == null) {
        profileRegistration = rootRegistration;
    }
    ManagementResourceRegistration deploymentsRegistration = processType.isServer() ? rootRegistration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(DEPLOYMENT))) : null;

    // Hack to restrict extra data to specified extension(s)
    boolean allowSupplement = legallySupplemented.contains(moduleName);
    ManagedAuditLogger al = allowSupplement ? auditLogger : null;
    return new ExtensionContextImpl(moduleName, profileRegistration, deploymentsRegistration, pathManager, extensionRegistryType, al);
}
 
Example 3
Source File: ModelDescriptionTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static void validate(ManagementResourceRegistration orig, ManagementResourceRegistration loaded) {
    Assert.assertEquals(orig.getChildAddresses(PathAddress.EMPTY_ADDRESS).size(), loaded.getChildAddresses(PathAddress.EMPTY_ADDRESS).size());

    Assert.assertEquals(orig.getAttributeNames(PathAddress.EMPTY_ADDRESS).size(), loaded.getAttributeNames(PathAddress.EMPTY_ADDRESS).size());
    for (String name : orig.getAttributeNames(PathAddress.EMPTY_ADDRESS)) {
        AttributeDefinition attr1 = orig.getAttributeAccess(PathAddress.EMPTY_ADDRESS, name).getAttributeDefinition();
        AttributeDefinition attr2 = loaded.getAttributeAccess(PathAddress.EMPTY_ADDRESS, name).getAttributeDefinition();
        Assert.assertEquals(1d, SimilarityIndex.compareAttributes(attr1, attr2), 0.0d);
    }
    for (PathElement pe : orig.getChildAddresses(PathAddress.EMPTY_ADDRESS)) {
        ManagementResourceRegistration origSub = orig.getSubModel(PathAddress.pathAddress(pe));
        ManagementResourceRegistration loadedSub = loaded.getSubModel(PathAddress.pathAddress(pe));
        validate(origSub, loadedSub);
    }
}
 
Example 4
Source File: ControllerInitializer.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Initializes the interface, socket binding group and socket binding part of the model
 *
 * @param rootResource the root model resource
 * @param rootRegistration the root model registry
 */
protected void initializePathsModel(Resource rootResource, ManagementResourceRegistration rootRegistration) {
    if (paths.size() == 0) {
        return;
    }
    rootResource.getModel().get(PATH);
    PathResourceDefinition def = PathResourceDefinition.createSpecified(pathManager);
    if (rootRegistration.getSubModel(PathAddress.pathAddress(def.getPathElement())) != null) {
        //Older versions of core model tests seem to register this resource, while in newer it does not get registered,
        //so let's remove it here if it exists already
        rootRegistration.unregisterSubModel(def.getPathElement());
    }
    rootRegistration.registerSubModel(def);
}
 
Example 5
Source File: ParallelBootOperationContext.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public ManagementResourceRegistration getResourceRegistrationForUpdate() {
    acquireControllerLock();
    ManagementResourceRegistration parent = primaryContext.getResourceRegistrationForUpdate();
    return  parent.getSubModel(activeStep.address);
}