@Test public void testGetContainer() { assertEquals("bucketname", new S3BucketListService(new S3Session(new Host(new S3Protocol()))).getContainer(new Host(new S3Protocol(), "bucketname.s3.amazonaws.com"))); assertNull(new S3BucketListService(new S3Session(new Host(new S3Protocol()))).getContainer(new Host(new TestProtocol(), "bucketname.s3.amazonaws.com"))); }
protected String getContainer(final Host host) { if(StringUtils.isBlank(host.getProtocol().getDefaultHostname())) { return null; } final String hostname = host.getHostname(); if(hostname.equals(host.getProtocol().getDefaultHostname())) { return null; } if(hostname.endsWith(host.getProtocol().getDefaultHostname())) { return ServiceUtils.findBucketNameInHostname(hostname, host.getProtocol().getDefaultHostname()); } return null; }
S3BucketListService implements RootListService { protected String getContainer(final Host host) { if(StringUtils.isBlank(host.getProtocol().getDefaultHostname())) { return null; } final String hostname = host.getHostname(); if(hostname.equals(host.getProtocol().getDefaultHostname())) { return null; } if(hostname.endsWith(host.getProtocol().getDefaultHostname())) { return ServiceUtils.findBucketNameInHostname(hostname, host.getProtocol().getDefaultHostname()); } return null; } }
S3BucketListService implements RootListService { protected String getContainer(final Host host) { if(StringUtils.isBlank(host.getProtocol().getDefaultHostname())) { return null; } final String hostname = host.getHostname(); if(hostname.equals(host.getProtocol().getDefaultHostname())) { return null; } if(hostname.endsWith(host.getProtocol().getDefaultHostname())) { return ServiceUtils.findBucketNameInHostname(hostname, host.getProtocol().getDefaultHostname()); } return null; } S3BucketListService(final S3Session session);  S3BucketListService(final S3Session session, final S3LocationFeature.S3Region region); }
S3BucketListService implements RootListService { protected String getContainer(final Host host) { if(StringUtils.isBlank(host.getProtocol().getDefaultHostname())) { return null; } final String hostname = host.getHostname(); if(hostname.equals(host.getProtocol().getDefaultHostname())) { return null; } if(hostname.endsWith(host.getProtocol().getDefaultHostname())) { return ServiceUtils.findBucketNameInHostname(hostname, host.getProtocol().getDefaultHostname()); } return null; } S3BucketListService(final S3Session session);  S3BucketListService(final S3Session session, final S3LocationFeature.S3Region region); @Override AttributedList<Path> list(final Path directory, final ListProgressListener listener); }
S3BucketListService implements RootListService { protected String getContainer(final Host host) { if(StringUtils.isBlank(host.getProtocol().getDefaultHostname())) { return null; } final String hostname = host.getHostname(); if(hostname.equals(host.getProtocol().getDefaultHostname())) { return null; } if(hostname.endsWith(host.getProtocol().getDefaultHostname())) { return ServiceUtils.findBucketNameInHostname(hostname, host.getProtocol().getDefaultHostname()); } return null; } S3BucketListService(final S3Session session);  S3BucketListService(final S3Session session, final S3LocationFeature.S3Region region); @Override AttributedList<Path> list(final Path directory, final ListProgressListener listener);  }