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); } } } });
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); } } } });
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); } } } });
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);
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { if (pathEventContext.isInstallServices()) { pathManager.removePathService(context, name); } context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { try { if (pathEventContext.isInstallServices()) { final ServiceTarget target = context.getServiceTarget(); if (relativeTo == null) { pathManager.addAbsolutePathService(target, name, path); } else { pathManager.addRelativePathService(target, name, path, false, relativeTo); } } else { context.revertRestartRequired(); } } catch (Exception e) { MGMT_OP_LOGGER.errorRevertingOperation(e, getClass().getSimpleName(), operation.require(ModelDescriptionConstants.OP).asString(), PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR))); } } }); } }, OperationContext.Stage.RUNTIME);
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);
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final ServiceController<?> legacyService; if (pathEventContext.isInstallServices()) { //Add the legacy services final ServiceTarget target = context.getServiceTarget(); if (relativeTo == null) { legacyService = pathManager.addAbsolutePathService(target, name, path); } else { legacyService = pathManager.addRelativePathService(target, name, path, false, relativeTo); } } 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);
@Override protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode valueToRestore, ModelNode valueToRevert, PathUpdate handback) throws OperationFailedException { final String pathName = context.getCurrentAddressValue(); 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()); } 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); } } else { pathEventContext.revert(); } }
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { if (pathEventContext.isInstallServices()) { pathManager.removePathService(context, name); } context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { try { if (pathEventContext.isInstallServices()) { final ServiceTarget target = context.getServiceTarget(); if (relativeTo == null) { pathManager.addAbsolutePathService(target, name, path); } else { pathManager.addRelativePathService(target, name, path, false, relativeTo); } } else { context.revertRestartRequired(); } } catch (Exception e) { MGMT_OP_LOGGER.errorRevertingOperation(e, getClass().getSimpleName(), operation.require(ModelDescriptionConstants.OP).asString(), PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR))); } } }); } }, OperationContext.Stage.RUNTIME);
@Override protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, 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); pathManager.changePathServices(context, pathName, pathVal, verificationHandler); } else if (attributeName.equals(RELATIVE_TO)) { String relToVal = resolvedValue.isDefined() ? resolvedValue.asString() : null; pathManager.changeRelativePath( pathName, relToVal, true); pathManager.changeRelativePathServices(context, pathName, relToVal, verificationHandler); } } handbackHolder.setHandback(new PathUpdate(backup, pathEventContext)); return false; }
@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(); } }
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final ServiceController<?> legacyService; if (pathEventContext.isInstallServices()) { //Add the legacy services final ServiceTarget target = context.getServiceTarget(); if (relativeTo == null) { legacyService = pathManager.addAbsolutePathService(target, name, path); } else { legacyService = pathManager.addRelativePathService(target, name, path, false, relativeTo); } } 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);
@Override protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, 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); pathManager.changePathServices(context, pathName, pathVal, verificationHandler); } else if (attributeName.equals(RELATIVE_TO)) { String relToVal = resolvedValue.isDefined() ? resolvedValue.asString() : null; pathManager.changeRelativePath( pathName, relToVal, true); pathManager.changeRelativePathServices(context, pathName, relToVal, verificationHandler); } } handbackHolder.setHandback(new PathUpdate(backup, pathEventContext)); return false; }
@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(); } }
@Override protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode valueToRestore, ModelNode valueToRevert, PathUpdate handback) throws OperationFailedException { final String pathName = context.getCurrentAddressValue(); 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()); } 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); } } else { pathEventContext.revert(); } }
@Override protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode resolvedValue, ModelNode currentValue, HandbackHolder<PathUpdate> handbackHolder) throws OperationFailedException { final String pathName = context.getCurrentAddressValue(); final PathEntry pathEntry = pathManager.getPathEntry(pathName); final PathEntry backup = new PathEntry(pathEntry); final PathEventContextImpl pathEventContext = pathManager.checkRestartRequired(context, pathName, Event.UPDATED); if (pathEventContext.isInstallServices()) { if (attributeName.equals(PATH)) { String pathVal = resolvedValue.asString(); pathManager.changePath(pathName, pathVal); pathManager.changePathServices(context, pathName, pathVal); } else if (attributeName.equals(RELATIVE_TO)) { String relToVal = resolvedValue.isDefined() ? resolvedValue.asString() : null; pathManager.changeRelativePath( pathName, relToVal, true); pathManager.changeRelativePathServices(context, pathName, relToVal); } } handbackHolder.setHandback(new PathUpdate(backup, pathEventContext)); return false; }
@Override protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode resolvedValue, ModelNode currentValue, HandbackHolder<PathUpdate> handbackHolder) throws OperationFailedException { final String pathName = context.getCurrentAddressValue(); final PathEntry pathEntry = pathManager.getPathEntry(pathName); final PathEntry backup = new PathEntry(pathEntry); final PathEventContextImpl pathEventContext = pathManager.checkRestartRequired(context, pathName, Event.UPDATED); if (pathEventContext.isInstallServices()) { if (attributeName.equals(PATH)) { String pathVal = resolvedValue.asString(); pathManager.changePath(pathName, pathVal); pathManager.changePathServices(context, pathName, pathVal); } else if (attributeName.equals(RELATIVE_TO)) { String relToVal = resolvedValue.isDefined() ? resolvedValue.asString() : null; pathManager.changeRelativePath( pathName, relToVal, true); pathManager.changeRelativePathServices(context, pathName, relToVal); } } handbackHolder.setHandback(new PathUpdate(backup, pathEventContext)); return false; }
@Override public void handleRollback(OperationContext context, ModelNode operation) { if (pathEventContext.isInstallServices()) { // Re-add entry to the path manager pathManager.addPathEntry(name, path, relativeTo, false); } } });
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); } } } });
@Override public void handleRollback(OperationContext context, ModelNode operation) { if (pathEventContext.isInstallServices()) { // Re-add entry to the path manager pathManager.addPathEntry(name, path, relativeTo, false); } } });