You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2015/06/26 15:00:58 UTC

[16/17] jclouds-labs-google git commit: Remove the graduated GCE provided and updated Maven coordinates

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
deleted file mode 100644
index 2ef8100..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Lists.newArrayList;
-import static java.lang.String.format;
-import static org.jclouds.googlecloud.internal.ListPages.concat;
-import static org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEncodedIntoNameThenAddToSet.simplifyPorts;
-import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineProperties.IMAGE_PROJECTS;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.Atomics;
-import com.google.common.util.concurrent.UncheckedTimeoutException;
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LocationBuilder;
-import org.jclouds.domain.LocationScope;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.compute.functions.FirewallTagNamingConvention;
-import org.jclouds.googlecomputeengine.compute.functions.Resources;
-import org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTemplateOptions;
-import org.jclouds.googlecomputeengine.domain.AttachDisk;
-import org.jclouds.googlecomputeengine.domain.DiskType;
-import org.jclouds.googlecomputeengine.domain.Image;
-import org.jclouds.googlecomputeengine.domain.Instance;
-import org.jclouds.googlecomputeengine.domain.Instance.Scheduling;
-import org.jclouds.googlecomputeengine.domain.Instance.Scheduling.OnHostMaintenance;
-import org.jclouds.googlecomputeengine.domain.MachineType;
-import org.jclouds.googlecomputeengine.domain.NewInstance;
-import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.googlecomputeengine.domain.Region;
-import org.jclouds.googlecomputeengine.domain.Tags;
-import org.jclouds.googlecomputeengine.domain.Zone;
-import org.jclouds.googlecomputeengine.features.InstanceApi;
-import org.jclouds.location.suppliers.all.JustProvider;
-
-/**
- * This implementation maps the following:
- * <ul>
- *    <li>{@linkplain NodeMetadata#getId()} to {@link Instance#selfLink()}</li>
- *    <li>{@linkplain NodeMetadata#getGroup()} to {@link Instance#metadata()} as {@code jclouds-group}</li>
- *    <li>{@linkplain NodeMetadata#getImageId()} to {@link Instance#metadata()} as {@code jclouds-image}</li>
- *    <li>{@linkplain Hardware#getId()} to {@link MachineType#selfLink()}</li>
- *    <li>{@linkplain org.jclouds.compute.domain.Image#getId()} to {@link Image#selfLink()}</li>
- *    <li>{@linkplain Location#getId()} to {@link org.jclouds.googlecomputeengine.domain.Zone#name()}</li>
- *    <li>{@linkplain Location#getDescription()} to {@link Zone#selfLink()}</li>
- * </ul>
- */
-public final class GoogleComputeEngineServiceAdapter
-      implements ComputeServiceAdapter<Instance, MachineType, Image, Location> {
-
-   private final JustProvider justProvider;
-   private final GoogleComputeEngineApi api;
-   private final Resources resources;
-   private final Predicate<AtomicReference<Operation>> operationDone;
-   private final Predicate<AtomicReference<Instance>> instanceVisible;
-   private final FirewallTagNamingConvention.Factory firewallTagNamingConvention;
-   private final List<String> imageProjects;
-   private final LoadingCache<URI, Image> diskURIToImage;
-
-   @Inject GoogleComputeEngineServiceAdapter(JustProvider justProvider, GoogleComputeEngineApi api,
-                                            Predicate<AtomicReference<Operation>> operationDone,
-                                            Predicate<AtomicReference<Instance>> instanceVisible,
-                                            Resources resources,
-                                            FirewallTagNamingConvention.Factory firewallTagNamingConvention,
-                                            @Named(IMAGE_PROJECTS) String imageProjects,
-                                            LoadingCache<URI, Image> diskURIToImage) {
-      this.justProvider = justProvider;
-      this.api = api;
-      this.operationDone = operationDone;
-      this.instanceVisible = instanceVisible;
-      this.resources = resources;
-      this.firewallTagNamingConvention = firewallTagNamingConvention;
-      this.imageProjects = Splitter.on(',').omitEmptyStrings().splitToList(imageProjects);
-      this.diskURIToImage = diskURIToImage;
-   }
-
-   @Override public NodeAndInitialCredentials<Instance> createNodeWithGroupEncodedIntoName(String group, String name,
-         Template template) {
-      GoogleComputeEngineTemplateOptions options = GoogleComputeEngineTemplateOptions.class.cast(template.getOptions());
-
-      checkNotNull(options.getNetworks(), "template options must specify a network");
-      checkNotNull(template.getHardware().getUri(), "hardware must have a URI");
-      checkNotNull(template.getImage().getUri(), "image URI is null");
-
-      String zone = template.getLocation().getId();
-
-      List<AttachDisk> disks = Lists.newArrayList();
-      disks.add(AttachDisk.newBootDisk(template.getImage().getUri(), getDiskTypeArgument(options, zone)));
-
-      Iterator<String> networks = options.getNetworks().iterator();
-
-      URI network = URI.create(networks.next());
-      assert !networks.hasNext() : "Error: Options should specify only one network";
-
-      // Add tags from template
-      ArrayList<String> tags = new ArrayList<String>(options.getTags());
-
-      // Add tags for firewalls
-      FirewallTagNamingConvention naming = firewallTagNamingConvention.get(group);
-      List<String> ports = simplifyPorts(options.getInboundPorts());
-      if (ports != null){
-         tags.add(naming.name(ports));
-      }
-
-      NewInstance newInstance = new NewInstance.Builder( name,
-            template.getHardware().getUri(), // machineType
-            network,
-            disks)
-            .description(group)
-            .tags(Tags.create(null, ImmutableList.copyOf(tags)))
-            .serviceAccounts(options.serviceAccounts())
-            .build();
-
-      // Add metadata from template and for ssh key and image id
-      newInstance.metadata().putAll(options.getUserMetadata());
-
-      LoginCredentials credentials = resolveNodeCredentials(template);
-      if (options.getPublicKey() != null) {
-         newInstance.metadata().put("sshKeys",
-               format("%s:%s %s@localhost", credentials.getUser(), options.getPublicKey(), credentials.getUser()));
-      }
-
-      InstanceApi instanceApi = api.instancesInZone(zone);
-      Operation create = instanceApi.create(newInstance);
-
-      // We need to see the created instance so that we can access the newly created disk.
-      AtomicReference<Instance> instance = Atomics.newReference(Instance.create( //
-            "0000000000000000000", // id can't be null, but isn't available until provisioning is done.
-            null, // creationTimestamp
-            create.targetLink(), // selfLink
-            newInstance.name(), // name
-            newInstance.description(), // description
-            newInstance.tags(), // tags
-            newInstance.machineType(), // machineType
-            Instance.Status.PROVISIONING, // status
-            null, // statusMessage
-            create.zone(), // zone
-            null, // canIpForward
-            null, // networkInterfaces
-            null, // disks
-            newInstance.metadata(), // metadata
-            newInstance.serviceAccounts(), // serviceAccounts
-            Scheduling.create(OnHostMaintenance.MIGRATE, true) // scheduling
-      ));
-      checkState(instanceVisible.apply(instance), "instance %s is not api visible!", instance.get());
-
-      // Add lookup for InstanceToNodeMetadata
-      diskURIToImage.getUnchecked(instance.get().disks().get(0).source());
-
-      return new NodeAndInitialCredentials<Instance>(instance.get(), instance.get().selfLink().toString(), credentials);
-   }
-
-   @Override public Iterable<MachineType> listHardwareProfiles() {
-      return filter(concat(api.aggregatedList().machineTypes()), new Predicate<MachineType>() {
-         @Override
-         public boolean apply(MachineType input) {
-            return input.deprecated() == null;
-         }
-      });
-   }
-
-   @Override public Iterable<Image> listImages() {
-      List<Iterable<Image>> images = newArrayList();
-
-      images.add(concat(api.images().list()));
-
-      for (String project : imageProjects) {
-         images.add(concat(api.images().listInProject(project)));
-      }
-
-      return Iterables.concat(images);
-   }
-
-   @Override public Image getImage(String selfLink) {
-      return api.images().get(URI.create(checkNotNull(selfLink, "id")));
-   }
-
-   /**  Unlike EC2, you cannot default GCE instances to a region. Hence, we constrain to zones. */
-   @Override public Iterable<Location> listLocations() {
-      Location provider = justProvider.get().iterator().next();
-      ImmutableList.Builder<Location> zones = ImmutableList.builder();
-      for (Region region : concat(api.regions().list())) {
-         Location regionLocation = new LocationBuilder()
-               .scope(LocationScope.REGION)
-               .id(region.name())
-               .description(region.selfLink().toString())
-               .parent(provider).build();
-         for (URI zoneSelfLink : region.zones()) {
-            String zoneName = toName(zoneSelfLink);
-            zones.add(new LocationBuilder()
-                  .scope(LocationScope.ZONE)
-                  .id(zoneName)
-                  .description(zoneSelfLink.toString())
-                  .parent(regionLocation).build());
-         }
-      }
-      return zones.build();
-   }
-
-   @Override public Instance getNode(String selfLink) {
-      return resources.instance(URI.create(checkNotNull(selfLink, "id")));
-   }
-
-   @Override public Iterable<Instance> listNodes() {
-      return concat(api.aggregatedList().instances());
-   }
-
-   @Override public Iterable<Instance> listNodesByIds(final Iterable<String> selfLinks) {
-      return filter(listNodes(), new Predicate<Instance>() { // TODO: convert to server-side filter
-         @Override public boolean apply(Instance instance) {
-            return Iterables.contains(selfLinks, instance.selfLink().toString());
-         }
-      });
-   }
-
-   @Override public void destroyNode(String selfLink) {
-      waitOperationDone(resources.delete(URI.create(checkNotNull(selfLink, "id"))));
-   }
-
-   @Override public void rebootNode(String selfLink) {
-      waitOperationDone(resources.resetInstance(URI.create(checkNotNull(selfLink, "id"))));
-   }
-
-   @Override public void resumeNode(String selfLink) {
-      waitOperationDone(resources.startInstance(URI.create(checkNotNull(selfLink, "id"))));
-   }
-
-   @Override public void suspendNode(String selfLink) {
-      waitOperationDone(resources.stopInstance(URI.create(checkNotNull(selfLink, "id"))));
-   }
-
-   private void waitOperationDone(Operation operation) {
-      AtomicReference<Operation> operationRef = Atomics.newReference(operation);
-
-      // wait for the operation to complete
-      if (!operationDone.apply(operationRef)) {
-         throw new UncheckedTimeoutException("operation did not reach DONE state" + operationRef.get());
-      }
-
-      // check if the operation failed
-      if (operationRef.get().httpErrorStatusCode() != null) {
-         throw new IllegalStateException(
-               "operation failed. Http Error Code: " + operationRef.get().httpErrorStatusCode() +
-                     " HttpError: " + operationRef.get().httpErrorMessage());
-      }
-   }
-
-   private LoginCredentials resolveNodeCredentials(Template template) {
-      TemplateOptions options = template.getOptions();
-      LoginCredentials.Builder credentials = LoginCredentials.builder(template.getImage().getDefaultCredentials());
-      if (!Strings.isNullOrEmpty(options.getLoginUser())) {
-         credentials.user(options.getLoginUser());
-      }
-      if (!Strings.isNullOrEmpty(options.getLoginPrivateKey())) {
-         credentials.privateKey(options.getLoginPrivateKey());
-      }
-      if (!Strings.isNullOrEmpty(options.getLoginPassword())) {
-         credentials.password(options.getLoginPassword());
-      }
-      if (options.shouldAuthenticateSudo() != null) {
-         credentials.authenticateSudo(options.shouldAuthenticateSudo());
-      }
-      return credentials.build();
-   }
-
-   private static String toName(URI link) {
-      String path = link.getPath();
-      return path.substring(path.lastIndexOf('/') + 1);
-   }
-
-   private URI getDiskTypeArgument(GoogleComputeEngineTemplateOptions options, String zone) {
-      if (options.bootDiskType() != null) {
-         DiskType diskType = api.diskTypesInZone(zone).get(options.bootDiskType());
-         if (diskType != null) {
-            return diskType.selfLink();
-         }
-      }
-
-      return null;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
deleted file mode 100644
index 4951b05..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.config;
-
-import static com.google.common.base.Suppliers.memoizeWithExpiration;
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
-import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineProperties.OPERATION_COMPLETE_INTERVAL;
-import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineProperties.OPERATION_COMPLETE_TIMEOUT;
-import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
-import static org.jclouds.util.Predicates2.retry;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-import java.net.URI;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Injector;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-import com.google.inject.TypeLiteral;
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.ComputeServiceAdapter;
-import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.extensions.ImageExtension;
-import org.jclouds.compute.extensions.SecurityGroupExtension;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.domain.Location;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.googlecomputeengine.compute.GoogleComputeEngineService;
-import org.jclouds.googlecomputeengine.compute.GoogleComputeEngineServiceAdapter;
-import org.jclouds.googlecomputeengine.compute.functions.FirewallTagNamingConvention;
-import org.jclouds.googlecomputeengine.compute.functions.GoogleComputeEngineImageToImage;
-import org.jclouds.googlecomputeengine.compute.functions.ImageNameToOperatingSystem;
-import org.jclouds.googlecomputeengine.compute.functions.InstanceToNodeMetadata;
-import org.jclouds.googlecomputeengine.compute.functions.MachineTypeToHardware;
-import org.jclouds.googlecomputeengine.compute.functions.OrphanedGroupsFromDeadNodes;
-import org.jclouds.googlecomputeengine.compute.functions.Resources;
-import org.jclouds.googlecomputeengine.compute.loaders.DiskURIToImage;
-import org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTemplateOptions;
-import org.jclouds.googlecomputeengine.compute.predicates.AtomicInstanceVisible;
-import org.jclouds.googlecomputeengine.compute.predicates.AtomicOperationDone;
-import org.jclouds.googlecomputeengine.compute.predicates.GroupIsEmpty;
-import org.jclouds.googlecomputeengine.compute.strategy.CreateNodesWithGroupEncodedIntoNameThenAddToSet;
-import org.jclouds.googlecomputeengine.domain.Image;
-import org.jclouds.googlecomputeengine.domain.Instance;
-import org.jclouds.googlecomputeengine.domain.MachineType;
-import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.location.suppliers.ImplicitLocationSupplier;
-import org.jclouds.location.suppliers.implicit.FirstZone;
-
-public final class GoogleComputeEngineServiceContextModule
-      extends ComputeServiceAdapterContextModule<Instance, MachineType, Image, Location> {
-
-   @Override
-   protected void configure() {
-      super.configure();
-
-      bind(ComputeService.class).to(GoogleComputeEngineService.class);
-
-      bind(new TypeLiteral<ComputeServiceAdapter<Instance, MachineType, Image, Location>>() {
-      }).to(GoogleComputeEngineServiceAdapter.class);
-
-      // Use compute service to supply locations, which are always zones.
-      install(new LocationsFromComputeServiceAdapterModule<Instance, MachineType, Image, Location>() {
-      });
-      bind(new TypeLiteral<Function<Location, Location>>() {
-      }).toInstance(Functions.<Location>identity());
-      bind(ImplicitLocationSupplier.class).to(FirstZone.class);
-
-      bind(new TypeLiteral<Function<Instance, NodeMetadata>>() {
-      }).to(InstanceToNodeMetadata.class);
-
-      bind(new TypeLiteral<Function<MachineType, Hardware>>() {
-      }).to(MachineTypeToHardware.class);
-
-      bind(new TypeLiteral<Function<Image, org.jclouds.compute.domain.Image>>() {
-      }).to(GoogleComputeEngineImageToImage.class);
-
-      bind(org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet.class)
-            .to(CreateNodesWithGroupEncodedIntoNameThenAddToSet.class);
-
-      bind(TemplateOptions.class).to(GoogleComputeEngineTemplateOptions.class);
-
-      bind(new TypeLiteral<Function<Set<? extends NodeMetadata>, Set<String>>>() {
-      }).to(OrphanedGroupsFromDeadNodes.class);
-
-      bind(new TypeLiteral<Predicate<String>>() {
-      }).to(GroupIsEmpty.class);
-      
-      bind(new TypeLiteral<Function<String, OperatingSystem>>() {
-      }).to(ImageNameToOperatingSystem.class);
-
-      bind(FirewallTagNamingConvention.Factory.class).in(Scopes.SINGLETON);
-
-      bind(new TypeLiteral<CacheLoader<URI, Image>>() {
-      }).to(DiskURIToImage.class);
-
-      bindHttpApi(binder(), Resources.class);
-   }
-
-   // TODO: these timeouts need thinking through.
-   @Provides Predicate<AtomicReference<Operation>> operationDone(AtomicOperationDone input,
-         @Named(OPERATION_COMPLETE_TIMEOUT) long timeout, @Named(OPERATION_COMPLETE_INTERVAL) long interval) {
-      return retry(input, timeout, interval, MILLISECONDS);
-   }
-
-   @Provides Predicate<AtomicReference<Instance>> instanceVisible(AtomicInstanceVisible input,
-         @Named(OPERATION_COMPLETE_TIMEOUT) long timeout, @Named(OPERATION_COMPLETE_INTERVAL) long interval) {
-      return retry(input, timeout, interval, MILLISECONDS);
-   }
-
-   @Provides @Singleton @Memoized Supplier<Map<URI, Hardware>> hardwareByUri(
-         @Memoized final Supplier<Set<? extends Hardware>> hardwareSupplier,
-         @Named(PROPERTY_SESSION_INTERVAL) long seconds) {
-      return memoizeWithExpiration(new Supplier<Map<URI, Hardware>>() {
-         @Override public Map<URI, Hardware> get() {
-            ImmutableMap.Builder<URI, Hardware> result = ImmutableMap.builder();
-            for (Hardware hardware : hardwareSupplier.get()) {
-               result.put(hardware.getUri(), hardware);
-            }
-            return result.build();
-         }
-      }, seconds, SECONDS);
-   }
-
-   @Provides @Singleton @Memoized Supplier<Map<URI, Location>> locationsByUri(
-         @Memoized final Supplier<Set<? extends Location>> locations, @Named(PROPERTY_SESSION_INTERVAL) long seconds) {
-      return memoizeWithExpiration(new Supplier<Map<URI, Location>>() {
-         @Override
-         public Map<URI, Location> get() {
-            ImmutableMap.Builder<URI, Location> result = ImmutableMap.builder();
-            for (Location location : locations.get()) {
-               result.put(URI.create(location.getDescription()), location);
-            }
-            return result.build();
-         }
-      }, seconds, SECONDS);
-   }
-   
-   @Override
-   protected Map<OsFamily, LoginCredentials> osFamilyToCredentials(Injector injector) {
-      // GCE does not enable the 'root' account for ssh access by default, but it will create a privileged
-      // user when the SSH key is provided. Populate the map to use 'jclouds' as a default user.
-      ImmutableMap.Builder<OsFamily, LoginCredentials> builder = ImmutableMap.builder();
-      for (OsFamily family : OsFamily.values()) {
-         switch (family) {
-            case COREOS:
-               builder.put(family, LoginCredentials.builder().user("core").build());
-               break;
-            case WINDOWS:
-               builder.put(family, LoginCredentials.builder().user("Administrator").build());
-               break;
-            default:
-               builder.put(family, LoginCredentials.builder().user("jclouds").build());
-               break;
-         }
-      }
-      return builder.build();
-   }
-
-   @Provides
-   @Singleton
-   protected LoadingCache<URI, Image> diskURIToImageMap(
-         CacheLoader<URI, Image> in) {
-      return CacheBuilder.newBuilder().build(in);
-   }
-
-
-   @Override protected Optional<ImageExtension> provideImageExtension(Injector i) {
-      return Optional.absent();
-   }
-
-   @Override protected Optional<SecurityGroupExtension> provideSecurityGroupExtension(Injector i) {
-      return Optional.absent();
-   }
-
-   private static final Map<Instance.Status, NodeMetadata.Status> toPortableNodeStatus =
-         ImmutableMap.<Instance.Status, NodeMetadata.Status>builder()
-                     .put(Instance.Status.PROVISIONING, NodeMetadata.Status.PENDING)
-                     .put(Instance.Status.STAGING, NodeMetadata.Status.PENDING)
-                     .put(Instance.Status.RUNNING, NodeMetadata.Status.RUNNING)
-                     .put(Instance.Status.STOPPING, NodeMetadata.Status.PENDING)
-                     .put(Instance.Status.STOPPED, NodeMetadata.Status.SUSPENDED)
-                     .put(Instance.Status.TERMINATED, NodeMetadata.Status.SUSPENDED).build();
-
-   @Provides Map<Instance.Status, NodeMetadata.Status> toPortableNodeStatus() {
-      return toPortableNodeStatus;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java
deleted file mode 100644
index 61e4fd0..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/FirewallTagNamingConvention.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.functions.GroupNamingConvention;
-
-/**
- * The convention for naming instance tags that firewall rules recognise.
- */
-public final class FirewallTagNamingConvention {
-
-   public static final class Factory {
-
-      private final GroupNamingConvention.Factory namingConvention;
-
-      @Inject Factory(GroupNamingConvention.Factory namingConvention) {
-         this.namingConvention = namingConvention;
-      }
-
-      public FirewallTagNamingConvention get(String groupName) {
-         return new FirewallTagNamingConvention(namingConvention.create().sharedNameForGroup(groupName));
-      }
-   }
-
-   private final String sharedResourceName;
-
-   public FirewallTagNamingConvention(String sharedResourceName) {
-      this.sharedResourceName = sharedResourceName;
-   }
-
-   public String name(List<String> ports) {
-      final int prime = 31;
-      int result = 1;
-      for (String s : ports){
-         result = result * prime + s.hashCode();
-         // TODO(broudy): this may break between java versions! Consider a different implementation.
-      }
-
-      return String.format("%s-%s", sharedResourceName, Integer.toHexString(result));
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImage.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImage.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImage.java
deleted file mode 100644
index 37079ba..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/GoogleComputeEngineImageToImage.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.domain.Image.Status;
-import org.jclouds.compute.domain.ImageBuilder;
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.googlecomputeengine.domain.Deprecated.State;
-import org.jclouds.googlecomputeengine.domain.Image;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableMap;
-
-public final class GoogleComputeEngineImageToImage implements Function<Image, org.jclouds.compute.domain.Image> {
-   private final Function<String, OperatingSystem> nameToOperatingSystem;
-   
-   @Inject GoogleComputeEngineImageToImage(Function<String, OperatingSystem> nameToOperatingSystem) {
-      this.nameToOperatingSystem = nameToOperatingSystem;
-   }
-
-   @Override public org.jclouds.compute.domain.Image apply(Image image) {
-      ImageBuilder builder = new ImageBuilder()
-              .id(image.selfLink().toString())
-              .providerId(image.id())
-              .name(image.name())
-              .providerId(image.id())
-              .description(image.description())
-              .status(Status.AVAILABLE)
-              .uri(image.selfLink());
-
-      if (image.deprecated() != null) {
-         builder.userMetadata(ImmutableMap.of("deprecatedState", image.deprecated().state().name()));
-         if (image.deprecated().state() == State.DELETED){
-            builder.status(Status.DELETED);
-         }
-      }
-
-      builder.version(image.name().substring(image.name().lastIndexOf('-') + 1));
-      builder.operatingSystem(nameToOperatingSystem.apply(image.name()));
-      
-      return builder.build();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/ImageNameToOperatingSystem.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/ImageNameToOperatingSystem.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/ImageNameToOperatingSystem.java
deleted file mode 100644
index 7ecd89f..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/ImageNameToOperatingSystem.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import static com.google.common.base.Joiner.on;
-import static com.google.common.collect.Iterables.limit;
-import static com.google.common.collect.Iterables.skip;
-
-import java.util.List;
-
-import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OsFamily;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-
-public class ImageNameToOperatingSystem implements Function<String, OperatingSystem> {
-
-   @Override public OperatingSystem apply(String input) {
-      // Remove the backport prefix before parsing the name
-      String name = input.contains("backports") ? input.substring(input.indexOf("backports-") + 10) : input;
-      
-      OperatingSystem.Builder builder = defaultOperatingSystem(name);
-      List<String> splits = Lists.newArrayList(name.split("-"));
-      if (splits == null || splits.size() == 0 || splits.size() < 3) {
-         return builder.build();
-      }
-
-      // GCE namings that don't match the OsFamily enum
-      String os = splits.get(0);
-      if ("opensuse".equals(os) || "sles".equals(os)) {
-         builder.family(OsFamily.SUSE);
-      } else {
-         OsFamily family = OsFamily.fromValue(os);
-         if (family != OsFamily.UNRECOGNIZED) {
-            builder.family(family);
-         }
-      }
-
-      // TODO: Improve the version parsing so it is more portable
-      String version = on(".").join(limit(skip(splits, 1), splits.size() - 2));
-      builder.version(version);
-
-      return builder.build();
-   }
-   
-   private OperatingSystem.Builder defaultOperatingSystem(String name) {
-      return OperatingSystem.builder().family(OsFamily.LINUX).is64Bit(true).description(name);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
deleted file mode 100644
index 6f72bee..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/InstanceToNodeMetadata.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import static org.jclouds.compute.util.ComputeServiceUtils.groupFromMapOrName;
-
-import javax.inject.Inject;
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableList;
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadata.Status;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.domain.Location;
-import org.jclouds.googlecomputeengine.domain.Image;
-import org.jclouds.googlecomputeengine.domain.Instance;
-
-public final class InstanceToNodeMetadata implements Function<Instance, NodeMetadata> {
-
-   private final Map<Instance.Status, NodeMetadata.Status> toPortableNodeStatus;
-   private final GroupNamingConvention nodeNamingConvention;
-   private final LoadingCache<URI, Image> diskURIToImage;
-   private final Supplier<Map<URI, Hardware>> hardwares;
-   private final Supplier<Map<URI, Location>> locationsByUri;
-
-   @Inject InstanceToNodeMetadata(Map<Instance.Status, NodeMetadata.Status> toPortableNodeStatus,
-                                  GroupNamingConvention.Factory namingConvention,
-                                  LoadingCache<URI, Image> diskURIToImage,
-                                  @Memoized Supplier<Map<URI, Hardware>> hardwares,
-                                  @Memoized Supplier<Map<URI, Location>> locationsByUri) {
-      this.toPortableNodeStatus = toPortableNodeStatus;
-      this.nodeNamingConvention = namingConvention.createWithoutPrefix();
-      this.diskURIToImage = diskURIToImage;
-      this.hardwares = hardwares;
-      this.locationsByUri = locationsByUri;
-   }
-
-   @Override public NodeMetadata apply(Instance input) {
-      String group = groupFromMapOrName(input.metadata().asMap(), input.name(), nodeNamingConvention);
-      NodeMetadataBuilder builder = new NodeMetadataBuilder();
-
-      Location zone = locationsByUri.get().get(input.zone());
-      if (zone == null) {
-         throw new IllegalStateException(
-               String.format("zone %s not present in %s", input.zone(), locationsByUri.get().keySet()));
-      }
-
-      // The boot disk is the first disk. It may have been created from an image, so look it up.
-      //
-      // Note: This will be present if we created the node. In the future we could choose to make diskToSourceImage
-      // a loading cache. That would be more expensive, but could ensure this isn't null.
-      Image image = diskURIToImage.getUnchecked(input.disks().get(0).source());
-
-      builder.id(input.selfLink().toString())
-             .name(input.name())
-             .providerId(input.id())
-             .hostname(input.name())
-             .location(zone)
-             .imageId(image != null ? image.selfLink().toString() : null)
-             .hardware(hardwares.get().get(input.machineType()))
-             .status(input.status() != null ? toPortableNodeStatus.get(input.status()) : Status.UNRECOGNIZED)
-             .tags(input.tags().items())
-             .uri(input.selfLink())
-             .userMetadata(input.metadata().asMap())
-             .group(group)
-             .privateAddresses(collectPrivateAddresses(input))
-             .publicAddresses(collectPublicAddresses(input));
-      return builder.build();
-   }
-
-   private List<String> collectPrivateAddresses(Instance input) {
-      ImmutableList.Builder<String> privateAddressesBuilder = ImmutableList.builder();
-      for (Instance.NetworkInterface networkInterface : input.networkInterfaces()) {
-         if (networkInterface.networkIP() != null) {
-            privateAddressesBuilder.add(networkInterface.networkIP());
-         }
-      }
-      return privateAddressesBuilder.build();
-   }
-
-   private List<String> collectPublicAddresses(Instance input) {
-      ImmutableList.Builder<String> publicAddressesBuilder = ImmutableList.builder();
-      for (Instance.NetworkInterface networkInterface : input.networkInterfaces()) {
-         for (Instance.NetworkInterface.AccessConfig accessConfig : networkInterface.accessConfigs()) {
-            if (accessConfig.natIP() != null) {
-               publicAddressesBuilder.add(accessConfig.natIP());
-            }
-         }
-      }
-      return publicAddressesBuilder.build();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/MachineTypeToHardware.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/MachineTypeToHardware.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/MachineTypeToHardware.java
deleted file mode 100644
index a1eaf36..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/MachineTypeToHardware.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.collect.Memoized;
-import org.jclouds.compute.domain.Hardware;
-import org.jclouds.compute.domain.HardwareBuilder;
-import org.jclouds.compute.domain.Image;
-import org.jclouds.compute.domain.Processor;
-import org.jclouds.compute.domain.Volume;
-import org.jclouds.compute.domain.VolumeBuilder;
-import org.jclouds.domain.Location;
-import org.jclouds.googlecomputeengine.domain.MachineType;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicates;
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableSet;
-
-public final class MachineTypeToHardware implements Function<MachineType, Hardware> {
-
-   private final Supplier<Map<URI, Location>> locationsByUri;
-
-   @Inject MachineTypeToHardware(@Memoized Supplier<Map<URI, Location>> locationsByUri) {
-      this.locationsByUri = locationsByUri;
-   }
-
-   @Override
-   public Hardware apply(MachineType input) {
-      URI zoneLink = URI.create(
-            input.selfLink().toString().replace("/machineTypes/" + input.name(), ""));
-
-      Location zone = locationsByUri.get().get(zoneLink);
-      if (zone == null) {
-         throw new IllegalStateException(
-               String.format("zone %s not present in %s", zoneLink, locationsByUri.get().keySet()));
-      }
-      return new HardwareBuilder()
-              .id(input.selfLink().toString())
-              .providerId(input.id())
-              .location(zone)
-              .name(input.name())
-              .hypervisor("kvm")
-              .processor(new Processor(input.guestCpus(), 1.0))
-              .providerId(input.id())
-              .ram(input.memoryMb())
-              .uri(input.selfLink())
-              .volumes(collectVolumes(input))
-              .supportsImage(Predicates.<Image>alwaysTrue())
-              .build();
-   }
-
-   private Iterable<Volume> collectVolumes(MachineType input) {
-      ImmutableSet.Builder<Volume> volumes = ImmutableSet.builder();
-      for (MachineType.ScratchDisk disk : input.scratchDisks()) {
-         volumes.add(new VolumeBuilder()
-                 .type(Volume.Type.LOCAL)
-                 .size(Float.valueOf(disk.diskGb()))
-                 .bootDevice(true)
-                 .durable(false).build());
-      }
-      return volumes.build();
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/OrphanedGroupsFromDeadNodes.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/OrphanedGroupsFromDeadNodes.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/OrphanedGroupsFromDeadNodes.java
deleted file mode 100644
index 09c4a17..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/OrphanedGroupsFromDeadNodes.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import java.util.Set;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.domain.NodeMetadata;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Sets;
-
-public final class OrphanedGroupsFromDeadNodes implements Function<Set<? extends NodeMetadata>, Set<String>> {
-
-   private final Predicate<String> isOrphanedGroupPredicate;
-
-   @Inject OrphanedGroupsFromDeadNodes(Predicate<String> isOrphanedGroupPredicate) {
-      this.isOrphanedGroupPredicate = isOrphanedGroupPredicate;
-   }
-
-
-   @Override public Set<String> apply(Set<? extends NodeMetadata> deadNodes) {
-      Set<String> groups = Sets.newLinkedHashSet();
-      for (NodeMetadata deadNode : deadNodes) {
-         groups.add(deadNode.getGroup());
-      }
-      Set<String> orphanedGroups = Sets.newLinkedHashSet();
-      for (String group : groups) {
-         if (isOrphanedGroupPredicate.apply(group)) {
-            orphanedGroups.add(group);
-         }
-      }
-      return orphanedGroups;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java
deleted file mode 100644
index 97c4a3e..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.functions;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import java.net.URI;
-
-import org.jclouds.googlecomputeengine.domain.Disk;
-import org.jclouds.googlecomputeengine.domain.Image;
-import org.jclouds.googlecomputeengine.domain.Instance;
-import org.jclouds.googlecomputeengine.domain.Network;
-import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.oauth.v2.filters.OAuthFilter;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SkipEncoding;
-
-@SkipEncoding({'/', '='})
-@RequestFilters(OAuthFilter.class)
-@Consumes(APPLICATION_JSON)
-public interface Resources {
-
-   /** Returns an instance by self-link or null if not found. */
-   @Named("Instances:get")
-   @GET
-   @Fallback(NullOnNotFoundOr404.class) @Nullable Instance instance(@EndpointParam URI selfLink);
-
-   /** Returns an network by self-link or null if not found. */
-   @Named("Networks:get")
-   @GET
-   @Fallback(NullOnNotFoundOr404.class) @Nullable Network network(@EndpointParam URI selfLink);
-
-   /** Returns an operation by self-link or null if not found. */
-   @Named("Operations:get")
-   @GET
-   @Fallback(NullOnNotFoundOr404.class) @Nullable Operation operation(@EndpointParam URI selfLink);
-
-   /** Deletes any resource by self-link and returns the operation in progress, or null if not found. */
-   @Named("Resources:delete")
-   @DELETE
-   @Fallback(NullOnNotFoundOr404.class) @Nullable Operation delete(@EndpointParam URI selfLink);
-
-   /** Hard-resets the instance by self-link and returns the operation in progress */
-   @Named("Instances:reset")
-   @POST
-   @Path("/reset")
-   Operation resetInstance(@EndpointParam URI selfLink);
-   
-   /** Starts the instance by self-link and returns the operation in progress */
-   @Named("Instances:start")
-   @POST
-   @Path("/start")
-   Operation startInstance(@EndpointParam URI selfLink);
-   
-   /** Stops the instance by self-link and returns the operation in progress */
-   @Named("Instances:stop")
-   @POST
-   @Path("/stop")
-   Operation stopInstance(@EndpointParam URI selfLink);
-
-   /** Returns a disk by self-link or null if not found. */
-   @Named("Disks:get")
-   @GET
-   @Fallback(NullOnNotFoundOr404.class) @Nullable Disk disk(@EndpointParam URI selfLink);
-
-   /** Returns an image by self-link or null if not found. */
-   @Named("Images:get")
-   @GET
-   @Fallback(NullOnNotFoundOr404.class) @Nullable Image image(@EndpointParam URI selfLink);
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/DiskURIToImage.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/DiskURIToImage.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/DiskURIToImage.java
deleted file mode 100644
index 0dccaf4..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/DiskURIToImage.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.loaders;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import java.net.URI;
-import java.util.concurrent.ExecutionException;
-
-import com.google.common.cache.CacheLoader;
-import org.jclouds.googlecomputeengine.compute.functions.Resources;
-import org.jclouds.googlecomputeengine.domain.Disk;
-import org.jclouds.googlecomputeengine.domain.Image;
-import org.jclouds.logging.Logger;
-
-
-@Singleton
-public class DiskURIToImage extends CacheLoader<URI, Image> {
-   @Resource
-   protected Logger logger = Logger.NULL;
-
-   private final Resources resources;
-
-   @Inject
-   DiskURIToImage(Resources resources) {
-      this.resources = resources;
-   }
-
-   @Override
-   public Image load(URI key) throws ExecutionException {
-      try {
-         Disk disk = resources.disk(key);
-         return resources.image(disk.sourceImage());
-      } catch (Exception e) {
-         throw new ExecutionException(message(key, e), e);
-      }
-   }
-
-   public static String message(URI key, Exception e) {
-      return String.format("could not find image for disk %s: %s", key.toString(), e.getMessage());
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
deleted file mode 100644
index a2cbd1f..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/options/GoogleComputeEngineTemplateOptions.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.options;
-
-import java.util.List;
-import java.util.Map;
-
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.domain.LoginCredentials;
-import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
-import org.jclouds.scriptbuilder.domain.Statement;
-
-/** Instance options specific to Google Compute Engine. */
-public final class GoogleComputeEngineTemplateOptions extends TemplateOptions {
-
-   private boolean autoCreateKeyPair = true;
-   private List<ServiceAccount> serviceAccounts;
-   private String bootDiskType;
-
-   @Override
-   public GoogleComputeEngineTemplateOptions clone() {
-      GoogleComputeEngineTemplateOptions options = new GoogleComputeEngineTemplateOptions();
-      copyTo(options);
-      return options;
-   }
-
-   @Override
-   public void copyTo(TemplateOptions to) {
-      super.copyTo(to);
-      if (to instanceof GoogleComputeEngineTemplateOptions) {
-         GoogleComputeEngineTemplateOptions eTo = GoogleComputeEngineTemplateOptions.class.cast(to);
-         eTo.autoCreateKeyPair(autoCreateKeyPair());
-         eTo.serviceAccounts(serviceAccounts());
-         eTo.bootDiskType(bootDiskType());
-      }
-   }
-
-   /**
-    * Sets the boot disk type.
-    */
-   public GoogleComputeEngineTemplateOptions bootDiskType(String diskType) {
-      this.bootDiskType = diskType;
-      return this;
-   }
-
-   /**
-    * Gets the boot disk type.
-    */
-   public String bootDiskType() {
-      return bootDiskType;
-   }
-
-   /**
-    * Sets whether an SSH key pair should be created automatically.
-    */
-   public GoogleComputeEngineTemplateOptions autoCreateKeyPair(boolean autoCreateKeyPair) {
-      this.autoCreateKeyPair = autoCreateKeyPair;
-      return this;
-   }
-
-   /**
-    * Gets whether an SSH key pair should be created automatically.
-    */
-   public boolean autoCreateKeyPair() {
-      return autoCreateKeyPair;
-   }
-
-   /**
-    * Sets a list of service accounts, with their specified scopes, to authorize on created instance.
-    * For example, to give a node the 'compute' scope you would add a service account with the email 'default'
-    * and the scope 'https://www.googleapis.com/auth/compute'
-    * These scopes will be given to all nodes created with these template options.
-    */
-   public GoogleComputeEngineTemplateOptions serviceAccounts(List<ServiceAccount> serviceAccounts){
-      this.serviceAccounts = serviceAccounts;
-      return this;
-   }
-
-   /**
-    * Gets the list of service accounts, with their specified scopes, that will be authorize on created instances.
-    */
-   public List<ServiceAccount> serviceAccounts(){
-      return serviceAccounts;
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions blockOnPort(int port, int seconds) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.blockOnPort(port, seconds));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions inboundPorts(int... ports) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.inboundPorts(ports));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions authorizePublicKey(String publicKey) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions installPrivateKey(String privateKey) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.installPrivateKey(privateKey));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions blockUntilRunning(boolean blockUntilRunning) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.blockUntilRunning(blockUntilRunning));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions dontAuthorizePublicKey() {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.dontAuthorizePublicKey());
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions nameTask(String name) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.nameTask(name));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions runAsRoot(boolean runAsRoot) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.runAsRoot(runAsRoot));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions runScript(Statement script) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.runScript(script));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.overrideLoginCredentials(overridingCredentials));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions overrideLoginPassword(String password) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.overrideLoginPassword(password));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions overrideLoginPrivateKey(String privateKey) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.overrideLoginPrivateKey(privateKey));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions overrideLoginUser(String loginUser) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.overrideLoginUser(loginUser));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.overrideAuthenticateSudo(authenticateSudo));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions userMetadata(Map<String, String> userMetadata) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.userMetadata(userMetadata));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions userMetadata(String key, String value) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.userMetadata(key, value));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions nodeNames(Iterable<String> nodeNames) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.nodeNames(nodeNames));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions networks(Iterable<String> networks) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.networks(networks));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions networks(String... networks) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.networks(networks));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions tags(Iterable<String> tags) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.tags(tags));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions wrapInInitScript(boolean wrapInInitScript) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.wrapInInitScript(wrapInInitScript));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions runScript(String script) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.runScript(script));
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public GoogleComputeEngineTemplateOptions blockOnComplete(boolean blockOnComplete) {
-      return GoogleComputeEngineTemplateOptions.class.cast(super.blockOnComplete(blockOnComplete));
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicInstanceVisible.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicInstanceVisible.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicInstanceVisible.java
deleted file mode 100644
index ab7a512..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicInstanceVisible.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.predicates;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.inject.Inject;
-
-import org.jclouds.googlecomputeengine.compute.functions.Resources;
-import org.jclouds.googlecomputeengine.domain.Instance;
-
-import com.google.common.base.Predicate;
-
-public final class AtomicInstanceVisible implements Predicate<AtomicReference<Instance>> {
-
-   private final Resources resources;
-
-   @Inject AtomicInstanceVisible(Resources resources) {
-      this.resources = resources;
-   }
-
-   @Override public boolean apply(AtomicReference<Instance> input) {
-      Instance response = resources.instance(input.get().selfLink());
-      if (response == null) {
-         return false;
-      }
-      input.set(response);
-      return true;
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicOperationDone.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicOperationDone.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicOperationDone.java
deleted file mode 100644
index 2bf1c80..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/AtomicOperationDone.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.predicates;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.inject.Inject;
-
-import org.jclouds.googlecomputeengine.compute.functions.Resources;
-import org.jclouds.googlecomputeengine.domain.Operation;
-
-import com.google.common.base.Predicate;
-
-public final class AtomicOperationDone implements Predicate<AtomicReference<Operation>> {
-
-   private final Resources resources;
-
-   @Inject AtomicOperationDone(Resources resources) {
-      this.resources = resources;
-   }
-
-   @Override public boolean apply(AtomicReference<Operation> input) {
-      checkNotNull(input.get(), "operation");
-      Operation current = resources.operation(input.get().selfLink());
-      input.set(current);
-      checkState(current.error().errors().isEmpty(), "Task ended in error %s", current); // ISE will break the loop.
-      switch (current.status()) {
-         case DONE:
-            return true;
-         case PENDING:
-         case RUNNING:
-         default:
-            return false;
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java
deleted file mode 100644
index 3b5c093..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/predicates/GroupIsEmpty.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.predicates;
-
-import static com.google.common.collect.Iterables.isEmpty;
-import static com.google.common.collect.Sets.filter;
-import static org.jclouds.compute.predicates.NodePredicates.all;
-import static org.jclouds.compute.predicates.NodePredicates.inGroup;
-
-import javax.inject.Inject;
-
-import org.jclouds.compute.ComputeService;
-
-import com.google.common.base.Predicate;
-
-public final class GroupIsEmpty implements Predicate<String> {
-
-   private final ComputeService computeService;
-
-   @Inject GroupIsEmpty(ComputeService computeService) {
-      this.computeService = computeService;
-   }
-
-
-   @Override public boolean apply(String groupName) {
-      return isEmpty(filter(computeService.listNodesDetailsMatching(all()), inGroup(groupName)));
-   }
-}

http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/cf9af834/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
deleted file mode 100644
index 20bc2c3..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.googlecomputeengine.compute.strategy;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.collect.ImmutableList.of;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jclouds.Constants;
-import org.jclouds.compute.config.CustomizationResponse;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.functions.GroupNamingConvention;
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
-import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap;
-import org.jclouds.compute.strategy.ListNodesStrategy;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.compute.functions.FirewallTagNamingConvention;
-import org.jclouds.googlecomputeengine.compute.options.GoogleComputeEngineTemplateOptions;
-import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.googlecomputeengine.domain.Firewall.Rule;
-import org.jclouds.googlecomputeengine.domain.Network;
-import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.googlecomputeengine.features.FirewallApi;
-import org.jclouds.googlecomputeengine.options.FirewallOptions;
-import org.jclouds.logging.Logger;
-import org.jclouds.ssh.SshKeyPairGenerator;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.Atomics;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-
-public final class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
-      org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet {
-
-   public static final String EXTERIOR_RANGE = "0.0.0.0/0";
-   public static final String DEFAULT_INTERNAL_NETWORK_RANGE = "10.0.0.0/8";
-
-   public static final String DEFAULT_NETWORK_NAME = "default";
-
-   private final GoogleComputeEngineApi api;
-   private final Predicate<AtomicReference<Operation>> operationDone;
-   private final FirewallTagNamingConvention.Factory firewallTagNamingConvention;
-   private final SshKeyPairGenerator keyGenerator;
-
-   @Resource
-   @Named(ComputeServiceConstants.COMPUTE_LOGGER)
-   protected Logger logger = Logger.NULL;
-
-   @Inject
-   CreateNodesWithGroupEncodedIntoNameThenAddToSet(
-         CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy,
-         ListNodesStrategy listNodesStrategy,
-         GroupNamingConvention.Factory namingConvention,
-         @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
-         CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
-         GoogleComputeEngineApi api, Predicate<AtomicReference<Operation>> operationDone,
-         FirewallTagNamingConvention.Factory firewallTagNamingConvention, SshKeyPairGenerator keyGenerator) {
-      super(addNodeWithGroupStrategy, listNodesStrategy, namingConvention, userExecutor,
-            customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory);
-      this.api = api;
-      this.operationDone = operationDone;
-      this.firewallTagNamingConvention = firewallTagNamingConvention;
-      this.keyGenerator = keyGenerator;
-   }
-
-   @Override
-   public Map<?, ListenableFuture<Void>> execute(String group, int count, Template template,
-         Set<NodeMetadata> goodNodes, Map<NodeMetadata, Exception> badNodes,
-         Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {
-
-            Template mutableTemplate = template.clone();
-      GoogleComputeEngineTemplateOptions templateOptions = GoogleComputeEngineTemplateOptions.class
-            .cast(mutableTemplate.getOptions());
-      assert template.getOptions().equals(templateOptions) : "options didn't clone properly";
-
-      // Get Network
-      Network network = getNetwork(templateOptions.getNetworks());
-      // Setup Firewall rules
-      getOrCreateFirewalls(templateOptions, network, firewallTagNamingConvention.get(group));
-      templateOptions.networks(ImmutableSet.of(network.selfLink().toString()));
-      templateOptions.userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);
-
-      // Configure the default credentials, if needed
-      if (templateOptions.autoCreateKeyPair() && Strings.isNullOrEmpty(templateOptions.getPublicKey())) {
-         logger.debug(">> creating default keypair...");
-         Map<String, String> defaultKeys = keyGenerator.get();
-         templateOptions.authorizePublicKey(defaultKeys.get("public"));
-         templateOptions.overrideLoginPrivateKey(defaultKeys.get("private"));
-      }
-
-      if (templateOptions.getRunScript() != null && templateOptions.getLoginPrivateKey() == null) {
-         logger.warn(">> A runScript has been configured but no SSH key has been provided."
-               + " Authentication will delegate to the ssh-agent");
-      }
-
-      return super.execute(group, count, mutableTemplate, goodNodes, badNodes, customizationResponses);
-   }
-
-   /**
-    * Try and find a network previously created by the user.
-    */
-   private Network getNetwork(Set<String> networks) {
-      String networkName;
-      if (networks == null || networks.isEmpty()){
-         networkName = DEFAULT_NETWORK_NAME;
-      }
-      else {
-         Iterator<String> iterator = networks.iterator();
-         networkName = nameFromNetworkString(iterator.next());
-         checkArgument(!iterator.hasNext(), "Error: Please specify only one network in TemplateOptions when using GCE.");
-
-      }
-      Network network = api.networks().get(networkName);
-      checkArgument(network != null, "Error: no network with name %s was found", networkName);
-      return network;
-   }
-
-   /**
-    * Ensures that a firewall exists for every inbound port that the instance
-    * requests.
-    * <p>
-    * For each port, there must be a firewall with a name following the
-    * {@link FirewallTagNamingConvention}, with a target tag also following the
-    * {@link FirewallTagNamingConvention}, which opens the requested port for
-    * all sources on both TCP and UDP protocols.
-    *
-    * @see org.jclouds.googlecomputeengine.features.FirewallApi#patch(String,
-    *      org.jclouds.googlecomputeengine.options.FirewallOptions)
-    */
-   private void getOrCreateFirewalls(GoogleComputeEngineTemplateOptions templateOptions, Network network,
-         FirewallTagNamingConvention naming) {
-
-      FirewallApi firewallApi = api.firewalls();
-      int[] inboundPorts = templateOptions.getInboundPorts();
-      if ((inboundPorts == null) || inboundPorts.length == 0){
-         return;
-      }
-
-      List<String> ports = simplifyPorts(inboundPorts);
-      String name = naming.name(ports);
-      Firewall firewall = firewallApi.get(name);
-      AtomicReference<Operation> operation = null;
-      if (firewall == null) {
-         List<Rule> rules = ImmutableList.of(Rule.create("tcp", ports), Rule.create("udp", ports));
-         FirewallOptions firewallOptions = new FirewallOptions().name(name).network(network.selfLink())
-                  .allowedRules(rules).sourceTags(templateOptions.getTags())
-                  .sourceRanges(of(DEFAULT_INTERNAL_NETWORK_RANGE, EXTERIOR_RANGE))
-                  .targetTags(ImmutableList.of(name));
-
-         operation = Atomics.newReference(firewallApi
-               .createInNetwork(firewallOptions.name(), network.selfLink(), firewallOptions));
-
-         operationDone.apply(operation);
-         checkState(operation.get().httpErrorStatusCode() == null, "Could not insert firewall, operation failed %s",
-               operation);
-      }
-   }
-
-   // Helper function for simplifying an array of ports to a list of ranges FirewallOptions expects.
-   public static List<String> simplifyPorts(int[] ports){
-      if ((ports == null) || (ports.length == 0)) {
-         return null;
-      }
-      ArrayList<String> output = new ArrayList<String>();
-      Arrays.sort(ports);
-
-      int range_start = ports[0];
-      int range_end = ports[0];
-      for (int i = 1; i < ports.length; i++) {
-         if ((ports[i - 1] == ports[i] - 1) || (ports[i - 1] == ports[i])){
-            // Range continues.
-            range_end = ports[i];
-         }
-         else {
-            // Range ends.
-            output.add(formatRange(range_start, range_end));
-            range_start = ports[i];
-            range_end = ports[i];
-         }
-      }
-      // Make sure we get the last range.
-      output.add(formatRange(range_start, range_end));
-      return output;
-   }
-
-   // Helper function for simplifyPorts. Formats port range strings.
-   private static String formatRange(int start, int finish){
-      if (start == finish){
-         return Integer.toString(start);
-      }
-      else {
-         return String.format("%s-%s", Integer.toString(start), Integer.toString(finish));
-      }
-   }
-
-   // Helper function for getting the network name from the full URI.
-   public static String nameFromNetworkString(String networkString) {
-      return networkString.substring(networkString.lastIndexOf('/') + 1);
-   }
-}