@Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { if(directory.isRoot()) { return new S3BucketListService(session, new S3LocationFeature.S3Region(session.getHost().getRegion())).list(directory, listener); } return new S3ObjectListService(session).list(directory, listener); }
if(session.getHost().getCredentials().isAnonymousLogin()) { if(StringUtils.isEmpty(this.getContainer(session.getHost()))) { if(StringUtils.isNotBlank(session.getHost().getDefaultPath())) { if(containerService.isContainer(new Path(PathNormalizer.normalize(session.getHost().getDefaultPath()), EnumSet.of(Path.Type.directory)))) { final Path bucket = new Path(PathNormalizer.normalize(this.getContainer(session.getHost())), EnumSet.of(Path.Type.volume, Path.Type.directory)); final AttributedList<Path> buckets = new AttributedList<>(Collections.singletonList(bucket)); listener.chunk(directory, buckets); final String bucketname = this.getContainer(session.getHost()); if(StringUtils.isNotEmpty(bucketname)) { final Path bucket = new Path(PathNormalizer.normalize(bucketname), EnumSet.of(Path.Type.volume, Path.Type.directory));
@Override protected Map<Path, Distribution> operate(final PasswordCallback callback, final Path file) throws BackgroundException { final DistributionConfiguration feature = session.getFeature(DistributionConfiguration.class); if(null == feature) { return Collections.emptyMap(); } final AttributedList<Path> containers = new S3BucketListService(session, new S3LocationFeature.S3Region(session.getHost().getRegion())).list(file, new DisabledListProgressListener()); final Map<Path, Distribution> distributions = new ConcurrentHashMap<>(); for(Path container : containers) { for(Distribution.Method method : feature.getMethods(container)) { if(Distribution.WEBSITE.equals(method)) { continue; } if(Distribution.WEBSITE_CDN.equals(method)) { continue; } final Distribution distribution = feature.read(container, method, new DisabledLoginCallback()); if(distribution.isEnabled()) { if(log.isInfoEnabled()) { log.info(String.format("Cache distribution %s", distribution)); } distributions.put(container, distribution); } } } return distributions; } }
@Override public Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt) throws BackgroundException { if(method.equals(Distribution.WEBSITE)) { try { final WebsiteConfig configuration = session.getClient().getWebsiteConfig(container.getName()); final Distribution distribution = new Distribution(this.getOrigin(container, method), method, configuration.isWebsiteConfigActive()); distribution.setStatus(LocaleFactory.localizedString("Deployed", "S3")); // http://example-bucket.s3-website-us-east-1.amazonaws.com/ distribution.setUrl(URI.create(String.format("%s://%s", method.getScheme(), this.getWebsiteHostname(container)))); distribution.setIndexDocument(configuration.getIndexDocumentSuffix()); distribution.setContainers(new S3BucketListService(session, new S3LocationFeature.S3Region(session.getHost().getRegion())).list( new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)), new DisabledListProgressListener()).toList()); return distribution; } catch(ServiceException e) { // Not found. Website configuration not enabled. final Distribution distribution = new Distribution(this.getOrigin(container, method), method, false); distribution.setStatus(e.getErrorMessage()); distribution.setUrl(URI.create(String.format("%s://%s", method.getScheme(), this.getWebsiteHostname(container)))); return distribution; } } else { return super.read(container, method, prompt); } }
status.getTargetBucketName()); try { configuration.setContainers(new S3BucketListService(session, new S3LocationFeature.S3Region(session.getHost().getRegion())).list( new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)), new DisabledListProgressListener()).toList());
@Override public Distribution read(final Path file, final Distribution.Method method, final LoginCallback prompt) throws BackgroundException { final Path container = containerService.getContainer(file); final URI origin = URI.create(String.format("%s://%s.%s", method.getScheme(), container.getName(), this.getHostname())); try { final WebsiteConfig configuration = session.getClient().getWebsiteConfigImpl(container.getName()); final Distribution distribution = new Distribution( origin, method, configuration.isWebsiteConfigActive()); distribution.setUrl(URI.create(String.format("%s://%s.%s", method.getScheme(), container.getName(), this.getHostname()))); distribution.setStatus(LocaleFactory.localizedString("Deployed", "S3")); distribution.setIndexDocument(configuration.getIndexDocumentSuffix()); final DistributionLogging logging = this.getFeature(DistributionLogging.class, method); if(logging != null) { final LoggingConfiguration c = new GoogleStorageLoggingFeature(session).getConfiguration(container); distribution.setLogging(c.isEnabled()); distribution.setLoggingContainer(c.getLoggingTarget()); distribution.setContainers(new S3BucketListService(session).list( new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)), new DisabledListProgressListener()).toList()); } return distribution; } catch(ServiceException e) { // Not found. Website configuration is disabled. final Distribution distribution = new Distribution(origin, method, false); distribution.setStatus(e.getErrorMessage()); distribution.setUrl(URI.create(String.format("%s://%s.%s", method.getScheme(), container.getName(), this.getHostname()))); return distribution; } }
if(directory.isRoot()) { return new S3BucketListService(session, new S3LocationFeature.S3Region(session.getHost().getRegion())).list(directory, listener);
distribution.setContainers(new S3BucketListService(session, new S3LocationFeature.S3Region(session.getHost().getRegion())).list( new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)), new DisabledListProgressListener()).toList());
distribution.setContainers(new S3BucketListService(session, new S3LocationFeature.S3Region(session.getHost().getRegion())).list( new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)), new DisabledListProgressListener()).toList());