Examples of PathEventContextImpl


Examples of org.jboss.as.controller.services.path.PathManagerService.PathEventContextImpl

            context.addStep(new OperationStepHandler() {
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    final PathEntry backup = new PathEntry(pathEntry);

                    final PathEventContextImpl pathEventContext = pathManager.checkRestartRequired(context, pathName, Event.UPDATED);
                    if (pathEventContext.isInstallServices()) {
                        if (attributeName.equals(PATH)) {
                            pathManager.changePath(pathName, newValue.asString());
                            pathManager.changePathServices(context, pathName, newValue.asString());
                        } else if (attributeName.equals(RELATIVE_TO)) {
                            pathManager.changeRelativePath( pathName, newValue.isDefined() ?  newValue.asString() : null, true);
                            pathManager.changeRelativePathServices(context, pathName, newValue.isDefined() ?  newValue.asString() : null);
                        }
                    }

                    context.completeStep(new OperationContext.RollbackHandler() {
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            if (pathEventContext.isInstallServices()) {
                                if (attributeName.equals(PATH)) {
                                    pathManager.changePath(pathName, backup.getPath());
                                    pathManager.changePathServices(context, pathName, currentValue.asString());
                                } else if (attributeName.equals(RELATIVE_TO)) {
                                    try {
                                        pathManager.changeRelativePath(pathName, backup.getRelativeTo(), false);
                                    } catch (OperationFailedException e) {
                                        //Should not happen since false passed in for the 'check' parameter
                                        throw new RuntimeException(e);
                                    }
                                    pathManager.changeRelativePathServices(context, pathName, currentValue.isDefined() ?  currentValue.asString() : null);
                                }
                            } else {
                                pathEventContext.revert();
                            }
                        }
                    });
                }
            }, Stage.RUNTIME);
View Full Code Here

