Examples of ImmutableManagementResourceRegistration


Examples of org.jboss.as.controller.registry.ImmutableManagementResourceRegistration

        String opName = operation.require(ModelDescriptionConstants.OP).asString();
        PathAddress unaliasedAddress = getUnaliasedAddress(operation);
        ModelNode unaliasedOp = operation.clone();
        unaliasedOp.get(ModelDescriptionConstants.OP_ADDR).set(unaliasedAddress.toModelNode());

        ImmutableManagementResourceRegistration resourceRegistration = context.getRootResourceRegistration();
        OperationStepHandler handler = resourceRegistration.getOperationHandler(unaliasedAddress, opName);

        context.addStep(unaliasedOp, handler, OperationContext.Stage.IMMEDIATE);

        context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
    }
View Full Code Here

Examples of org.jboss.as.controller.registry.ImmutableManagementResourceRegistration

            final Iterator<PathElement> iterator = current.iterator();
            if (iterator.hasNext()) {
                final PathElement element = iterator.next();
                if (element.isMultiTarget()) {
                    final String childType = element.getKey().equals("*") ? null : element.getKey();
                    final ImmutableManagementResourceRegistration registration = context.getResourceRegistration().getSubModel(base);
                    if (registration.isRemote() || registration.isRuntimeOnly()) {
                        // At least for proxies it should use the proxy operation handler
                        throw new IllegalStateException();
                    }
                    final Map<String, Set<String>> resolved = getChildAddresses(registration, resource, childType);
                    for (Map.Entry<String, Set<String>> entry : resolved.entrySet()) {
View Full Code Here

Examples of org.jboss.as.controller.registry.ImmutableManagementResourceRegistration

    @Override
    public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
        final String subsystem = operation.get(ModelDescriptionConstants.SUBSYSTEM).asString();
        final int major = operation.get(ModelDescriptionConstants.MANAGEMENT_MAJOR_VERSION).asInt();
        final int minor = operation.get(ModelDescriptionConstants.MANAGEMENT_MINOR_VERSION).asInt();
        final ImmutableManagementResourceRegistration rr = context.getResourceRegistration();
        // Add a step to transform the result of a READ_RESOURCE.
        // Do this first, Stage.IMMEDIATE
        final ModelNode readResourceResult = new ModelNode();
        context.addStep(new OperationStepHandler() {
            @Override
View Full Code Here

Examples of org.jboss.as.controller.registry.ImmutableManagementResourceRegistration

                missing.add(current.toModelNode());
            }
        }
        final Set<PathElement> children = registration.getChildAddresses(PathAddress.EMPTY_ADDRESS);
        for(final PathElement child : children) {
            final ImmutableManagementResourceRegistration childReg = registration.getSubModel(PathAddress.EMPTY_ADDRESS.append(child));
            if(childReg != null) {
                validateRemoveOperations(current.append(child), childReg, missing);
            }
        }
    }
View Full Code Here

Examples of org.jboss.as.controller.registry.ImmutableManagementResourceRegistration

    }

    void addSteps(final OperationContext context, final ModelNode operation, final ModelNode response, final boolean recordResponse) throws OperationFailedException {

        final PathAddress originalAddress = PathAddress.pathAddress(operation.get(OP_ADDR));
        final ImmutableManagementResourceRegistration originalRegistration = context.getResourceRegistration();
        if (originalRegistration == null) {
            String operationName = operation.require(OP).asString();
            throw new OperationFailedException(new ModelNode().set(String.format("No handler for operation %s at address %s", operationName, originalAddress)));
        }
        final Resource root = context.getRootResource();
View Full Code Here

Examples of org.jboss.as.controller.registry.ImmutableManagementResourceRegistration

        return primaryContext.isResourceServiceRestartAllowed();
    }

    @Override
    public ImmutableManagementResourceRegistration getResourceRegistration() {
        ImmutableManagementResourceRegistration parent = primaryContext.getResourceRegistration();
        return  parent.getSubModel(activeStep.address);
    }
View Full Code Here

Examples of org.jboss.as.controller.registry.ImmutableManagementResourceRegistration

        result.add(createAddOperation(address, resource.getModel(), children));
        for(final PathElement element : children) {
            if(element.isMultiTarget()) {
                final String childType = element.getKey();
                for(final Resource.ResourceEntry entry : resource.getChildren(childType)) {
                    final ImmutableManagementResourceRegistration childRegistration = registration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(childType, entry.getName())));
                    final ModelNode childAddress = address.clone();
                    childAddress.add(childType, entry.getName());
                    describe(entry, childAddress, result, childRegistration);
                }
            } else {
                final Resource child = resource.getChild(element);
                final ImmutableManagementResourceRegistration childRegistration = registration.getSubModel(PathAddress.pathAddress(element));
                final ModelNode childAddress = address.clone();
                childAddress.add(element.getKey(), element.getValue());
                describe(child, childAddress, result, childRegistration);
            }
        }
