public TemplateBuilder createTemplateBuilder() {
   final Supplier<Set<? extends Image>> images =
       Suppliers.<Set<? extends Image>>ofInstance(
           ImmutableSet.of(
               new ImageBuilder()
                   .providerId("ebs-image-provider")
                   .name("image")
                   .id("us-east-1/bogus-image")
                   .location(jcloudsDomainLocation)
                   .userMetadata(ImmutableMap.of("rootDeviceType", RootDeviceType.EBS.value()))
                   .operatingSystem(
                       new OperatingSystem(
                           OsFamily.UBUNTU,
                           null,
                           "1.0",
                           VirtualizationType.PARAVIRTUAL.value(),
                           "ubuntu",
                           true))
                   .description("description")
                   .version("1.0")
                   .defaultCredentials(LoginCredentials.builder().user("root").build())
                   .status(Image.Status.AVAILABLE)
                   .build()));
   ImmutableMap<RegionAndName, Image> imageMap =
       (ImmutableMap<RegionAndName, Image>) ImagesToRegionAndIdMap.imagesToMap(images.get());
   Supplier<LoadingCache<RegionAndName, ? extends Image>> imageCache =
       Suppliers.<LoadingCache<RegionAndName, ? extends Image>>ofInstance(
           CacheBuilder.newBuilder()
               .<RegionAndName, Image>build(CacheLoader.from(Functions.forMap(imageMap))));
   JcloudsStubTemplateBuilder jcloudsStubTemplateBuilder = new JcloudsStubTemplateBuilder();
   return jcloudsStubTemplateBuilder.newTemplateBuilder(images, imageCache);
 }
  private PresentWhenExtensionAnnotationMatchesExtensionSet whenExtensionsAndAliasesInRegionInclude(
      String region, final Set<Extension> extensions, final Multimap<URI, URI> aliases) {
    final LoadingCache<String, Set<? extends Extension>> extensionsForRegion =
        CacheBuilder.newBuilder()
            .build(
                CacheLoader.from(
                    Functions.forMap(
                        ImmutableMap.<String, Set<? extends Extension>>of(
                            region, extensions, "differentregion", ImmutableSet.<Extension>of()))));

    PresentWhenExtensionAnnotationMatchesExtensionSet fn =
        Guice.createInjector(
                new AbstractModule() {
                  @Override
                  protected void configure() {
                    MapBinder<URI, URI> aliasBindings =
                        MapBinder.newMapBinder(
                                binder(), URI.class, URI.class, NamespaceAliases.class)
                            .permitDuplicates();
                    for (URI key : aliases.keySet()) {
                      for (URI value : aliases.get(key)) {
                        aliasBindings.addBinding(key).toInstance(value);
                      }
                    }
                  }

                  @Provides
                  LoadingCache<String, Set<? extends Extension>> getExtensions() {
                    return extensionsForRegion;
                  }
                })
            .getInstance(PresentWhenExtensionAnnotationMatchesExtensionSet.class);

    return fn;
  }
 @Override
 protected CacheLoader<String, Optional<String>> bucketToRegion(
     @Region Supplier<Set<String>> regionSupplier, final S3Client client) {
   return CacheLoader.<String, Optional<String>>from(
       Functions.forMap(
           ImmutableMap.<String, Optional<String>>builder()
               .put("bucket", Optional.<String>absent())
               .put("destinationbucket", Optional.<String>absent())
               .put("bucket-us-standard", Optional.of("us-standard"))
               .put("bucket-us-west-1", Optional.of("us-west-1"))
               .put("bucket-us-west-2", Optional.of("us-west-2"))
               .put("bucket-eu-west-1", Optional.of("eu-west-1"))
               .put("bucket-sa-east-1", Optional.of("sa-east-1"))
               .put("bucket-ap-southeast-1", Optional.of("ap-southeast-1"))
               .put("bucket-ap-northeast-1", Optional.of("ap-northeast-1"))
               .build()));
 }