@Test public void testFeatures() { final CloudFrontDistributionConfiguration d = new WebsiteCloudFrontDistributionConfiguration( new S3Session(new Host(new S3Protocol(), new S3Protocol().getDefaultHostname())), new DisabledX509TrustManager(), new DefaultX509KeyManager(), Collections.emptyMap() ); assertNotNull(d.getFeature(Purge.class, Distribution.DOWNLOAD)); assertNotNull(d.getFeature(Purge.class, Distribution.WEBSITE_CDN)); assertNull(d.getFeature(Purge.class, Distribution.STREAMING)); assertNull(d.getFeature(Purge.class, Distribution.WEBSITE)); assertNotNull(d.getFeature(Index.class, Distribution.DOWNLOAD)); assertNotNull(d.getFeature(Index.class, Distribution.WEBSITE_CDN)); assertNotNull(d.getFeature(Index.class, Distribution.WEBSITE)); assertNull(d.getFeature(Index.class, Distribution.STREAMING)); assertNotNull(d.getFeature(DistributionLogging.class, Distribution.DOWNLOAD)); assertNotNull(d.getFeature(Cname.class, Distribution.DOWNLOAD)); assertNotNull(d.getFeature(Cname.class, Distribution.WEBSITE)); }
@Override @SuppressWarnings("unchecked") public <T> T getFeature(final Class<T> type, final Distribution.Method method) { if(type == Index.class) { if(method.equals(Distribution.WEBSITE)) { return (T) this; } } if(type == Cname.class) { return (T) this; } return super.getFeature(type, method); }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override @SuppressWarnings("unchecked") public <T> T getFeature(final Class<T> type, final Distribution.Method method) { if(type == Index.class) { if(method.equals(Distribution.WEBSITE)) { return (T) this; } } if(type == Cname.class) { return (T) this; } return super.getFeature(type, method); } }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override @SuppressWarnings("unchecked") public <T> T getFeature(final Class<T> type, final Distribution.Method method) { if(type == Index.class) { if(method.equals(Distribution.WEBSITE)) { return (T) this; } } if(type == Cname.class) { return (T) this; } return super.getFeature(type, method); } WebsiteCloudFrontDistributionConfiguration(final S3Session session, final X509TrustManager trust, final X509KeyManager key,
                                                      final Map<Path, Distribution> distributions); }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override @SuppressWarnings("unchecked") public <T> T getFeature(final Class<T> type, final Distribution.Method method) { if(type == Index.class) { if(method.equals(Distribution.WEBSITE)) { return (T) this; } } if(type == Cname.class) { return (T) this; } return super.getFeature(type, method); } WebsiteCloudFrontDistributionConfiguration(final S3Session session, final X509TrustManager trust, final X509KeyManager key,
                                                      final Map<Path, Distribution> distributions); @Override List<Distribution.Method> getMethods(final Path container); @Override String getName(final Distribution.Method method); @Override Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt); @Override void write(final Path container, final Distribution distribution, final LoginCallback prompt); @Override @SuppressWarnings("unchecked") T getFeature(final Class<T> type, final Distribution.Method method); }
WebsiteCloudFrontDistributionConfiguration extends CloudFrontDistributionConfiguration { @Override @SuppressWarnings("unchecked") public <T> T getFeature(final Class<T> type, final Distribution.Method method) { if(type == Index.class) { if(method.equals(Distribution.WEBSITE)) { return (T) this; } } if(type == Cname.class) { return (T) this; } return super.getFeature(type, method); } WebsiteCloudFrontDistributionConfiguration(final S3Session session, final X509TrustManager trust, final X509KeyManager key,
                                                      final Map<Path, Distribution> distributions); @Override List<Distribution.Method> getMethods(final Path container); @Override String getName(final Distribution.Method method); @Override Distribution read(final Path container, final Distribution.Method method, final LoginCallback prompt); @Override void write(final Path container, final Distribution distribution, final LoginCallback prompt); @Override @SuppressWarnings("unchecked") T getFeature(final Class<T> type, final Distribution.Method method);  }