@Test public void testFeatures() throws Exception { final DistributionConfiguration configuration = new SwiftDistributionConfiguration(session, Collections.emptyMap()); assertNotNull(configuration.getFeature(Purge.class, Distribution.DOWNLOAD)); assertNotNull(configuration.getFeature(Index.class, Distribution.DOWNLOAD)); assertNotNull(configuration.getFeature(DistributionLogging.class, Distribution.DOWNLOAD)); assertNull(configuration.getFeature(Cname.class, Distribution.DOWNLOAD)); }
@Override @SuppressWarnings("unchecked") public <T> T getFeature(final Class<T> type, final Distribution.Method method) { if(type == Purge.class) { return (T) new SwiftDistributionPurgeFeature(session, regionService); } if(type == Index.class) { return (T) this; } if(type == DistributionLogging.class) { return (T) this; } return null; }
SwiftDistributionConfiguration implements DistributionConfiguration, Index, DistributionLogging { @Override @SuppressWarnings("unchecked") public <T> T getFeature(final Class<T> type, final Distribution.Method method) { if(type == Purge.class) { return (T) new SwiftDistributionPurgeFeature(session, regionService); } if(type == Index.class) { return (T) this; } if(type == DistributionLogging.class) { return (T) this; } return null; } }
SwiftDistributionConfiguration implements DistributionConfiguration, Index, DistributionLogging { @Override @SuppressWarnings("unchecked") public <T> T getFeature(final Class<T> type, final Distribution.Method method) { if(type == Purge.class) { return (T) new SwiftDistributionPurgeFeature(session, regionService); } if(type == Index.class) { return (T) this; } if(type == DistributionLogging.class) { return (T) this; } return null; } SwiftDistributionConfiguration(final SwiftSession session, final Map<Path, Distribution> distributions);  SwiftDistributionConfiguration(final SwiftSession session, final Map<Path, Distribution> distributions, final SwiftRegionService regionService); }
SwiftDistributionConfiguration implements DistributionConfiguration, Index, DistributionLogging { @Override @SuppressWarnings("unchecked") public <T> T getFeature(final Class<T> type, final Distribution.Method method) { if(type == Purge.class) { return (T) new SwiftDistributionPurgeFeature(session, regionService); } if(type == Index.class) { return (T) this; } if(type == DistributionLogging.class) { return (T) this; } return null; } SwiftDistributionConfiguration(final SwiftSession session, final Map<Path, Distribution> distributions);  SwiftDistributionConfiguration(final SwiftSession session, final Map<Path, Distribution> distributions, final SwiftRegionService regionService); @Override void write(final Path file, final Distribution configuration, final LoginCallback prompt); @Override Distribution read(final Path file, final Distribution.Method method, final LoginCallback prompt); @Override @SuppressWarnings("unchecked") T getFeature(final Class<T> type, final Distribution.Method method); @Override DescriptiveUrlBag toUrl(final Path file); @Override String getHostname(); @Override List<Distribution.Method> getMethods(final Path container); @Override String getName(); @Override String getName(final Distribution.Method method); }
SwiftDistributionConfiguration implements DistributionConfiguration, Index, DistributionLogging { @Override @SuppressWarnings("unchecked") public <T> T getFeature(final Class<T> type, final Distribution.Method method) { if(type == Purge.class) { return (T) new SwiftDistributionPurgeFeature(session, regionService); } if(type == Index.class) { return (T) this; } if(type == DistributionLogging.class) { return (T) this; } return null; } SwiftDistributionConfiguration(final SwiftSession session, final Map<Path, Distribution> distributions);  SwiftDistributionConfiguration(final SwiftSession session, final Map<Path, Distribution> distributions, final SwiftRegionService regionService); @Override void write(final Path file, final Distribution configuration, final LoginCallback prompt); @Override Distribution read(final Path file, final Distribution.Method method, final LoginCallback prompt); @Override @SuppressWarnings("unchecked") T getFeature(final Class<T> type, final Distribution.Method method); @Override DescriptiveUrlBag toUrl(final Path file); @Override String getHostname(); @Override List<Distribution.Method> getMethods(final Path container); @Override String getName(); @Override String getName(final Distribution.Method method);  }