Java Code Examples for org.jboss.as.controller.PathAddress#equals()

The following examples show how to use org.jboss.as.controller.PathAddress#equals() . 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: WildcardReadsTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static ModelNode getResultItem(ModelNode response, PathAddress pathAddress) {
    for (ModelNode item : response.get(RESULT).asList()) {
        if (pathAddress.equals(PathAddress.pathAddress(item.get(ADDRESS)))) {
            return item;
        }
    }
    fail(String.format("No %s in %s", pathAddress, response.get(RESULT)));
    // Unreachable
    throw new IllegalStateException();
}
 
Example 2
Source File: WildcardReadsTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static ModelNode getAccessControlItem(ModelNode response, PathAddress pathAddress) {
    for (ModelNode item : response.get(RESPONSE_HEADERS, ACCESS_CONTROL).asList()) {
        if (pathAddress.equals(PathAddress.pathAddress(item.get(ABSOLUTE_ADDRESS)))) {
            return item;
        }
    }
    fail(String.format("No %s in %s", pathAddress, response.get(RESPONSE_HEADERS, ACCESS_CONTROL)));
    // Unreachable
    throw new IllegalStateException();
}
 
Example 3
Source File: RemoteProxyController.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private ModelNode translateOperationForProxy(final ModelNode op, PathAddress targetAddress) {
    final PathAddress translated = addressTranslator.translateAddress(targetAddress);
    if (targetAddress.equals(translated)) {
        return op;
    }
    final ModelNode proxyOp = op.clone();
    proxyOp.get(OP_ADDR).set(translated.toModelNode());
    return proxyOp;

}
 
Example 4
Source File: ModelControllerMBeanHelper.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private boolean isExcludeAddress(PathAddress pathAddress) {
    return pathAddress.equals(CORE_SERVICE_PLATFORM_MBEAN);
}
 
Example 5
Source File: OperationRouting.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static Set<OperationEntry.Flag> resolveOperationFlags(final PathAddress address, final String operationName,
                                                              final ImmutableManagementResourceRegistration rootRegistration,
                                                              final boolean compositeStep,
                                                              final String localHostName) throws OperationFailedException {
    Set<OperationEntry.Flag> result = null;
    boolean validAddress = false;

    OperationEntry ope = rootRegistration.getOperationEntry(address, operationName);
    if (ope != null) {
        return ope.getFlags();
    }

    ImmutableManagementResourceRegistration targetReg = rootRegistration.getSubModel(address);
    if (targetReg != null) {
        validAddress = true;
        OperationEntry opE = targetReg.getOperationEntry(PathAddress.EMPTY_ADDRESS, operationName);
        result = opE == null ? null : opE.getFlags();
    } else if (compositeStep && isDomainOrLocalHost(address, localHostName)) {
        // WFCORE-323. This could be a subsystem step in a composite where an earlier step adds
        // the extension. So the registration of the subsystem would not be done yet.
        // See if we can figure out flags usable for routing.
        PathAddress subsystemRoot = findSubsystemRootAddress(address);
        if (subsystemRoot != null // else this isn't for a subsystem
                // Only bother if the subsystem root is not registered.
                // If the root is registered any child is already registered too.
                && (address.equals(subsystemRoot) || rootRegistration.getSubModel(subsystemRoot) == null)) {

            if (STD_READ_OPS.contains(operationName)) {
                // One of the global read ops. OperationEntry.Flag.DOMAIN_PUSH_TO_SERVERS handling
                // (which is only meant for core ops) is not supported.
                result = Collections.singleton(OperationEntry.Flag.READ_ONLY);
            } else if (STD_WRITE_OPS.contains(operationName)) {
                // One of the global write ops, or 'add' or 'remove'.
                // Not read only and OperationEntry.Flag.MASTER_HOST_CONTROLLER_ONLY handling
                // (which is only meant for core ops) is not supported.
                result = Collections.emptySet();
            } // else we don't know what this op does so we can't provide a routing.
        }
    }

    if (result == null) {
        // Throw appropriate exception
        if (validAddress) {
            // Bad operation name exception
            throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.noHandlerForOperation(operationName, address));
        } else {
            // Bad address exception
            throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.noSuchResourceType(address));
        }
    }

    return result;
}