Package org.jboss.as.controller.registry

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


        ModelNode cache = Resource.Tools.readModel(context.readResourceFromRoot(cacheAddress));
        return cache ;
    }

    private static Resource getCacheResource(OperationContext context, PathAddress cacheAddress) {
        Resource rootResource = context.readResourceFromRoot(cacheAddress, true);
        return rootResource ;
    }
View Full Code Here


            this.attributes = attributes;
        }

        @Override
        public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException {
            final Resource resource = context.createResource(PathAddress.EMPTY_ADDRESS);
            final ModelNode subModel = resource.getModel();

            // Process attributes
            for(final AttributeDefinition attribute : attributes) {
                attribute.validateAndSet(operation, subModel);
            }
View Full Code Here

            // The cache config parameters  <property name=>value</property>
            if(operation.hasDefined(ModelKeys.PROPERTIES)) {
                for(Property property : operation.get(ModelKeys.PROPERTIES).asPropertyList()) {
                    // create a new property=name resource
                    final Resource param = context.createResource(PathAddress.pathAddress(PathElement.pathElement(ModelKeys.PROPERTY, property.getName())));
                    final ModelNode value = property.getValue();
                    if(! value.isDefined()) {
                        throw new OperationFailedException(new ModelNode().set("property " + property.getName() + " not defined"));
                    }
                    // set the value of the property
                    param.getModel().get(ModelDescriptionConstants.VALUE).set(value);
                }
            }
        }
View Full Code Here

        final ModelNode model = new ModelNode();

        final ModelController controller = createController(ProcessType.HOST_CONTROLLER, model, new Setup() {
            public void setup(Resource resource, ManagementResourceRegistration root) {

                final Resource host = Resource.Factory.create();
                resource.registerChild(PathElement.pathElement(HOST, "master"), host);

                // TODO maybe make creating of empty nodes part of the MNR description
                host.registerChild(PathElement.pathElement(ModelDescriptionConstants.CORE_SERVICE, ModelDescriptionConstants.MANAGEMENT), Resource.Factory.create());
                host.registerChild(PathElement.pathElement(ModelDescriptionConstants.CORE_SERVICE, ModelDescriptionConstants.SERVICE_CONTAINER), Resource.Factory.create());

                final LocalHostControllerInfoImpl hostControllerInfo = new LocalHostControllerInfoImpl(new ControlledProcessState(false), "master");

                // Add of the host itself
                ManagementResourceRegistration hostRegistration = root.registerSubModel(PathElement.pathElement(HOST), HostDescriptionProviders.HOST_ROOT_PROVIDER);
View Full Code Here

    protected LocalDomainControllerRemoveHandler() {
    }

    @Override
    public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
        final Resource resource = context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS);
        final ModelNode model = resource.getModel();
        model.get(DOMAIN_CONTROLLER).setEmptyObject();
        context.completeStep();
    }
View Full Code Here

        final ModelNode domainModel = Resource.Tools.readModel(context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, true));
        context.addStep(new OperationStepHandler() {
            @Override
            public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                // start servers
                final Resource resource =  context.readResource(PathAddress.EMPTY_ADDRESS);
                final ModelNode hostModel = Resource.Tools.readModel(resource);
                if(hostModel.hasDefined(SERVER_CONFIG)) {
                    final ModelNode servers = hostModel.get(SERVER_CONFIG).clone();
                    if (hostControllerEnvironment.isRestart() || runningModeControl.getRestartMode() == RestartMode.HC_ONLY){
                        restartedHcStartOrReconnectServers(servers, domainModel);
View Full Code Here

    protected RemoteDomainControllerRemoveHandler() {
    }

    @Override
    public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
        final Resource resource = context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS);
        final ModelNode model = resource.getModel();
        model.get(DOMAIN_CONTROLLER).setEmptyObject();
        context.completeStep();
    }
View Full Code Here

            return;
        }
        final ManagementResourceRegistration registration = context.getResourceRegistrationForUpdate();
        final Set<String> children = registration.getChildNames(base);
        final ModelNode current = new ModelNode();
        final Resource resource = base.size() == 0 ? context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS) : context.createResource(base);
        if(node.getType() == ModelType.OBJECT) {
            for(final String key : node.keys()) {
                if(! children.contains(key)) {
                    current.get(key).set(node.get(key));
                }
            }
            resource.getModel().set(current);
        } else {
            resource.getModel().set(node);
            return;
        }
        if(children != null && ! children.isEmpty()) {
            for(final String childType : children) {
                if(node.hasDefined(childType)) {
View Full Code Here

            super(STRING_VALIDATOR);
        }

        @Override
        protected void validateReferencedNewValueExisits(OperationContext context, ModelNode value) throws OperationFailedException{
            final Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, false);
            //Don't do this on boot since the domain model is not populated yet
            if (!context.isBooting() && root.getChild(PathElement.pathElement(SERVER_GROUP, value.asString())) == null) {
                throw HostControllerMessages.MESSAGES.noServerGroupCalled(value.asString());
            }
        }
View Full Code Here

            super(STRING_VALIDATOR);
        }

        @Override
        protected void validateReferencedNewValueExisits(OperationContext context, ModelNode value) throws OperationFailedException{
            final Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, false);
            //Don't do this on boot since the domain model is not populated yet
            if (!context.isBooting() && root.getChild(PathElement.pathElement(SOCKET_BINDING_GROUP, value.asString())) == null) {
                throw HostControllerMessages.MESSAGES.noSocketBindingGroupCalled(value.asString());
            }
        }
View Full Code Here

TOP

Related Classes of org.jboss.as.controller.registry.Resource

Copyright © 2018 www.massapicom. 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.