@Override protected int compareFirst(final Path p1, final Path p2) { if(StringUtils.isBlank(p1.attributes().getRegion()) && StringUtils.isBlank(p2.attributes().getRegion())) { return 0; } if(StringUtils.isBlank(p1.attributes().getRegion())) { return -1; } if(StringUtils.isBlank(p2.attributes().getRegion())) { return 1; } if(ascending) { return p1.attributes().getRegion().compareToIgnoreCase(p2.attributes().getRegion()); } return -p1.attributes().getRegion().compareToIgnoreCase(p2.attributes().getRegion()); }
/** * The website endpoint given the location of the bucket. When you configure a bucket as * a website, the website is available via the region-specific website endpoint. * The website endpoint you use must be in the same region that your bucket resides. * These website endpoints are different than the REST API endpoints (see Request * Endpoints). Amazon S3 supports the following website endpoint. * * @param bucket Bucket name * @return Website distribution hostname */ protected String getWebsiteHostname(final Path bucket) { // Geographical location final String location = bucket.attributes().getRegion(); // US Standard final String endpoint; if(null == location) { endpoint = "s3-website-us-east-1.amazonaws.com"; } else if("US".equals(location)) { endpoint = "s3-website-us-east-1.amazonaws.com"; } else if("EU".equals(location)) { endpoint = "s3-website-eu-west-1.amazonaws.com"; } else { endpoint = String.format("s3-website-%s.amazonaws.com", location); } return String.format("%s.%s", bucket.getName(), endpoint); } }
/** * @param parent the absolute directory * @param name the file relative to param path * @param type File type */ public Path(final Path parent, final String name, final EnumSet<Type> type) { this.type = type; this.attributes = new PathAttributes(); this.attributes.setRegion(parent.attributes.getRegion()); this._setPath(parent, name); }
private void setPath(final String absolute) { if(String.valueOf(Path.DELIMITER).equals(absolute)) { this._setPath(null, absolute); } else { final Path parent = new Path(PathNormalizer.parent(absolute, Path.DELIMITER), EnumSet.of(Type.directory)); parent.attributes().setRegion(attributes.getRegion()); if(parent.isRoot()) { parent.setType(EnumSet.of(Type.volume, Type.directory)); } this._setPath(parent, PathNormalizer.name(absolute)); } }
public Region lookup(final Path file) throws BackgroundException { final Path container = containerService.getContainer(file); if(Location.unknown.equals(new SwiftLocationFeature.SwiftRegion(container.attributes().getRegion()))) { return this.lookup(location.getLocation(container)); } return this.lookup(new SwiftLocationFeature.SwiftRegion(container.attributes().getRegion())); }
public DefaultPathPredicate(final Path file) { final Path.Type type = file.isSymbolicLink() ? Path.Type.symboliclink : file.isFile() ? Path.Type.file : Path.Type.directory; String qualifier = StringUtils.EMPTY; if(StringUtils.isNotBlank(file.attributes().getRegion())) { if(new PathContainerService().isContainer(file)) { qualifier += file.attributes().getRegion(); } } if(file.isFile()) { if(StringUtils.isNotBlank(file.attributes().getVersionId())) { qualifier += file.attributes().getVersionId(); } } final String path = file.getAbsolute(); reference = "[" + type + "]" + "-" + qualifier + path; }
result.put(r.getKey(), directory.mkdir(r.getValue(), r.getKey().attributes().getRegion(), new TransferStatus()));
if(r.getKey().isDirectory() && !move.isRecursive(r.getKey(), r.getValue())) { result.put(r.getKey(), session.getFeature(Directory.class).mkdir(r.getValue(), r.getKey().attributes().getRegion(), new TransferStatus()));
copy.append(",").append(next.attributes().getRegion());
return cache.get(container); if(Location.unknown.equals(new SwiftRegion(container.attributes().getRegion()))) { final SwiftRegion region = new SwiftRegion(session.getHost().getRegion()); if(Location.unknown.equals(region)) { final SwiftRegion r = new SwiftRegion(container.attributes().getRegion()); cache.put(container, r);
final PathAttributes attr = attributes.toAttributes(object); attr.setRegion(bucket.attributes().getRegion()); if(null == delimiter) { file = new Path(String.format("%s%s", bucket.getAbsolute(), key), types, attr); file = new Path(directory, PathNormalizer.name(key), EnumSet.of(Path.Type.directory, Path.Type.placeholder), attributes); attributes.setRegion(bucket.attributes().getRegion()); children.add(file);
attributes.setRegion(bucket.attributes().getRegion()); if(marker instanceof S3Version) { final S3Version object = (S3Version) marker;
@Override public Path call() throws BackgroundException { final PathAttributes attributes = new PathAttributes(); attributes.setRegion(bucket.attributes().getRegion()); final Path prefix = new Path(String.format("%s%s", bucket.getAbsolute(), PathNormalizer.normalize(common)), EnumSet.of(Path.Type.directory, Path.Type.placeholder), attributes);
if(source.getType().contains(Path.Type.placeholder)) { copy = session.getFeature(Directory.class).mkdir(renamed, source.attributes().getRegion(), new TransferStatus());
attr.setRegion(container.attributes().getRegion()); children.add(new Path(directory, PathNormalizer.name(object.getName()), types, attr)); marker = object.getName();
@Override public void visit(final AttributedList<Path> list, final int index, final Path file) { if(l) { if(file.isSymbolicLink()) { console.printf("%n%sl%s\t%s\t%s -> %s%s", Ansi.ansi().bold(), file.attributes().getPermission().getSymbol(), formatter.getMediumFormat( file.attributes().getModificationDate()), file.getName(), file.getSymlinkTarget().getAbsolute(), Ansi.ansi().reset()); } else { console.printf("%n%s%s%s\t%s\t%s\t%s%s", Ansi.ansi().bold(), file.isDirectory() ? "d" : "-", file.attributes().getPermission().getSymbol(), formatter.getMediumFormat( file.attributes().getModificationDate()), StringUtils.isNotBlank(file.attributes().getRegion()) ? file.attributes().getRegion() : StringUtils.EMPTY, file.getName(), Ansi.ansi().reset()); } } else { console.printf("%n%s%s%s", Ansi.ansi().bold(), file.getName(), Ansi.ansi().reset()); } }