throw new CommandFormatException(f.getAbsolutePath() + " is a directory."); builder = PatchOperationBuilder.Factory.patch(f); } else if (ROLLBACK.equals(action)) { String resetConfigValue = resetConfiguration.getValue(args, true); final String id = patchId.getValue(args, true); final boolean rollbackTo = this.rollbackTo.isPresent(args); builder = PatchOperationBuilder.Factory.rollback(patchStream, id, rollbackTo, resetConfig); } else { builder = PatchOperationBuilder.Factory.rollbackLast(patchStream, resetConfig); return PatchOperationBuilder.Factory.streams(); builder = PatchOperationBuilder.Factory.info(patchStream); } else { builder = PatchOperationBuilder.Factory.info(patchStream, pId, verbose.isPresent(args)); builder = PatchOperationBuilder.Factory.history(patchStream, excludeAgedOut.isPresent(args)); return builder; } else {
throw new CommandFormatException(f.getAbsolutePath() + " is a directory."); builder = PatchOperationBuilder.Factory.patch(f); } else if (ROLLBACK.equals(action)) { String resetConfigValue = resetConfiguration.getValue(args, true); final String id = patchId.getValue(args, true); final boolean rollbackTo = this.rollbackTo.isPresent(args); builder = PatchOperationBuilder.Factory.rollback(patchStream, id, rollbackTo, resetConfig); } else { builder = PatchOperationBuilder.Factory.rollbackLast(patchStream, resetConfig); return PatchOperationBuilder.Factory.streams(); builder = PatchOperationBuilder.Factory.info(patchStream); } else { builder = PatchOperationBuilder.Factory.info(patchStream, pId, verbose.isPresent(args)); builder = PatchOperationBuilder.Factory.history(patchStream, excludeAgedOut.isPresent(args)); return builder; } else {
private static List<ModelNode> getAllPatches(PatchOperationTarget target, String stream) throws PatchingException { if (stream == null) { PatchOperationBuilder streams = PatchOperationBuilder.Factory.streams(); // retrieve all streams. ModelNode response = streams.execute(target); final ModelNode result = response.get(ModelDescriptionConstants.RESULT); if (!result.isDefined()) { return Collections.emptyList(); } // retrieve patches in stream. List<ModelNode> patches = new ArrayList<>(); List<ModelNode> list = response.get(ModelDescriptionConstants.RESULT).asList(); for (ModelNode s : list) { patches.addAll(getPatches(target, s.asString())); } return patches; } else { return getPatches(target, stream); } }
private static List<ModelNode> getAllPatches(PatchOperationTarget target, String stream) throws PatchingException { if (stream == null) { PatchOperationBuilder streams = PatchOperationBuilder.Factory.streams(); // retrieve all streams. ModelNode response = streams.execute(target); final ModelNode result = response.get(ModelDescriptionConstants.RESULT); if (!result.isDefined()) { return Collections.emptyList(); } // retrieve patches in stream. List<ModelNode> patches = new ArrayList<>(); List<ModelNode> list = response.get(ModelDescriptionConstants.RESULT).asList(); for (ModelNode s : list) { patches.addAll(getPatches(target, s.asString())); } return patches; } else { return getPatches(target, stream); } }
public static PatchOperationBuilder history(final String patchStream) { return history(patchStream, false); }
@Override protected PatchOperationBuilder createUnconfiguredOperationBuilder(CommandContext ctx) throws CommandException { if (file == null) { throw new CommandException("A path is required."); } if (!file.exists()) { // i18n is never used for CLI exceptions throw new CommandException("Path " + file.getAbsolutePath() + " doesn't exist."); } if (file.isDirectory()) { throw new CommandException(file.getAbsolutePath() + " is a directory."); } return PatchOperationBuilder.Factory.patch(file); }
public static PatchOperationBuilder history(final String patchStream) { return history(patchStream, false); }
@Override protected PatchOperationBuilder createUnconfiguredOperationBuilder(CommandContext ctx) throws CommandException { if (file == null) { throw new CommandException("A path is required."); } if (!file.exists()) { // i18n is never used for CLI exceptions throw new CommandException("Path " + file.getAbsolutePath() + " doesn't exist."); } if (file.isDirectory()) { throw new CommandException(file.getAbsolutePath() + " is a directory."); } return PatchOperationBuilder.Factory.patch(file); }
/** * Get the patching history. * * @return the patching history */ public static PatchOperationBuilder history() { return history(null); }
@Override protected PatchOperationBuilder createPatchOperationBuilder(CommandContext ctx) throws CommandException { if (streams) { return PatchOperationBuilder.Factory.streams(); } PatchOperationBuilder builder; final String pId = getPatchId(); if (pId == null) { builder = PatchOperationBuilder.Factory.info(patchStream); } else { builder = PatchOperationBuilder.Factory.info(patchStream, pId, verbose); } return builder; }
@Override protected PatchOperationBuilder createPatchOperationBuilder(CommandContext ctx) throws CommandException { return PatchOperationBuilder.Factory.history(patchStream, excludeAgedOut); }
/** * Get the patching history. * * @return the patching history */ public static PatchOperationBuilder history() { return history(null); }
private static List<ModelNode> getPatches(PatchOperationTarget target, String stream) throws PatchingException { PatchOperationBuilder history = PatchOperationBuilder.Factory.history(stream); ModelNode resp = history.execute(target); ModelNode res = resp.get(ModelDescriptionConstants.RESULT); return res.asList(); }
/** * Create the rollback builder. * * @param patchId the patch-id to rollback * @param rollbackTo rollback all one off patches until the given patch-id * @param resetConfiguration whether to reset the configuration to the previous state * @return the operation builder */ public static PatchOperationBuilder rollback(final String patchId, final boolean rollbackTo, final boolean resetConfiguration) { return rollback(null, patchId, rollbackTo, resetConfiguration); }
@Override protected PatchOperationBuilder createPatchOperationBuilder(CommandContext ctx) throws CommandException { if (streams) { return PatchOperationBuilder.Factory.streams(); } PatchOperationBuilder builder; final String pId = getPatchId(); if (pId == null) { builder = PatchOperationBuilder.Factory.info(patchStream); } else { builder = PatchOperationBuilder.Factory.info(patchStream, pId, verbose); } return builder; }
@Override protected PatchOperationBuilder createPatchOperationBuilder(CommandContext ctx) throws CommandException { return PatchOperationBuilder.Factory.history(patchStream, excludeAgedOut); }
@Override protected PatchOperationBuilder createUnconfiguredOperationBuilder(CommandContext ctx) throws CommandException { PatchOperationBuilder builder; String patchId = getPatchId(); if (patchId != null) { builder = PatchOperationBuilder.Factory.rollback(patchStream, patchId, rollbackTo, resetConfiguration); } else { builder = PatchOperationBuilder.Factory.rollbackLast(patchStream, resetConfiguration); } return builder; }
private static List<ModelNode> getPatches(PatchOperationTarget target, String stream) throws PatchingException { PatchOperationBuilder history = PatchOperationBuilder.Factory.history(stream); ModelNode resp = history.execute(target); ModelNode res = resp.get(ModelDescriptionConstants.RESULT); return res.asList(); }
/** * Get the current patch info. * * @return the patch info */ public static PatchOperationBuilder info() { return info(null); }
/** * Create the rollback builder. * * @param patchId the patch-id to rollback * @param rollbackTo rollback all one off patches until the given patch-id * @param resetConfiguration whether to reset the configuration to the previous state * @return the operation builder */ public static PatchOperationBuilder rollback(final String patchId, final boolean rollbackTo, final boolean resetConfiguration) { return rollback(null, patchId, rollbackTo, resetConfiguration); }