Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated to 1.5.0

  • Loading branch information...
commit ee5e87fb1d0e9670f00a366643fc1fdba5656506 1 parent 8409798
@pandriani pandriani authored
View
2  ec2-createlamp/pom.xml
@@ -33,7 +33,7 @@
<dependency>
<groupId>org.jclouds.provider</groupId>
<artifactId>aws-ec2</artifactId>
- <version>1.0.0</version>
+ <version>1.5.0</version>
</dependency>
</dependencies>
<build>
View
15 ec2-createlamp/src/main/java/org/jclouds/examples/ec2/createlamp/MainApp.java
@@ -27,7 +27,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import org.jclouds.compute.ComputeServiceContextFactory;
+import org.jclouds.ContextBuilder;
import org.jclouds.ec2.EC2AsyncClient;
import org.jclouds.ec2.EC2Client;
import org.jclouds.ec2.domain.InstanceState;
@@ -37,7 +37,6 @@
import org.jclouds.ec2.domain.Reservation;
import org.jclouds.ec2.domain.RunningInstance;
import org.jclouds.ec2.predicates.InstanceStateRunning;
-import org.jclouds.net.IPSocket;
import org.jclouds.predicates.InetSocketAddressConnect;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.rest.RestContext;
@@ -47,6 +46,7 @@
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
+import com.google.common.net.HostAndPort;
/**
* This the Main class of an Application that demonstrates the use of the EC2Client by creating a
@@ -73,8 +73,9 @@ public static void main(String[] args) throws TimeoutException {
String name = args[3];
// Init
- RestContext<EC2Client, EC2AsyncClient> context = new ComputeServiceContextFactory().createContext("aws-ec2",
- accesskeyid, secretkey).getProviderSpecificContext();
+ RestContext<EC2Client, EC2AsyncClient> context = ContextBuilder
+ .newBuilder("aws-ec2").credentials(accesskeyid, secretkey)
+ .build();
// Get a synchronous client
EC2Client client = context.getApi();
@@ -189,16 +190,16 @@ static RunningInstance blockUntilInstanceRunning(EC2Client client, RunningInstan
instance = findInstanceById(client, instance.getId());
- RetryablePredicate<IPSocket> socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 300,
+ RetryablePredicate<HostAndPort> socketTester = new RetryablePredicate<HostAndPort>(new InetSocketAddressConnect(), 300,
1, TimeUnit.SECONDS);
System.out.printf("%d: %s awaiting ssh service to start%n", System.currentTimeMillis(), instance.getIpAddress());
- if (!socketTester.apply(new IPSocket(instance.getIpAddress(), 22)))
+ if (!socketTester.apply(HostAndPort.fromParts(instance.getIpAddress(), 22)))
throw new TimeoutException("timeout waiting for ssh to start: " + instance.getIpAddress());
System.out.printf("%d: %s ssh service started%n", System.currentTimeMillis(), instance.getIpAddress());
System.out.printf("%d: %s awaiting http service to start%n", System.currentTimeMillis(), instance.getIpAddress());
- if (!socketTester.apply(new IPSocket(instance.getIpAddress(), 80)))
+ if (!socketTester.apply(HostAndPort.fromParts(instance.getIpAddress(), 80)))
throw new TimeoutException("timeout waiting for http to start: " + instance.getIpAddress());
System.out.printf("%d: %s http service started%n", System.currentTimeMillis(), instance.getIpAddress());
Please sign in to comment.
Something went wrong with that request. Please try again.