assert (!this._vrAggregateCommandsSet.containsKey(routerName)); this._vrAggregateCommandsSet.put(routerName, new LinkedBlockingQueue<>()); return new Answer(aggregationCommand, true, "Command aggregation started"); } else if (Action.Finish.equals(action)) { final Queue<NetworkElementCommand> queue = this._vrAggregateCommandsSet.get(routerName); if (!commandAnswer.getResult()) { return new Answer(aggregationCommand, false, "Aggregated command failed to execute " + commandAnswer.getDetails()); return new Answer(aggregationCommand, true, "Command aggregation finished"); } finally { queue.clear(); return new Answer(aggregationCommand, false, "Fail to recognize aggregation action " + action.toString());
private Answer executeQueryCommand(final NetworkElementCommand cmd) { if (cmd instanceof CheckRouterCommand) { return execute((CheckRouterCommand) cmd); } else if (cmd instanceof GetDomRVersionCommand) { return execute((GetDomRVersionCommand) cmd); } else if (cmd instanceof CheckS2SVpnConnectionsCommand) { return execute((CheckS2SVpnConnectionsCommand) cmd); } else { s_logger.error("Unknown query command in VirtualRoutingResource!"); return Answer.createUnsupportedCommandAnswer(cmd); } }
protected Answer createErrorAnswer(final Command cmd, final String msg, final Throwable th) { final StringWriter writer = new StringWriter(); if (msg != null) { writer.append(msg); } writer.append("===>Stack<==="); th.printStackTrace(new PrintWriter(writer)); return new Answer(cmd, false, writer.toString()); }
if (!rc.isSuccess()) { s_logger.error("Failed to prepare VR command due to " + rc.getDetails()); return new Answer(cmd, false, rc.getDetails()); return new Answer(cmd); return Answer.createUnsupportedCommandAnswer(cmd); return new Answer(cmd, false, e.getMessage()); } finally { lock.unlock();
/** * @return For Commands with handler OnError.Continue, one command succeeding is successful. If not, all commands must succeed to be successful. */ public boolean isSuccessful() { if (_answers == null) { return false; } if (_handler == OnError.Continue) { return true; } for (final Answer answer : _answers) { if (_handler == OnError.Continue && answer.getResult()) { return true; } else if (_handler != OnError.Continue && !answer.getResult()) { return false; } } return _handler != OnError.Continue; }
private Answer applyConfig(final NetworkElementCommand cmd, final List<ConfigItem> cfg) { return new Answer(cmd, true, "Nothing to do"); return new Answer(cmd, finalResult, results.get(0).getDetails()); } else { return new GroupAnswer(cmd, finalResult, results.size(), details.toArray(new String[details.size()]));
protected Answer execute(final DeleteCommand cmd) { final DataTO data = cmd.getData(); Answer answer = null; if (data.getObjectType() == DataObjectType.VOLUME) { answer = processor.deleteVolume(cmd); } else if (data.getObjectType() == DataObjectType.SNAPSHOT) { answer = processor.deleteSnapshot(cmd); } else { answer = new Answer(cmd, false, "unsupported type"); } return answer; }
@Override public Answer handleStorageCommands(final StorageSubSystemCommand command) { if (command instanceof CopyCommand) { return this.execute((CopyCommand) command); } else if (command instanceof CreateObjectCommand) { return execute((CreateObjectCommand) command); } else if (command instanceof DeleteCommand) { return execute((DeleteCommand) command); } else if (command instanceof AttachCommand) { return execute((AttachCommand) command); } else if (command instanceof DettachCommand) { return execute((DettachCommand) command); } else if (command instanceof IntroduceObjectCommand) { return processor.introduceObject((IntroduceObjectCommand) command); } else if (command instanceof SnapshotAndCopyCommand) { return processor.snapshotAndCopy((SnapshotAndCopyCommand) command); } return new Answer((Command) command, false, "not implemented yet"); }
final Answer ans = new Answer(cmd1, true, "No Problem"); final Response cresp = new Response(creq, ans);
return new Answer(cmd, false, "not implemented yet");