From 7f3ca1ad70f916e79c0bf5eacaf927e59ea18aca Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Thu, 1 Sep 2011 16:33:28 -0700 Subject: [PATCH] Issue 674: fixed merge problem --- .../ec2/config/EC2RestClientModule.java | 17 +++++++++++++++++ .../ec2/config/EC2RestClientModuleTest.java | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/config/EC2RestClientModule.java b/apis/ec2/src/main/java/org/jclouds/ec2/config/EC2RestClientModule.java index 90464c7937..8de8b8125b 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/config/EC2RestClientModule.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/config/EC2RestClientModule.java @@ -25,6 +25,7 @@ import java.util.Map; import java.util.Set; import java.util.Map.Entry; +import javax.annotation.Resource; import javax.inject.Inject; import javax.inject.Singleton; @@ -48,9 +49,11 @@ import org.jclouds.ec2.services.SecurityGroupAsyncClient; import org.jclouds.ec2.services.SecurityGroupClient; import org.jclouds.ec2.services.WindowsAsyncClient; import org.jclouds.ec2.services.WindowsClient; +import org.jclouds.http.HttpResponseException; import org.jclouds.http.RequiresHttp; import org.jclouds.location.Region; import org.jclouds.location.Zone; +import org.jclouds.logging.Logger; import org.jclouds.rest.ConfiguresRestClient; import com.google.common.base.Predicates; @@ -133,6 +136,20 @@ public class EC2RestClientModule } @Singleton + public static class RegionIdToZoneId implements javax.inject.Provider> { + @Resource + protected Logger logger = Logger.NULL; + + private final AvailabilityZoneAndRegionClient client; + private final Map regions; + + @Inject + public RegionIdToZoneId(EC2Client client, @Region Map regions) { + this.client = client.getAvailabilityZoneAndRegionServices(); + this.regions = regions; + } + + @Singleton @Zone @Override public Map get() { diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/config/EC2RestClientModuleTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/config/EC2RestClientModuleTest.java index d3e34de392..cb223eb89f 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/config/EC2RestClientModuleTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/config/EC2RestClientModuleTest.java @@ -1,3 +1,21 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.ec2.config; import static org.easymock.classextension.EasyMock.*;