public UploadAnswer(final String jobId, final int uploadPct, final String errorString, final UploadStatus uploadStatus, final String fileSystemPath, final String installPath, final long templateSize) { super(); this.jobId = jobId; this.uploadPct = uploadPct; this.errorString = errorString; this.details = errorString; this.uploadStatus = uploadStatus; this.uploadPath = fileSystemPath; this.installPath = fixPath(installPath); this.templateSize = templateSize; }
public ListVolumeAnswer(final String secUrl, final Map<Long, TemplateProp> templateInfos) { super(null, true, "success"); this.setSecUrl(secUrl); this.templateInfos = templateInfos; }
public ListTemplateAnswer(final String secUrl, final Map<String, TemplateProp> templateInfos) { super(null, true, "success"); this.setSecUrl(secUrl); this.templateInfos = templateInfos; }
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()); }
/** * @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; }
public boolean isConnected(final String ip) { if (this.getResult()) { final Boolean status = ipToConnected.get(ip); if (status != null) { return status; } } return false; }
public static UnsupportedAnswer createUnsupportedVersionAnswer(final Command cmd) { return new UnsupportedAnswer(cmd, "Unsuppored Version."); }
public void setInstallPath(final String installPath) { this.installPath = fixPath(installPath); }
public CheckRouterAnswer(final CheckRouterCommand cmd, final String details, final boolean parse) { super(cmd, true, details); if (parse) { if (!parseDetails(details)) { result = false; } } }
public AttachAnswer(final DiskTO disk) { super(null); setDisk(disk); }
public CheckS2SVpnConnectionsAnswer(final CheckS2SVpnConnectionsCommand cmd, final boolean result, final String details) { super(cmd, result, details); ipToConnected = new HashMap<>(); ipToDetail = new HashMap<>(); if (result) { parseDetails(details); } }
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); } }
private Answer execute(final CheckRouterCommand cmd) { final ExecutionResult result = this._vrDeployer.executeInVR(cmd.getRouterAccessIp(), VRScripts.RVR_CHECK, null); if (!result.isSuccess()) { return new CheckRouterAnswer(cmd, result.getDetails()); } return new CheckRouterAnswer(cmd, result.getDetails(), true); }
public DettachAnswer(final DiskTO disk) { super(null); setDisk(disk); }
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; }
public String getDetail(final String ip) { if (this.getResult()) { return ipToDetail.get(ip); } return null; }
public void setInstallPath(final String installPath) { this.installPath = fixPath(installPath); }
public static UnsupportedAnswer createUnsupportedCommandAnswer(final Command cmd) { return new UnsupportedAnswer(cmd, "Unsupported command issued: " + cmd.toString() + ". Are you sure you got the right type of server?"); }
public DownloadAnswer(final String jobId, final int downloadPct, final String errorString, final VMTemplateStatus downloadStatus, final String fileSystemPath, final String installPath, final long templateSize, final long templatePhySicalSize, final String checkSum) { super(); this.jobId = jobId; this.downloadPct = downloadPct; this.errorString = errorString; this.details = errorString; this.downloadStatus = downloadStatus; this.downloadPath = fileSystemPath; this.installPath = fixPath(installPath); this.templateSize = templateSize; this.templatePhySicalSize = templatePhySicalSize; this.checkSum = checkSum; }
public boolean isIpPresent(final String ip) { return this.getResult() && ipToConnected.get(ip) != null; } }