public static String toCSVList(final List<String> csvList) { return join(csvList, ","); } }
protected String determineS3TemplateDirectory(final Long accountId, final Long templateId, final String templateUniqueName) { return join(asList(TEMPLATE_ROOT_DIR, accountId, templateId, templateUniqueName), S3Utils.SEPARATOR); }
protected String determineS3VolumeDirectory(final Long accountId, final Long volId) { return join(asList(VOLUME_ROOT_DIR, accountId, volId), S3Utils.SEPARATOR); }
private String determineStorageTemplatePath(final String storagePath, String dataPath, Integer nfsVersion) { return join(asList(getRootDir(storagePath, nfsVersion), dataPath), File.separator); }
public static String cleanPassword(String logString) { String cleanLogString = null; if (logString != null) { cleanLogString = logString; String[] temp = logString.split(","); int i = 0; if (temp != null) { while (i < temp.length) { temp[i] = StringUtils.cleanString(temp[i]); i++; } List<String> stringList = new ArrayList<String>(); Collections.addAll(stringList, temp); cleanLogString = StringUtils.join(stringList, ","); } } return cleanLogString; }
public static String cleanPassword(String logString) { String cleanLogString = null; if (logString != null) { cleanLogString = logString; String[] temp = logString.split(","); int i = 0; if (temp != null) { while (i < temp.length) { temp[i] = StringUtils.cleanString(temp[i]); i++; } List<String> stringList = new ArrayList<String>(); Collections.addAll(stringList, temp); cleanLogString = StringUtils.join(stringList, ","); } } return cleanLogString; } public static HttpClient getHttpClient() {
public static String cleanPassword(final String logString) { String cleanLogString = null; if (logString != null) { cleanLogString = logString; final String[] temp = logString.split(","); int i = 0; if (temp != null) { while (i < temp.length) { temp[i] = StringUtils.cleanString(temp[i]); i++; } final List<String> stringList = new ArrayList<String>(); Collections.addAll(stringList, temp); cleanLogString = StringUtils.join(stringList, ","); } } return cleanLogString; } }
public static String cleanPassword(String logString) { String cleanLogString = null; if (logString != null) { cleanLogString = logString; String[] temp = logString.split(","); int i = 0; if (temp != null) { while (i < temp.length) { temp[i] = StringUtils.cleanString(temp[i]); i++; } List<String> stringList = new ArrayList<String>(); Collections.addAll(stringList, temp); cleanLogString = StringUtils.join(stringList, ","); } } return cleanLogString; } }
@Override public String getEventDescription() { return "removing instances from load balancer: " + getId() + " (ids: " + StringUtils.join(getVirtualMachineIds(), ",") + ")"; }
@Override public String getEventDescription() { return "removing load balancer rules:" + StringUtils.join(getLoadBalancerRulesIds(), ",") + " from global load balancer: " + getGlobalLoadBalancerRuleId(); }
@Override public String getEventDescription() { return "applying instances for load balancer: " + getLoadBalancerId() + " (ids: " + StringUtils.join(getVirtualMachineIds(), ",") + ")"; }
@Override public String getEventDescription() { return "assign load balancer rules " + StringUtils.join(getLoadBalancerRulesIds(), ",") + " to global load balancer rule " + getGlobalLoadBalancerRuleId(); }
@Override public void copyAsync(Map<VolumeInfo, DataStore> volumeMap, VirtualMachineTO vmTo, Host srcHost, Host destHost, AsyncCompletionCallback<CopyCommandResult> callback) { DataMotionStrategy strategy = storageStrategyFactory.getDataMotionStrategy(volumeMap, srcHost, destHost); if (strategy == null) { List<String> volumeIds = new LinkedList<String>(); for (final VolumeInfo volumeInfo : volumeMap.keySet()) { volumeIds.add(volumeInfo.getUuid()); } throw new CloudRuntimeException("Can't find strategy to move data. " + "Source Host: " + srcHost.getName() + ", Destination Host: " + destHost.getName() + ", Volume UUIDs: " + StringUtils.join(volumeIds, ",")); } strategy.copyAsync(volumeMap, vmTo, srcHost, destHost, callback); } }
public OutOfBandManagementDriverResponse executeCommands(final List<String> commands, final Duration timeOut) { final ProcessResult result = RUNNER.executeCommands(commands, timeOut); if (LOG.isTraceEnabled()) { List<String> cleanedCommands = new ArrayList<String>(); int maskNextCommand = 0; for (String command : commands) { if (maskNextCommand > 0) { cleanedCommands.add("**** "); maskNextCommand--; continue; } if (command.equalsIgnoreCase("-P")) { maskNextCommand = 1; } else if (command.toLowerCase().endsWith("password")) { maskNextCommand = 2; } cleanedCommands.add(command); } LOG.trace("Executed ipmitool process with commands: " + StringUtils.join(cleanedCommands, ", ") + "\nIpmitool execution standard output: " + result.getStdOutput() + "\nIpmitool execution error output: " + result.getStdError()); } return new OutOfBandManagementDriverResponse(result.getStdOutput(), result.getStdError(), result.isSuccess()); } }
public S3TemplateDownloader(S3TO s3TO, String downloadUrl, String installPath, DownloadCompleteCallback downloadCompleteCallback, long maxTemplateSizeInBytes, String username, String password, Proxy proxy, ResourceType resourceType) { this.downloadUrl = downloadUrl; this.s3TO = s3TO; this.resourceType = resourceType; this.maxTemplateSizeInByte = maxTemplateSizeInBytes; this.httpClient = HTTPUtils.getHTTPClient(); this.downloadCompleteCallback = downloadCompleteCallback; // Create a GET method for the download url. this.getMethod = new GetMethod(downloadUrl); // Set the retry handler, default to retry 5 times. this.getMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, HTTPUtils.getHttpMethodRetryHandler(5)); // Follow redirects this.getMethod.setFollowRedirects(true); // Set file extension. this.fileExtension = StringUtils.substringAfterLast(StringUtils.substringAfterLast(downloadUrl, "/"), "."); // Calculate and set S3 Key. this.s3Key = join(asList(installPath, StringUtils.substringAfterLast(downloadUrl, "/")), S3Utils.SEPARATOR); // Set proxy if available. HTTPUtils.setProxy(proxy, this.httpClient); // Set credentials if available. HTTPUtils.setCredentials(username, password, this.httpClient); }
@Override public void execute() { CallContext.current().setEventDetails( "Global Load balancer rule Id: " + getGlobalLoadBalancerRuleId() + " VmIds: " + StringUtils.join(getLoadBalancerRulesIds(), ",")); boolean result = _gslbService.removeFromGlobalLoadBalancerRule(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove load balancer rule from global load balancer rule"); } }
@Override public void execute() { CallContext.current().setEventDetails( "Global Load balancer rule Id: " + getGlobalLoadBalancerRuleId() + " VmIds: " + StringUtils.join(getLoadBalancerRulesIds(), ",")); boolean result = _gslbService.assignToGlobalLoadBalancerRule(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign global load balancer rule"); } }
@Override public void execute() { CallContext.current().setEventDetails("Load balancer Id: " + getId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ",")); Map<Long, List<String>> vmIdIpsMap = getVmIdIpListMap(); try { boolean result = _lbService.removeFromLoadBalancer(id, virtualMachineIds, vmIdIpsMap); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove instance from load balancer rule"); } }catch (InvalidParameterValueException ex) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to remove instance from load balancer rule"); } }
@Override public void execute() { CallContext.current().setEventDetails("Load balancer Id: " + getLoadBalancerId() + " VmIds: " + StringUtils.join(getVirtualMachineIds(), ",")); Map<Long, List<String>> vmIdIpsMap = getVmIdIpListMap(); boolean result = false; try { result = _lbService.assignToLoadBalancer(getLoadBalancerId(), virtualMachineIds, vmIdIpsMap); }catch (CloudRuntimeException ex) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign load balancer rule"); } if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign load balancer rule"); } }