private String getFlushCommand(File file, FileAttributes fileAttributes) { StorageInfo storageInfo = StorageInfos.extractFrom(fileAttributes); StringBuilder sb = new StringBuilder(command); sb.append(" put ").append(fileAttributes.getPnfsId()).append(' ').append(file.getPath()); sb.append(" -si=").append(storageInfo.toString()); sb.append(options); LOGGER.debug("COMMAND: {}", sb); return sb.toString(); }
private String getFetchCommand(File file, FileAttributes attributes) { StorageInfo storageInfo = StorageInfos.extractFrom(attributes); StringBuilder sb = new StringBuilder(command); sb.append(" get ").append(attributes.getPnfsId()).append(' ').append(file.getPath()); sb.append(" -si=").append(storageInfo.toString()); for (URI location : getLocations(attributes)) { if (location.getScheme().equals(type) && location.getAuthority().equals(name)) { sb.append(" -uri=").append(location.toString()); } } sb.append(options); LOGGER.debug("COMMAND: {}", sb); return sb.toString(); }
@VisibleForTesting String[] getFlushCommand(URI dataFile, FileAttributes fileAttributes) { StorageInfo storageInfo = StorageInfos.extractFrom(fileAttributes); String[] argsArray = Stream.concat( Stream.of( command, "put", fileAttributes.getPnfsId().toString(), getFileString(dataFile), "-si=" + storageInfo), options.stream()) .toArray(String[]::new); LOGGER.debug("COMMAND: {}", Arrays.deepToString(argsArray)); return argsArray; }
@VisibleForTesting String[] getFetchCommand(URI dataFile, FileAttributes fileAttributes) { StorageInfo storageInfo = StorageInfos.extractFrom(fileAttributes); String[] argsArray = Stream.of( Stream.of( command, "get", fileAttributes.getPnfsId().toString(), getFileString(dataFile), "-si=" + storageInfo), getLocations(fileAttributes).stream().map(uri -> "-uri=" + uri), options.stream()) .flatMap(s -> s) .toArray(String[]::new); LOGGER.debug("COMMAND: {}", Arrays.deepToString(argsArray)); return argsArray; }