View Full Code Here

Examples of org.jboss.as.controller.registry.ImmutableManagementResourceRegistration

            index++;
            if(model.hasChild(next)) {
                model = model.getChild(next);
            } else {
                final PathAddress subAddress = pathAddr.subAddress(0, index);
                final ImmutableManagementResourceRegistration registration = context.getResourceRegistration().getSubModel(subAddress);

                if(registration != null) {
                    // If the target is a registered proxy return immediately
                    boolean remote = registration.isRemote();
                    if(remote && ! iterator.hasNext()) {
                        break out;
                    }
                    // Create the proxy op
                    final PathAddress newAddress = pathAddr.subAddress(index);
                    final ModelNode newOperation = operation.clone();
                    newOperation.get(OP_ADDR).set(subAddress.toModelNode());
                    newOperation.get(VALUE).set(newAddress.toModelNode());

                    // On the DC the host=master is not a proxy but the validate-address is registered at the root
                    // Otherwise delegate to the proxy handler
                    final OperationStepHandler proxyHandler = registration.getOperationHandler(PathAddress.EMPTY_ADDRESS, OPERATION_NAME);
                    if(proxyHandler != null) {
                        context.addStep(newOperation, proxyHandler, OperationContext.Stage.IMMEDIATE);
                        context.stepCompleted();
                        return;
                    }
View Full Code Here

Examples of org.jboss.as.controller.registry.ImmutableManagementResourceRegistration

    @Override
    public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {

        String operationName = NAME.resolveModelAttribute(context, operation).asString();

        final ImmutableManagementResourceRegistration registry = context.getResourceRegistration();
        OperationEntry operationEntry = registry.getOperationEntry(PathAddress.EMPTY_ADDRESS, operationName);
        if (operationEntry == null || (context.getProcessType() == ProcessType.DOMAIN_SERVER && !operationEntry.getFlags().contains(OperationEntry.Flag.RUNTIME_ONLY))) {
            throw new OperationFailedException(new ModelNode().set(MESSAGES.operationNotRegistered(operationName,
                    PathAddress.pathAddress(operation.require(OP_ADDR)))));
        } else {
            final ModelNode result = operationEntry.getDescriptionProvider().getModelDescription(GlobalOperationHandlers.getLocale(context, operation));
View Full Code Here

Examples of org.jboss.as.controller.registry.ImmutableManagementResourceRegistration

        // in reverse order of how they should execute, as that is the way adding a Stage.IMMEDIATE step works

        // Last to execute is the handler that assembles the overall response from the pieces created by all the other steps
        final ReadResourceAssemblyHandler assemblyHandler = new ReadResourceAssemblyHandler(directAttributes, metrics, otherAttributes, directChildren, childResources);
        context.addStep(assemblyHandler, queryRuntime ? OperationContext.Stage.VERIFY : OperationContext.Stage.IMMEDIATE, queryRuntime);
        final ImmutableManagementResourceRegistration registry = context.getResourceRegistration();

        // Get the model for this resource.
        final Resource resource = nullSafeReadResource(context, registry);

        final Map<String, Set<String>> childrenByType = registry != null ? GlobalOperationHandlers.getChildAddresses(context, address, registry, resource, null) : Collections.<String, Set<String>>emptyMap();
        final ModelNode model = resource.getModel();

        if (model.isDefined()) {
            // Store direct attributes first
            for (String key : model.keys()) {
                // In case someone put some garbage in it
                if (!childrenByType.containsKey(key)) {
                    directAttributes.put(key, model.get(key));
                }
            }
        }

        if (defaults) {
            //get the model description
            final DescriptionProvider descriptionProvider = registry.getModelDescription(PathAddress.EMPTY_ADDRESS);
            final Locale locale = GlobalOperationHandlers.getLocale(context, operation);
            final ModelNode nodeDescription = descriptionProvider.getModelDescription(locale);

            if (nodeDescription.isDefined() && nodeDescription.hasDefined(ATTRIBUTES)) {
                for (String key : nodeDescription.get(ATTRIBUTES).keys()) {
                    if ((!childrenByType.containsKey(key)) &&
                            (!directAttributes.containsKey(key) || !directAttributes.get(key).isDefined()) &&
                            nodeDescription.get(ATTRIBUTES).hasDefined(key) &&
                            nodeDescription.get(ATTRIBUTES, key).hasDefined(DEFAULT)) {
                        directAttributes.put(key, nodeDescription.get(ATTRIBUTES, key, DEFAULT));
                    }
                }
            }
        }

        if (!attributesOnly) {
            // Next, process child resources
            for (Map.Entry<String, Set<String>> entry : childrenByType.entrySet()) {
                String childType = entry.getKey();
                Set<String> children = entry.getValue();
                if (children.isEmpty()) {
                    // Just treat it like an undefined attribute
                    directAttributes.put(childType, new ModelNode());
                } else {
                    for (String child : children) {
                        if (recursive) {
                            PathElement childPE = PathElement.pathElement(childType, child);
                            PathAddress relativeAddr = PathAddress.pathAddress(childPE);
                            ImmutableManagementResourceRegistration childReg = registry.getSubModel(relativeAddr);
                            if (childReg == null) {
                                throw new OperationFailedException(new ModelNode().set(MESSAGES.noChildRegistry(childType, child)));
                            }
                            // Decide if we want to invoke on this child resource
                            boolean proxy = childReg.isRemote();
                            boolean runtimeResource = childReg.isRuntimeOnly();
                            boolean getChild = !runtimeResource || (queryRuntime && !proxy) || (proxies && proxy);
                            if (!aliases && childReg.isAlias()) {
                                getChild = false;
                            }
                            if (getChild) {
                                final int newDepth = recursiveDepth > 0 ? recursiveDepth - 1 : 0;
                                // Add a step to read the child resource
                                ModelNode rrOp = new ModelNode();
                                rrOp.get(OP).set(opName);
                                rrOp.get(OP_ADDR).set(PathAddress.pathAddress(address, childPE).toModelNode());
                                rrOp.get(ModelDescriptionConstants.RECURSIVE).set(operation.get(ModelDescriptionConstants.RECURSIVE));
                                rrOp.get(ModelDescriptionConstants.RECURSIVE_DEPTH).set(newDepth);
                                rrOp.get(ModelDescriptionConstants.PROXIES).set(proxies);
                                rrOp.get(ModelDescriptionConstants.INCLUDE_RUNTIME).set(queryRuntime);
                                rrOp.get(ModelDescriptionConstants.INCLUDE_ALIASES).set(aliases);
                                rrOp.get(ModelDescriptionConstants.INCLUDE_DEFAULTS).set(defaults);
                                ModelNode rrRsp = new ModelNode();
                                childResources.put(childPE, rrRsp);

                                OperationStepHandler rrHandler = childReg.getOperationHandler(PathAddress.EMPTY_ADDRESS, opName);
                                context.addStep(rrRsp, rrOp, rrHandler, OperationContext.Stage.IMMEDIATE);
                            }
                        } else {
                            ModelNode childMap = directChildren.get(childType);
                            if (childMap == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.