Examples of org.jboss.as.controller.services.path.PathManagerService.PathEventContextImpl

        context.removeResource(PathAddress.EMPTY_ADDRESS);

        if (services) {
            context.addStep(new OperationStepHandler() {
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    final PathEventContextImpl pathEventContext = pathManager.checkRestartRequired(context, name, Event.REMOVED);
                    if (pathEventContext.isInstallServices()) {
                        pathManager.removePathEntry(name, true);
                        pathManager.removePathService(context, name);
                    }

                    context.completeStep(new OperationContext.RollbackHandler() {
                        @Override
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            try {
                                final String path = PathAddHandler.getPathValue(context, PATH_SPECIFIED, model);
                                final String relativeTo = PathAddHandler.getPathValue(context, RELATIVE_TO, model);
                                if (pathEventContext.isInstallServices()) {
                                    pathManager.addPathEntry(name, path, relativeTo, false);
                                    final ServiceTarget target = context.getServiceTarget();
                                    if (relativeTo == null) {
                                        pathManager.addAbsolutePathService(target, name, path, null);
                                    } else {
View Full Code Here

Examples of org.jboss.as.controller.services.path.PathManagerService.PathEventContextImpl


        if (services) {
            final String path = getPathValue(context, PATH_SPECIFIED, model);
            final String relativeTo = getPathValue(context, RELATIVE_TO, model);
            final PathEventContextImpl pathEventContext = pathManager.checkRestartRequired(context, name, Event.ADDED);

            if (pathEventContext.isInstallServices()) {
                //Add service to the path manager
                pathManager.addPathEntry(name, path, relativeTo, false);
            }

            context.addStep(new OperationStepHandler() {
                public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException {
                    final ServiceController<?> legacyService;
                    if (pathEventContext.isInstallServices()) {

                        //Add the legacy services
                        final ServiceVerificationHandler verificationHandler = new ServiceVerificationHandler();
                        final ServiceTarget target = context.getServiceTarget();
                        if (relativeTo == null) {
                            legacyService = pathManager.addAbsolutePathService(target, name, path, verificationHandler);
                        } else {
                            legacyService = pathManager.addRelativePathService(target, name, path, false, relativeTo, verificationHandler);
                        }
                        //This is a change from the original version
                        context.addStep(verificationHandler, OperationContext.Stage.VERIFY);
                    } else {
                        legacyService = null;
                    }

                    context.completeStep(new OperationContext.RollbackHandler() {
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            pathManager.removePathService(context, name);
                            if (pathEventContext.isInstallServices()) {
                                if (legacyService != null) {
                                    context.removeService(legacyService.getName());
                                }
                            } else {
                                pathEventContext.revert();
                            }
                        }
                    });
                }
            }, OperationContext.Stage.RUNTIME);

            context.completeStep(new OperationContext.RollbackHandler() {
                public void handleRollback(OperationContext context, ModelNode operation) {
                    if (pathEventContext.isInstallServices()) {
                        try {
                            pathManager.removePathEntry(name, false);
                        } catch (OperationFailedException e) {
                            //Should not happen since 'false' passed in for the check parameter
                            throw new RuntimeException(e);
View Full Code Here

Examples of org.jboss.as.controller.services.path.PathManagerService.PathEventContextImpl

        context.removeResource(PathAddress.EMPTY_ADDRESS);

        if (services) {
            context.addStep(new OperationStepHandler() {
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    final PathEventContextImpl pathEventContext = pathManager.checkRestartRequired(context, name, Event.REMOVED);
                    if (pathEventContext.isInstallServices()) {
                        pathManager.removePathEntry(name, true);
                        pathManager.removePathService(context, name);
                    }

                    context.completeStep(new OperationContext.RollbackHandler() {
                        @Override
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            try {
                                final String path = PathAddHandler.getPathValue(context, PATH_SPECIFIED, model);
                                final String relativeTo = PathAddHandler.getPathValue(context, RELATIVE_TO, model);
                                if (pathEventContext.isInstallServices()) {
                                    pathManager.addPathEntry(name, path, relativeTo, false);
                                    final ServiceTarget target = context.getServiceTarget();
                                    if (relativeTo == null) {
                                        pathManager.addAbsolutePathService(target, name, path, null);
                                    } else {
View Full Code Here

Examples of org.jboss.as.controller.services.path.PathManagerService.PathEventContextImpl


        if (services) {
            final String path = getPathValue(context, PATH_SPECIFIED, model);
            final String relativeTo = getPathValue(context, RELATIVE_TO, model);
            final PathEventContextImpl pathEventContext = pathManager.checkRestartRequired(context, name, Event.ADDED);

            if (pathEventContext.isInstallServices()) {
                //Add service to the path manager
                pathManager.addPathEntry(name, path, relativeTo, false);
            }

            context.addStep(new OperationStepHandler() {
                public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException {
                    final ServiceController<?> legacyService;
                    if (pathEventContext.isInstallServices()) {

                        //Add the legacy services
                        final ServiceVerificationHandler verificationHandler = new ServiceVerificationHandler();
                        final ServiceTarget target = context.getServiceTarget();
                        if (relativeTo == null) {
                            legacyService = pathManager.addAbsolutePathService(target, name, path, verificationHandler);
                        } else {
                            legacyService = pathManager.addRelativePathService(target, name, path, false, relativeTo, verificationHandler);
                        }
                        //This is a change from the original version
                        context.addStep(verificationHandler, OperationContext.Stage.VERIFY);
                    } else {
                        legacyService = null;
                    }

                    context.completeStep(new OperationContext.RollbackHandler() {
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            pathManager.removePathService(context, name);
                            if (pathEventContext.isInstallServices()) {
                                if (legacyService != null) {
                                    context.removeService(legacyService.getName());
                                }
                            } else {
                                pathEventContext.revert();
                            }
                        }
                    });
                }
            }, OperationContext.Stage.RUNTIME);

            context.completeStep(new OperationContext.RollbackHandler() {
                public void handleRollback(OperationContext context, ModelNode operation) {
                    if (pathEventContext.isInstallServices()) {
                        try {
                            pathManager.removePathEntry(name, false);
                        } catch (OperationFailedException e) {
                            //Should not happen since 'false' passed in for the check parameter
                            throw new RuntimeException(e);
View Full Code Here

Examples of org.jboss.as.controller.services.path.PathManagerService.PathEventContextImpl

                                           ModelNode resolvedValue, ModelNode currentValue, HandbackHolder<PathUpdate> handbackHolder) throws OperationFailedException {
        final String pathName = PathAddress.pathAddress(operation.get(OP_ADDR)).getLastElement().getValue();
        final PathEntry pathEntry = pathManager.getPathEntry(pathName);
        final PathEntry backup = new PathEntry(pathEntry);

        final PathEventContextImpl pathEventContext = pathManager.checkRestartRequired(context, pathName, Event.UPDATED);
        if (pathEventContext.isInstallServices()) {
            final ServiceVerificationHandler verificationHandler = new ServiceVerificationHandler();
            context.addStep(verificationHandler, Stage.VERIFY);
            if (attributeName.equals(PATH)) {
                String pathVal = resolvedValue.asString();
                pathManager.changePath(pathName, pathVal);
View Full Code Here

Examples of org.jboss.as.controller.services.path.PathManagerService.PathEventContextImpl

    @Override
    protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName,
                                         ModelNode valueToRestore, ModelNode valueToRevert, PathUpdate handback) throws OperationFailedException {
        final String pathName = PathAddress.pathAddress(operation.get(OP_ADDR)).getLastElement().getValue();
        final PathEntry backup = handback.backup;
        final PathEventContextImpl pathEventContext = handback.context;
        if (pathEventContext.isInstallServices()) {
            if (attributeName.equals(PATH)) {
                pathManager.changePath(pathName, backup.getPath());
                pathManager.changePathServices(context, pathName, valueToRestore.asString(), null);
            } else if (attributeName.equals(RELATIVE_TO)) {
                try {
                    pathManager.changeRelativePath(pathName, backup.getRelativeTo(), false);
                } catch (OperationFailedException e) {
                    //Should not happen since false passed in for the 'check' parameter
                    throw new RuntimeException(e);
                }
                pathManager.changeRelativePathServices(context, pathName, valueToRestore.isDefined() ?  valueToRestore.asString() : null, null);
            }
        } else {
            pathEventContext.revert();
        }
    }
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.