mirror of https://github.com/apache/jclouds.git
Issue 230: started on IBM dev cloud
This commit is contained in:
parent
a1e680589c
commit
8234c94f37
|
@ -60,10 +60,4 @@ public class ${providerName}ContextBuilder extends ComputeServiceContextBuilder<
|
||||||
modules.add(new ${providerName}ComputeServiceContextModule(providerName));
|
modules.add(new ${providerName}ComputeServiceContextModule(providerName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ComputeServiceContext buildComputeServiceContext() {
|
|
||||||
return this.buildInjector().getInstance(Key.get(
|
|
||||||
new TypeLiteral<ComputeServiceContextImpl<${providerName}AsyncClient, ${providerName}Client>>() {}));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,10 @@ import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import ${package}.${providerName}Client;
|
import ${package}.${providerName}Client;
|
||||||
|
import ${package}.${providerName}AsyncClient;
|
||||||
import ${package}.config.${providerName}ContextModule;
|
import ${package}.config.${providerName}ContextModule;
|
||||||
|
|
||||||
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
import org.jclouds.compute.LoadBalancerService;
|
import org.jclouds.compute.LoadBalancerService;
|
||||||
import org.jclouds.compute.domain.ComputeMetadata;
|
import org.jclouds.compute.domain.ComputeMetadata;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
|
@ -38,6 +40,7 @@ import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.domain.Size;
|
import org.jclouds.compute.domain.Size;
|
||||||
import org.jclouds.compute.domain.Template;
|
import org.jclouds.compute.domain.Template;
|
||||||
import org.jclouds.compute.domain.TemplateBuilder;
|
import org.jclouds.compute.domain.TemplateBuilder;
|
||||||
|
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
||||||
import org.jclouds.compute.predicates.ScriptStatusReturnsZero;
|
import org.jclouds.compute.predicates.ScriptStatusReturnsZero;
|
||||||
import org.jclouds.compute.predicates.ScriptStatusReturnsZero.CommandUsingClient;
|
import org.jclouds.compute.predicates.ScriptStatusReturnsZero.CommandUsingClient;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
|
@ -50,12 +53,16 @@ import org.jclouds.domain.Location;
|
||||||
import org.jclouds.domain.LocationScope;
|
import org.jclouds.domain.LocationScope;
|
||||||
import org.jclouds.domain.internal.LocationImpl;
|
import org.jclouds.domain.internal.LocationImpl;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.net.IPSocket;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
|
import org.jclouds.predicates.SocketOpen;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.Scopes;
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
import com.google.inject.util.Providers;
|
import com.google.inject.util.Providers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,6 +80,11 @@ public class ${providerName}ComputeServiceContextModule extends ${providerName}C
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
super.configure();
|
super.configure();
|
||||||
|
bind(new TypeLiteral<ComputeServiceContext>() {
|
||||||
|
})
|
||||||
|
.to(
|
||||||
|
new TypeLiteral<ComputeServiceContextImpl<${providerName}AsyncClient, ${providerName}Client>>() {
|
||||||
|
}).in(Scopes.SINGLETON);
|
||||||
bind(AddNodeWithTagStrategy.class).to(${providerName}AddNodeWithTagStrategy.class);
|
bind(AddNodeWithTagStrategy.class).to(${providerName}AddNodeWithTagStrategy.class);
|
||||||
bind(ListNodesStrategy.class).to(${providerName}ListNodesStrategy.class);
|
bind(ListNodesStrategy.class).to(${providerName}ListNodesStrategy.class);
|
||||||
bind(GetNodeMetadataStrategy.class).to(${providerName}GetNodeMetadataStrategy.class);
|
bind(GetNodeMetadataStrategy.class).to(${providerName}GetNodeMetadataStrategy.class);
|
||||||
|
@ -80,6 +92,12 @@ public class ${providerName}ComputeServiceContextModule extends ${providerName}C
|
||||||
bind(DestroyNodeStrategy.class).to(${providerName}DestroyNodeStrategy.class);
|
bind(DestroyNodeStrategy.class).to(${providerName}DestroyNodeStrategy.class);
|
||||||
bind(LoadBalancerService.class).toProvider(Providers.<LoadBalancerService> of(null));
|
bind(LoadBalancerService.class).toProvider(Providers.<LoadBalancerService> of(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
protected Predicate<IPSocket> socketTester(SocketOpen open) {
|
||||||
|
return new RetryablePredicate<IPSocket>(open, 130, 1, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tested known configuration
|
* tested known configuration
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.chef.functions;
|
package org.jclouds.chef.functions;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
|
@ -32,6 +32,8 @@ bluelock.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudContextBuilder
|
||||||
bluelock.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudPropertiesBuilder
|
bluelock.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudPropertiesBuilder
|
||||||
gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder
|
gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder
|
||||||
gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder
|
gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder
|
||||||
|
ibmdev.propertiesbuilder=org.jclouds.ibmdev.IBMDeveloperCloudPropertiesBuilder
|
||||||
|
ibmdev.contextbuilder=org.jclouds.ibmdev.IBMDeveloperCloudContextBuilder
|
||||||
stub.propertiesbuilder=org.jclouds.compute.stub.StubComputeServicePropertiesBuilder
|
stub.propertiesbuilder=org.jclouds.compute.stub.StubComputeServicePropertiesBuilder
|
||||||
stub.contextbuilder=org.jclouds.compute.stub.StubComputeServiceContextBuilder
|
stub.contextbuilder=org.jclouds.compute.stub.StubComputeServiceContextBuilder
|
||||||
# example of where to change your endpoint
|
# example of where to change your endpoint
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
# use glob syntax.
|
||||||
|
syntax: glob
|
||||||
|
target
|
||||||
|
.settings
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
jclouds-ibmdev.iml
|
||||||
|
jclouds-ibmdev.ipr
|
||||||
|
jclouds-ibmdev.iws
|
|
@ -0,0 +1,109 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
$HeadURL$
|
||||||
|
$Revision$
|
||||||
|
$Date$
|
||||||
|
|
||||||
|
Copyright (C) 2009 Cloud Conscious, LLC <info@cloudconscious.com>
|
||||||
|
|
||||||
|
====================================================================
|
||||||
|
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.html
|
||||||
|
|
||||||
|
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.
|
||||||
|
====================================================================
|
||||||
|
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.jclouds</groupId>
|
||||||
|
<artifactId>jclouds-project</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../project/pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<groupId>org.jclouds</groupId>
|
||||||
|
<artifactId>jclouds-ibmdev</artifactId>
|
||||||
|
<name>jclouds IBMDeveloperCloud core</name>
|
||||||
|
<description>jclouds components to access IBMDeveloperCloud</description>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/ibmdevelopercloud</connection>
|
||||||
|
<developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/ibmdevelopercloud</developerConnection>
|
||||||
|
<url>http://jclouds.googlecode.com/svn/trunk/ibmdevelopercloud</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<!-- bootstrapping: need to fetch the project POM -->
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>jclouds-googlecode-deploy</id>
|
||||||
|
<url>http://jclouds.googlecode.com/svn/repo</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>jclouds-rimu-snapshots-nexus</id>
|
||||||
|
<url>http://jclouds.rimuhosting.com:8081/nexus/content/repositories/snapshots</url>
|
||||||
|
<snapshots>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<jclouds.test.user>${providerUser}</jclouds.test.user>
|
||||||
|
<jclouds.test.key>${providerPassword}</jclouds.test.key>
|
||||||
|
<jclouds.test.endpoint>https://www-180.ibm.com/cloud/enterprise/beta/api/rest/20090403</jclouds.test.endpoint>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>jclouds-core</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>jclouds-core</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>log4j</groupId>
|
||||||
|
<artifactId>log4j</artifactId>
|
||||||
|
<version>1.2.14</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>jclouds-log4j</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>jclouds-jsch</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>jclouds-compute</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>jclouds-compute</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,62 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.ibmdev;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import javax.inject.Qualifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Related to a IBMDeveloperCloud resource.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Retention(value = RetentionPolicy.RUNTIME)
|
||||||
|
@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
|
||||||
|
@Qualifier
|
||||||
|
public @interface IBMDeveloperCloud {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.ibmdev;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.PathParam;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.jclouds.http.filters.BasicAuthentication;
|
||||||
|
import org.jclouds.ibmdev.domain.Image;
|
||||||
|
import org.jclouds.ibmdev.functions.ParseImageFromJson;
|
||||||
|
import org.jclouds.ibmdev.functions.ParseImagesFromJson;
|
||||||
|
import org.jclouds.rest.annotations.Endpoint;
|
||||||
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
import org.jclouds.rest.annotations.ResponseParser;
|
||||||
|
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides asynchronous access to IBMDeveloperCloud via their REST API.
|
||||||
|
* <p/>
|
||||||
|
*
|
||||||
|
* @see IBMDeveloperCloudClient
|
||||||
|
* @see <a href="http://www-180.ibm.com/cloud/enterprise/beta/support" />
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Endpoint(IBMDeveloperCloud.class)
|
||||||
|
@RequestFilters(BasicAuthentication.class)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
public interface IBMDeveloperCloudAsyncClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IBMDeveloperCloudAsyncClient#listImages()
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/images")
|
||||||
|
@ResponseParser(ParseImagesFromJson.class)
|
||||||
|
ListenableFuture<Set<? extends Image>> listImages();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see IBMDeveloperCloudAsyncClient#getImage(long)
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
|
@Path("/images/{imageId}")
|
||||||
|
@ResponseParser(ParseImageFromJson.class)
|
||||||
|
ListenableFuture<Image> getImage(@PathParam("imageId") long id);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.ibmdev;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.jclouds.concurrent.Timeout;
|
||||||
|
import org.jclouds.http.HttpResponseException;
|
||||||
|
import org.jclouds.ibmdev.domain.Image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides synchronous access to IBMDeveloperCloud.
|
||||||
|
* <p/>
|
||||||
|
*
|
||||||
|
* @see IBMDeveloperCloudAsyncClient
|
||||||
|
* @see <a href="http://www-180.ibm.com/cloud/enterprise/beta/support" />
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Timeout(duration = 4, timeUnit = TimeUnit.SECONDS)
|
||||||
|
public interface IBMDeveloperCloudClient {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the list of Images available to be provisioned on the IBM DeveloperCloud.
|
||||||
|
*/
|
||||||
|
Set<? extends Image> listImages();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the available Image identified by the supplied Image ID.
|
||||||
|
*
|
||||||
|
* @return null if image is not found
|
||||||
|
* @throws HttpResponseException
|
||||||
|
* code 401 if the user is not authorized to view this image to section
|
||||||
|
*/
|
||||||
|
Image getImage(long id);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.ibmdev;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.jclouds.compute.ComputeServiceContextBuilder;
|
||||||
|
import org.jclouds.ibmdev.compute.config.IBMDeveloperCloudComputeServiceContextModule;
|
||||||
|
import org.jclouds.ibmdev.config.IBMDeveloperCloudRestClientModule;
|
||||||
|
|
||||||
|
import com.google.inject.Module;
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class IBMDeveloperCloudContextBuilder extends
|
||||||
|
ComputeServiceContextBuilder<IBMDeveloperCloudAsyncClient, IBMDeveloperCloudClient> {
|
||||||
|
|
||||||
|
public IBMDeveloperCloudContextBuilder(String providerName, Properties props) {
|
||||||
|
super(providerName, new TypeLiteral<IBMDeveloperCloudAsyncClient>() {
|
||||||
|
}, new TypeLiteral<IBMDeveloperCloudClient>() {
|
||||||
|
}, props);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addClientModule(List<Module> modules) {
|
||||||
|
modules.add(new IBMDeveloperCloudRestClientModule());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addContextModule(String providerName, List<Module> modules) {
|
||||||
|
modules.add(new IBMDeveloperCloudComputeServiceContextModule(providerName));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.ibmdev;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
|
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
||||||
|
import org.jclouds.logging.jdk.config.JDKLoggingModule;
|
||||||
|
|
||||||
|
import com.google.inject.Module;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates {@link ComputeServiceContext} instances based on the most commonly
|
||||||
|
* requested arguments.
|
||||||
|
* <p/>
|
||||||
|
* Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
|
||||||
|
* <p/>
|
||||||
|
* <p/>
|
||||||
|
* If no <code>Module</code>s are specified, the default {@link JDKLoggingModule logging} and
|
||||||
|
* {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
* @see ComputeServiceContext
|
||||||
|
*/
|
||||||
|
public class IBMDeveloperCloudContextFactory {
|
||||||
|
public static ComputeServiceContext createContext(Properties properties, Module... modules) {
|
||||||
|
return new IBMDeveloperCloudContextBuilder("ibmdev",
|
||||||
|
new IBMDeveloperCloudPropertiesBuilder(properties).build()).withModules(modules)
|
||||||
|
.buildComputeServiceContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ComputeServiceContext createContext(String user, String key,
|
||||||
|
Module... modules) {
|
||||||
|
return new IBMDeveloperCloudContextBuilder("ibmdev",
|
||||||
|
new IBMDeveloperCloudPropertiesBuilder(user, key).build())
|
||||||
|
.withModules(modules).buildComputeServiceContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ComputeServiceContext createContext(Properties properties, String user,
|
||||||
|
String key, Module... modules) {
|
||||||
|
return new IBMDeveloperCloudContextBuilder("ibmdev",
|
||||||
|
new IBMDeveloperCloudPropertiesBuilder(properties).withCredentials(user, key)
|
||||||
|
.build()).withModules(modules).buildComputeServiceContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ComputeServiceContext createContext(URI endpoint, String user, String key,
|
||||||
|
Module... modules) {
|
||||||
|
return new IBMDeveloperCloudContextBuilder("ibmdev",
|
||||||
|
new IBMDeveloperCloudPropertiesBuilder(user, key).withEndpoint(endpoint).build())
|
||||||
|
.withModules(modules).buildComputeServiceContext();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.ibmdev;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static org.jclouds.ibmdev.reference.IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT;
|
||||||
|
import static org.jclouds.ibmdev.reference.IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_PASSWORD;
|
||||||
|
import static org.jclouds.ibmdev.reference.IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_USER;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.jclouds.PropertiesBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds properties used in IBMDeveloperCloud Clients
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class IBMDeveloperCloudPropertiesBuilder extends PropertiesBuilder {
|
||||||
|
@Override
|
||||||
|
protected Properties defaultProperties() {
|
||||||
|
Properties properties = super.defaultProperties();
|
||||||
|
properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT, "https://www-180.ibm.com/cloud/enterprise/beta/api/rest/20090403");
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBMDeveloperCloudPropertiesBuilder(Properties properties) {
|
||||||
|
super(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBMDeveloperCloudPropertiesBuilder(String id, String secret) {
|
||||||
|
super();
|
||||||
|
withCredentials(id, secret);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBMDeveloperCloudPropertiesBuilder withCredentials(String id, String secret) {
|
||||||
|
properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_USER, checkNotNull(id, "user"));
|
||||||
|
properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_PASSWORD, checkNotNull(secret, "password"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBMDeveloperCloudPropertiesBuilder withEndpoint(URI endpoint) {
|
||||||
|
properties.setProperty(PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT, checkNotNull(endpoint, "endpoint")
|
||||||
|
.toString());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,277 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.ibmdev.compute.config;
|
||||||
|
|
||||||
|
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
|
import org.jclouds.compute.LoadBalancerService;
|
||||||
|
import org.jclouds.compute.domain.ComputeMetadata;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
|
import org.jclouds.compute.domain.Size;
|
||||||
|
import org.jclouds.compute.domain.Template;
|
||||||
|
import org.jclouds.compute.domain.TemplateBuilder;
|
||||||
|
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
||||||
|
import org.jclouds.compute.predicates.ScriptStatusReturnsZero;
|
||||||
|
import org.jclouds.compute.predicates.ScriptStatusReturnsZero.CommandUsingClient;
|
||||||
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
|
import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
|
||||||
|
import org.jclouds.compute.strategy.DestroyNodeStrategy;
|
||||||
|
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
|
||||||
|
import org.jclouds.compute.strategy.ListNodesStrategy;
|
||||||
|
import org.jclouds.compute.strategy.RebootNodeStrategy;
|
||||||
|
import org.jclouds.domain.Location;
|
||||||
|
import org.jclouds.domain.LocationScope;
|
||||||
|
import org.jclouds.domain.internal.LocationImpl;
|
||||||
|
import org.jclouds.ibmdev.IBMDeveloperCloudAsyncClient;
|
||||||
|
import org.jclouds.ibmdev.IBMDeveloperCloudClient;
|
||||||
|
import org.jclouds.ibmdev.config.IBMDeveloperCloudContextModule;
|
||||||
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.net.IPSocket;
|
||||||
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
|
import org.jclouds.predicates.SocketOpen;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.Scopes;
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
|
import com.google.inject.util.Providers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class IBMDeveloperCloudComputeServiceContextModule extends IBMDeveloperCloudContextModule {
|
||||||
|
|
||||||
|
private final String providerName;
|
||||||
|
|
||||||
|
public IBMDeveloperCloudComputeServiceContextModule(String providerName) {
|
||||||
|
super(providerName);
|
||||||
|
this.providerName = providerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
super.configure();
|
||||||
|
bind(new TypeLiteral<ComputeServiceContext>() {
|
||||||
|
})
|
||||||
|
.to(
|
||||||
|
new TypeLiteral<ComputeServiceContextImpl<IBMDeveloperCloudAsyncClient, IBMDeveloperCloudClient>>() {
|
||||||
|
}).in(Scopes.SINGLETON);
|
||||||
|
bind(AddNodeWithTagStrategy.class).to(IBMDeveloperCloudAddNodeWithTagStrategy.class);
|
||||||
|
bind(ListNodesStrategy.class).to(IBMDeveloperCloudListNodesStrategy.class);
|
||||||
|
bind(GetNodeMetadataStrategy.class).to(IBMDeveloperCloudGetNodeMetadataStrategy.class);
|
||||||
|
bind(RebootNodeStrategy.class).to(IBMDeveloperCloudRebootNodeStrategy.class);
|
||||||
|
bind(DestroyNodeStrategy.class).to(IBMDeveloperCloudDestroyNodeStrategy.class);
|
||||||
|
bind(LoadBalancerService.class).toProvider(Providers.<LoadBalancerService> of(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
protected Predicate<IPSocket> socketTester(SocketOpen open) {
|
||||||
|
return new RetryablePredicate<IPSocket>(open, 130, 1, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tested known configuration
|
||||||
|
*/
|
||||||
|
@Provides
|
||||||
|
@Named("DEFAULT")
|
||||||
|
protected TemplateBuilder provideTemplate(TemplateBuilder template) {
|
||||||
|
return template.osFamily(UBUNTU);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Named("NAMING_CONVENTION")
|
||||||
|
@Singleton
|
||||||
|
String provideNamingConvention() {
|
||||||
|
return "%s-%d";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public static class IBMDeveloperCloudAddNodeWithTagStrategy implements AddNodeWithTagStrategy {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected IBMDeveloperCloudAddNodeWithTagStrategy() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NodeMetadata execute(String tag, String name, Template template) {
|
||||||
|
/*
|
||||||
|
* TODO: implement
|
||||||
|
*/
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public static class IBMDeveloperCloudRebootNodeStrategy implements RebootNodeStrategy {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected IBMDeveloperCloudRebootNodeStrategy() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(String id) {
|
||||||
|
/*
|
||||||
|
* TODO: implement
|
||||||
|
*/
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public static class IBMDeveloperCloudListNodesStrategy implements ListNodesStrategy {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected IBMDeveloperCloudListNodesStrategy() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<? extends ComputeMetadata> list() {
|
||||||
|
/*
|
||||||
|
* TODO: implement
|
||||||
|
*/return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<? extends NodeMetadata> listDetailsOnNodesMatching(
|
||||||
|
Predicate<ComputeMetadata> filter) {
|
||||||
|
/*
|
||||||
|
* TODO: implement
|
||||||
|
*/
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public static class IBMDeveloperCloudGetNodeMetadataStrategy implements GetNodeMetadataStrategy {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected IBMDeveloperCloudGetNodeMetadataStrategy() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NodeMetadata execute(String id) {
|
||||||
|
/*
|
||||||
|
* TODO: implement
|
||||||
|
*/
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public static class IBMDeveloperCloudDestroyNodeStrategy implements DestroyNodeStrategy {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected IBMDeveloperCloudDestroyNodeStrategy() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(String id) {
|
||||||
|
/*
|
||||||
|
* TODO: implement
|
||||||
|
*/
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
@Named("NOT_RUNNING")
|
||||||
|
protected Predicate<CommandUsingClient> runScriptRunning(ScriptStatusReturnsZero stateRunning) {
|
||||||
|
return new RetryablePredicate<CommandUsingClient>(Predicates.not(stateRunning), 600, 3,
|
||||||
|
TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
Location getDefaultLocation(Set<? extends Location> locations) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: implement
|
||||||
|
*/
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
Set<? extends Location> getAssignableLocations(IBMDeveloperCloudClient sync, LogHolder holder) {
|
||||||
|
final Set<Location> assignableLocations = Sets.newHashSet();
|
||||||
|
holder.logger.debug(">> providing locations");
|
||||||
|
Location parent = new LocationImpl(LocationScope.PROVIDER, providerName, providerName, null);
|
||||||
|
/*
|
||||||
|
* TODO: add children with parent to locations. Note do not add parent to assignablelocations
|
||||||
|
* directly
|
||||||
|
*/
|
||||||
|
|
||||||
|
holder.logger.debug("<< locations(%d)", assignableLocations.size());
|
||||||
|
return assignableLocations;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
protected Set<? extends Size> provideSizes(IBMDeveloperCloudClient sync,
|
||||||
|
Set<? extends Image> images, LogHolder holder) {
|
||||||
|
final Set<Size> sizes = Sets.newHashSet();
|
||||||
|
holder.logger.debug(">> providing sizes");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: implement
|
||||||
|
*/
|
||||||
|
|
||||||
|
holder.logger.debug("<< sizes(%d)", sizes.size());
|
||||||
|
return sizes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
protected Set<? extends Image> provideImages(final IBMDeveloperCloudClient sync,
|
||||||
|
LogHolder holder, Location location) {
|
||||||
|
final Set<Image> images = Sets.newHashSet();
|
||||||
|
holder.logger.debug(">> providing images");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: implement
|
||||||
|
*/
|
||||||
|
|
||||||
|
holder.logger.debug("<< images(%d)", images.size());
|
||||||
|
return images;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
private static class LogHolder {
|
||||||
|
@Resource
|
||||||
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
|
protected Logger logger = Logger.NULL;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.ibmdev.config;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.ibmdev.IBMDeveloperCloud;
|
||||||
|
import org.jclouds.ibmdev.IBMDeveloperCloudAsyncClient;
|
||||||
|
import org.jclouds.ibmdev.IBMDeveloperCloudClient;
|
||||||
|
import org.jclouds.ibmdev.reference.IBMDeveloperCloudConstants;
|
||||||
|
import org.jclouds.lifecycle.Closer;
|
||||||
|
import org.jclouds.rest.RestContext;
|
||||||
|
import org.jclouds.rest.internal.RestContextImpl;
|
||||||
|
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures the IBMDeveloperCloud connection, including logging and http transport.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class IBMDeveloperCloudContextModule extends AbstractModule {
|
||||||
|
|
||||||
|
public IBMDeveloperCloudContextModule(String providerName) {
|
||||||
|
// providerName ignored right now
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
// example of how to customize bindings
|
||||||
|
// bind(DateAdapter.class).to(CDateAdapter.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
RestContext<IBMDeveloperCloudAsyncClient, IBMDeveloperCloudClient> provideContext(Closer closer,
|
||||||
|
IBMDeveloperCloudAsyncClient asyncApi, IBMDeveloperCloudClient syncApi,
|
||||||
|
@IBMDeveloperCloud URI endPoint,
|
||||||
|
@Named(IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_USER) String account) {
|
||||||
|
return new RestContextImpl<IBMDeveloperCloudAsyncClient, IBMDeveloperCloudClient>(closer,
|
||||||
|
asyncApi, syncApi, endPoint, account);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.ibmdev.config;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.concurrent.internal.SyncProxy;
|
||||||
|
import org.jclouds.http.RequiresHttp;
|
||||||
|
import org.jclouds.http.filters.BasicAuthentication;
|
||||||
|
import org.jclouds.rest.ConfiguresRestClient;
|
||||||
|
import org.jclouds.rest.RestClientFactory;
|
||||||
|
import org.jclouds.encryption.EncryptionService;
|
||||||
|
|
||||||
|
import org.jclouds.ibmdev.IBMDeveloperCloud;
|
||||||
|
import org.jclouds.ibmdev.IBMDeveloperCloudClient;
|
||||||
|
import org.jclouds.ibmdev.IBMDeveloperCloudAsyncClient;
|
||||||
|
import org.jclouds.ibmdev.reference.IBMDeveloperCloudConstants;
|
||||||
|
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures the IBMDeveloperCloud connection.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@RequiresHttp
|
||||||
|
@ConfiguresRestClient
|
||||||
|
public class IBMDeveloperCloudRestClientModule extends AbstractModule {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
bindErrorHandlers();
|
||||||
|
bindRetryHandlers();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public BasicAuthentication provideBasicAuthentication(
|
||||||
|
@Named(IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_USER) String user,
|
||||||
|
@Named(IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_PASSWORD) String password,
|
||||||
|
EncryptionService encryptionService)
|
||||||
|
throws UnsupportedEncodingException {
|
||||||
|
return new BasicAuthentication(user, password, encryptionService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
protected IBMDeveloperCloudAsyncClient provideClient(RestClientFactory factory) {
|
||||||
|
return factory.create(IBMDeveloperCloudAsyncClient.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public IBMDeveloperCloudClient provideClient(IBMDeveloperCloudAsyncClient provider) throws IllegalArgumentException,
|
||||||
|
SecurityException, NoSuchMethodException {
|
||||||
|
return SyncProxy.create(IBMDeveloperCloudClient.class, provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
@IBMDeveloperCloud
|
||||||
|
protected URI provideURI(@Named(IBMDeveloperCloudConstants.PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT) String endpoint) {
|
||||||
|
return URI.create(endpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void bindErrorHandlers() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void bindRetryHandlers() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,258 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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
|
||||||
|
*
|
||||||
|
* 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.ibmdev.domain;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* The current state of the image.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public class Image {
|
||||||
|
private String name;
|
||||||
|
private String manifest;
|
||||||
|
private int state;
|
||||||
|
private String visibility;
|
||||||
|
private String owner;
|
||||||
|
private String architecture;
|
||||||
|
private String platform;
|
||||||
|
private long createdTime;
|
||||||
|
private long location;
|
||||||
|
private Set<String> supportedInstanceTypes = Sets.newLinkedHashSet();
|
||||||
|
private Set<String> productCodes = Sets.newLinkedHashSet();
|
||||||
|
private String documentation;
|
||||||
|
private long id;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getManifest() {
|
||||||
|
return manifest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManifest(String manifest) {
|
||||||
|
this.manifest = manifest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(int state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVisibility() {
|
||||||
|
return visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVisibility(String visibility) {
|
||||||
|
this.visibility = visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwner() {
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwner(String owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArchitecture() {
|
||||||
|
return architecture;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArchitecture(String architecture) {
|
||||||
|
this.architecture = architecture;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatform(String platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCreatedTime() {
|
||||||
|
return createdTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedTime(long createdTime) {
|
||||||
|
this.createdTime = createdTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocation(long location) {
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> getSupportedInstanceTypes() {
|
||||||
|
return supportedInstanceTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSupportedInstanceTypes(Set<String> supportedInstanceTypes) {
|
||||||
|
this.supportedInstanceTypes = supportedInstanceTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> getProductCodes() {
|
||||||
|
return productCodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductCodes(Set<String> productCodes) {
|
||||||
|
this.productCodes = productCodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDocumentation() {
|
||||||
|
return documentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDocumentation(String documentation) {
|
||||||
|
this.documentation = documentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((architecture == null) ? 0 : architecture.hashCode());
|
||||||
|
result = prime * result + (int) (createdTime ^ (createdTime >>> 32));
|
||||||
|
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
||||||
|
result = prime * result + ((documentation == null) ? 0 : documentation.hashCode());
|
||||||
|
result = prime * result + (int) (id ^ (id >>> 32));
|
||||||
|
result = prime * result + (int) (location ^ (location >>> 32));
|
||||||
|
result = prime * result + ((manifest == null) ? 0 : manifest.hashCode());
|
||||||
|
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||||
|
result = prime * result + ((owner == null) ? 0 : owner.hashCode());
|
||||||
|
result = prime * result + ((platform == null) ? 0 : platform.hashCode());
|
||||||
|
result = prime * result + ((productCodes == null) ? 0 : productCodes.hashCode());
|
||||||
|
result = prime * result + state;
|
||||||
|
result = prime * result
|
||||||
|
+ ((supportedInstanceTypes == null) ? 0 : supportedInstanceTypes.hashCode());
|
||||||
|
result = prime * result + ((visibility == null) ? 0 : visibility.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
Image other = (Image) obj;
|
||||||
|
if (architecture == null) {
|
||||||
|
if (other.architecture != null)
|
||||||
|
return false;
|
||||||
|
} else if (!architecture.equals(other.architecture))
|
||||||
|
return false;
|
||||||
|
if (createdTime != other.createdTime)
|
||||||
|
return false;
|
||||||
|
if (description == null) {
|
||||||
|
if (other.description != null)
|
||||||
|
return false;
|
||||||
|
} else if (!description.equals(other.description))
|
||||||
|
return false;
|
||||||
|
if (documentation == null) {
|
||||||
|
if (other.documentation != null)
|
||||||
|
return false;
|
||||||
|
} else if (!documentation.equals(other.documentation))
|
||||||
|
return false;
|
||||||
|
if (id != other.id)
|
||||||
|
return false;
|
||||||
|
if (location != other.location)
|
||||||
|
return false;
|
||||||
|
if (manifest == null) {
|
||||||
|
if (other.manifest != null)
|
||||||
|
return false;
|
||||||
|
} else if (!manifest.equals(other.manifest))
|
||||||
|
return false;
|
||||||
|
if (name == null) {
|
||||||
|
if (other.name != null)
|
||||||
|
return false;
|
||||||
|
} else if (!name.equals(other.name))
|
||||||
|
return false;
|
||||||
|
if (owner == null) {
|
||||||
|
if (other.owner != null)
|
||||||
|
return false;
|
||||||
|
} else if (!owner.equals(other.owner))
|
||||||
|
return false;
|
||||||
|
if (platform == null) {
|
||||||
|
if (other.platform != null)
|
||||||
|
return false;
|
||||||
|
} else if (!platform.equals(other.platform))
|
||||||
|
return false;
|
||||||
|
if (productCodes == null) {
|
||||||
|
if (other.productCodes != null)
|
||||||
|
return false;
|
||||||
|
} else if (!productCodes.equals(other.productCodes))
|
||||||
|
return false;
|
||||||
|
if (state != other.state)
|
||||||
|
return false;
|
||||||
|
if (supportedInstanceTypes == null) {
|
||||||
|
if (other.supportedInstanceTypes != null)
|
||||||
|
return false;
|
||||||
|
} else if (!supportedInstanceTypes.equals(other.supportedInstanceTypes))
|
||||||
|
return false;
|
||||||
|
if (visibility == null) {
|
||||||
|
if (other.visibility != null)
|
||||||
|
return false;
|
||||||
|
} else if (!visibility.equals(other.visibility))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Image [id=" + id + ", name=" + name + ", location=" + location + ", manifest="
|
||||||
|
+ manifest + ", platform=" + platform + ", state=" + state
|
||||||
|
+ ", supportedInstanceTypes=" + supportedInstanceTypes + ", visibility="
|
||||||
|
+ visibility + "]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.ibmdev.functions;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.http.functions.ParseJson;
|
||||||
|
import org.jclouds.ibmdev.domain.Image;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class ParseImageFromJson extends ParseJson<Image> {
|
||||||
|
@Inject
|
||||||
|
public ParseImageFromJson(Gson gson) {
|
||||||
|
super(gson);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Set<String> emptyString = ImmutableSet.of("");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Image apply(InputStream stream) {
|
||||||
|
try {
|
||||||
|
Image returnVal = gson.fromJson(new InputStreamReader(stream, "UTF-8"), Image.class);
|
||||||
|
if (emptyString.equals(returnVal.getProductCodes()))
|
||||||
|
returnVal.getProductCodes().clear();
|
||||||
|
return returnVal;
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
throw new RuntimeException("jclouds requires UTF-8 encoding", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.ibmdev.functions;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.http.functions.ParseJson;
|
||||||
|
import org.jclouds.ibmdev.domain.Image;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class ParseImagesFromJson extends ParseJson<Set<? extends Image>> {
|
||||||
|
@Inject
|
||||||
|
public ParseImagesFromJson(Gson gson) {
|
||||||
|
super(gson);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ImageListResponse {
|
||||||
|
Set<Image> images = Sets.newLinkedHashSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Set<String> emptyString = ImmutableSet.of("");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Set<? extends Image> apply(InputStream stream) {
|
||||||
|
try {
|
||||||
|
Set<Image> list = gson.fromJson(new InputStreamReader(stream, "UTF-8"),
|
||||||
|
ImageListResponse.class).images;
|
||||||
|
for (Image image : list)
|
||||||
|
if (emptyString.equals(image.getProductCodes()))
|
||||||
|
image.getProductCodes().clear();
|
||||||
|
return list;
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
throw new RuntimeException("jclouds requires UTF-8 encoding", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.ibmdev.reference;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration properties and constants used in IBMDeveloperCloud connections.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public interface IBMDeveloperCloudConstants {
|
||||||
|
public static final String PROPERTY_IBMDEVELOPERCLOUD_ENDPOINT = "jclouds.ibmdevelopercloud.endpoint";
|
||||||
|
public static final String PROPERTY_IBMDEVELOPERCLOUD_USER = "jclouds.ibmdevelopercloud.user";
|
||||||
|
public static final String PROPERTY_IBMDEVELOPERCLOUD_PASSWORD = "jclouds.ibmdevelopercloud.password";
|
||||||
|
}
|
|
@ -0,0 +1,147 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.ibmdev;
|
||||||
|
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.encryption.EncryptionService;
|
||||||
|
import org.jclouds.http.filters.BasicAuthentication;
|
||||||
|
import org.jclouds.ibmdev.functions.ParseImageFromJson;
|
||||||
|
import org.jclouds.ibmdev.functions.ParseImagesFromJson;
|
||||||
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.logging.Logger.LoggerFactory;
|
||||||
|
import org.jclouds.rest.RestClientTest;
|
||||||
|
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||||
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
|
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
|
import org.jclouds.util.Jsr330;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
|
import com.google.inject.Module;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests annotation parsing of {@code IBMDeveloperCloudAsyncClient}
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(groups = "unit", testName = "ibmdevelopercloud.IBMDeveloperCloudAsyncClientTest")
|
||||||
|
public class IBMDeveloperCloudAsyncClientTest extends RestClientTest<IBMDeveloperCloudAsyncClient> {
|
||||||
|
|
||||||
|
|
||||||
|
public void testListImages() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
|
Method method = IBMDeveloperCloudAsyncClient.class.getMethod("listImages");
|
||||||
|
GeneratedHttpRequest<IBMDeveloperCloudAsyncClient> httpRequest = processor.createRequest(method);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest, "GET https://www-180.ibm.com/cloud/enterprise/beta/api/rest/20090403/images HTTP/1.1");
|
||||||
|
assertHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null);
|
||||||
|
|
||||||
|
// now make sure request filters apply by replaying
|
||||||
|
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||||
|
Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest, "GET https://www-180.ibm.com/cloud/enterprise/beta/api/rest/20090403/images HTTP/1.1");
|
||||||
|
// for example, using basic authentication, we should get "only one" header
|
||||||
|
assertHeadersEqual(httpRequest, "Accept: application/json\nAuthorization: Basic Zm9vOmJhcg==\n");
|
||||||
|
assertPayloadEquals(httpRequest, null);
|
||||||
|
|
||||||
|
// TODO: insert expected response class, which probably extends ParseJson
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, ParseImagesFromJson.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, null);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
|
Method method = IBMDeveloperCloudAsyncClient.class.getMethod("getImage", long.class);
|
||||||
|
GeneratedHttpRequest<IBMDeveloperCloudAsyncClient> httpRequest = processor.createRequest(method, 1);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest, "GET https://www-180.ibm.com/cloud/enterprise/beta/api/rest/20090403/images/1 HTTP/1.1");
|
||||||
|
assertHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null);
|
||||||
|
|
||||||
|
// TODO: insert expected response class, which probably extends ParseJson
|
||||||
|
assertResponseParserClassEquals(method, httpRequest, ParseImageFromJson.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
// note that get methods should convert 404's to null
|
||||||
|
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void checkFilters(GeneratedHttpRequest<IBMDeveloperCloudAsyncClient> httpRequest) {
|
||||||
|
assertEquals(httpRequest.getFilters().size(), 1);
|
||||||
|
assertEquals(httpRequest.getFilters().get(0).getClass(), BasicAuthentication.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TypeLiteral<RestAnnotationProcessor<IBMDeveloperCloudAsyncClient>> createTypeLiteral() {
|
||||||
|
return new TypeLiteral<RestAnnotationProcessor<IBMDeveloperCloudAsyncClient>>() {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Module createModule() {
|
||||||
|
return new AbstractModule() {
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
Jsr330.bindProperties(binder(), new IBMDeveloperCloudPropertiesBuilder(
|
||||||
|
new Properties()).build());
|
||||||
|
bind(URI.class).annotatedWith(IBMDeveloperCloud.class).toInstance(
|
||||||
|
URI.create("https://www-180.ibm.com/cloud/enterprise/beta/api/rest/20090403"));
|
||||||
|
bind(Logger.LoggerFactory.class).toInstance(new LoggerFactory() {
|
||||||
|
public Logger getLogger(String category) {
|
||||||
|
return Logger.NULL;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
public BasicAuthentication provideBasicAuthentication(EncryptionService encryptionService)
|
||||||
|
throws UnsupportedEncodingException {
|
||||||
|
return new BasicAuthentication("foo", "bar", encryptionService);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* 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.ibmdev;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.jclouds.ibmdev.domain.Image;
|
||||||
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
|
import org.testng.annotations.BeforeGroups;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests behavior of {@code IBMDeveloperCloudClient}
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(groups = "live", testName = "ibmdevelopercloud.IBMDeveloperCloudClientLiveTest")
|
||||||
|
public class IBMDeveloperCloudClientLiveTest {
|
||||||
|
|
||||||
|
private IBMDeveloperCloudClient connection;
|
||||||
|
|
||||||
|
@BeforeGroups(groups = { "live" })
|
||||||
|
public void setupClient() {
|
||||||
|
String user = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
|
String password = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
|
|
||||||
|
connection = (IBMDeveloperCloudClient) IBMDeveloperCloudContextFactory.createContext(user,
|
||||||
|
password, new Log4JLoggingModule()).getProviderSpecificContext().getApi();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testListImages() throws Exception {
|
||||||
|
Set<? extends Image> response = connection.listImages();
|
||||||
|
assertNotNull(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetImage() throws Exception {
|
||||||
|
Set<? extends Image> response = connection.listImages();
|
||||||
|
assertNotNull(response);
|
||||||
|
if (response.size() > 0) {
|
||||||
|
Image image = Iterables.get(response, 0);
|
||||||
|
assertEquals(connection.getImage(image.getId()), image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.ibmdev.compute;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.jclouds.ibmdev.IBMDeveloperCloudAsyncClient;
|
||||||
|
import org.jclouds.ibmdev.IBMDeveloperCloudClient;
|
||||||
|
import org.jclouds.compute.BaseComputeServiceLiveTest;
|
||||||
|
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||||
|
import org.jclouds.compute.domain.Architecture;
|
||||||
|
import org.jclouds.compute.domain.OsFamily;
|
||||||
|
import org.jclouds.compute.domain.Template;
|
||||||
|
import org.jclouds.rest.RestContext;
|
||||||
|
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(groups = "live", enabled = true, sequential = true, testName = "ibmdevelopercloud.IBMDeveloperCloudComputeServiceLiveTest")
|
||||||
|
public class IBMDeveloperCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
@Override
|
||||||
|
public void setServiceDefaults() {
|
||||||
|
service = "ibmdevelopercloud";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTemplateBuilder() {
|
||||||
|
Template defaultTemplate = client.templateBuilder().build();
|
||||||
|
assertEquals(defaultTemplate.getImage().getArchitecture(), Architecture.X86_64);
|
||||||
|
assertEquals(defaultTemplate.getImage().getOsFamily(), OsFamily.UBUNTU);
|
||||||
|
assertEquals(defaultTemplate.getLocation().getId(), "DFW1");
|
||||||
|
assertEquals(defaultTemplate.getSize().getCores(), 1.0d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected JschSshClientModule getSshModule() {
|
||||||
|
return new JschSshClientModule();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAssignability() throws Exception {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
RestContext<IBMDeveloperCloudAsyncClient, IBMDeveloperCloudClient> tmContext = new ComputeServiceContextFactory()
|
||||||
|
.createContext(service, user, password).getProviderSpecificContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.ibmdev.compute;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.jclouds.ibmdev.IBMDeveloperCloudContextBuilder;
|
||||||
|
import org.jclouds.ibmdev.IBMDeveloperCloudPropertiesBuilder;
|
||||||
|
import org.testng.annotations.BeforeTest;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.io.Resources;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(groups = "unit", testName = "compute.PropertiesTest")
|
||||||
|
public class PropertiesTest {
|
||||||
|
private Properties properties;
|
||||||
|
|
||||||
|
@BeforeTest
|
||||||
|
public void setUp() throws IOException {
|
||||||
|
properties = new Properties();
|
||||||
|
properties.load(Resources.newInputStreamSupplier(Resources.getResource("compute.properties"))
|
||||||
|
.getInput());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testIBMDeveloperCloud() {
|
||||||
|
assertEquals(properties.getProperty("ibmdev.contextbuilder"),
|
||||||
|
IBMDeveloperCloudContextBuilder.class.getName());
|
||||||
|
assertEquals(properties.getProperty("ibmdev.propertiesbuilder"),
|
||||||
|
IBMDeveloperCloudPropertiesBuilder.class.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.ibmdev.functions;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.jclouds.http.HttpResponse;
|
||||||
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
|
import org.jclouds.ibmdev.domain.Image;
|
||||||
|
import org.testng.annotations.BeforeTest;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.inject.Guice;
|
||||||
|
import com.google.inject.Injector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests behavior of {@code ParseImageFromJson}
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(groups = "unit", sequential = true, testName = "ibmdev.ParseImageFromJsonTest")
|
||||||
|
public class ParseImageFromJsonTest {
|
||||||
|
|
||||||
|
private ParseImageFromJson handler;
|
||||||
|
|
||||||
|
@BeforeTest
|
||||||
|
protected void setUpInjector() throws IOException {
|
||||||
|
Injector injector = Guice.createInjector(new ParserModule());
|
||||||
|
handler = injector.getInstance(ParseImageFromJson.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void test() {
|
||||||
|
|
||||||
|
Image image = new Image();
|
||||||
|
image.setName("Rational Requirements Composer");
|
||||||
|
image
|
||||||
|
.setManifest("https://www-180.ibm.com/cloud/enterprise/beta/ram.ws/RAMSecure/artifact/{28C7B870-2C0A-003F-F886-B89F5B413B77}/1.0/parameters.xml");
|
||||||
|
image.setState(1);
|
||||||
|
image.setVisibility("PUBLIC");
|
||||||
|
image.setOwner("mutdosch@us.ibm.com");
|
||||||
|
image.setArchitecture("i386");
|
||||||
|
image.setPlatform("Redhat Enterprise Linux (32-bit)/5.4");
|
||||||
|
image.setCreatedTime(1265647398000l);
|
||||||
|
image.setLocation(1);
|
||||||
|
image.setSupportedInstanceTypes(ImmutableSet.of("LARGE", "MEDIUM"));
|
||||||
|
// image.setProductCodes();
|
||||||
|
image
|
||||||
|
.setDocumentation("https://www-180.ibm.com/cloud/enterprise/beta/ram.ws/RAMSecure/artifact/{28C7B870-2C0A-003F-F886-B89F5B413B77}/1.0/GettingStarted.html");
|
||||||
|
image.setId(10005598);
|
||||||
|
image
|
||||||
|
.setDescription("Rational Requirements Composer helps teams define and use requirements effectively across the project lifecycle.");
|
||||||
|
|
||||||
|
Image compare = handler.apply(new HttpResponse(ParseImageFromJsonTest.class
|
||||||
|
.getResourceAsStream("/image.json")));
|
||||||
|
assertEquals(compare, image);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,97 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.ibmdev.functions;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.jclouds.http.HttpResponse;
|
||||||
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
|
import org.jclouds.ibmdev.domain.Image;
|
||||||
|
import org.testng.annotations.BeforeTest;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.inject.Guice;
|
||||||
|
import com.google.inject.Injector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests behavior of {@code ParseImagesFromJson}
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(groups = "unit", sequential = true, testName = "ibmdev.ParseImagesFromJsonTest")
|
||||||
|
public class ParseImagesFromJsonTest {
|
||||||
|
|
||||||
|
private ParseImagesFromJson handler;
|
||||||
|
|
||||||
|
@BeforeTest
|
||||||
|
protected void setUpInjector() throws IOException {
|
||||||
|
Injector injector = Guice.createInjector(new ParserModule());
|
||||||
|
handler = injector.getInstance(ParseImagesFromJson.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void test() {
|
||||||
|
Image image1 = new Image();
|
||||||
|
|
||||||
|
image1.setName("Rational Build Forge Agent");
|
||||||
|
image1
|
||||||
|
.setManifest("https://www-180.ibm.com/cloud/enterprise/beta/ram.ws/RAMSecure/artifact/{A233F5A0-05A5-F21D-3E92-3793B722DFBD}/1.0/parameters.xml");
|
||||||
|
image1.setState(1);
|
||||||
|
image1.setVisibility("PUBLIC");
|
||||||
|
image1.setOwner("SYSTEM");
|
||||||
|
image1.setArchitecture("i386");
|
||||||
|
image1.setPlatform("SUSE Linux Enterprise/10 SP2");
|
||||||
|
image1.setCreatedTime(1240632000000l);
|
||||||
|
image1.setLocation(1);
|
||||||
|
image1.setSupportedInstanceTypes(ImmutableSet.of("SMALL", "MEDIUM", "LARGE"));
|
||||||
|
image1.setProductCodes(ImmutableSet.of("fd2d0478b132490897526b9b4433a334"));
|
||||||
|
image1
|
||||||
|
.setDocumentation("https://www-180.ibm.com/cloud/enterprise/beta/ram.ws/RAMSecure/artifact/{A233F5A0-05A5-F21D-3E92-3793B722DFBD}/1.0/GettingStarted.html");
|
||||||
|
image1.setId(2);
|
||||||
|
image1
|
||||||
|
.setDescription("Rational Build Forge provides an adaptive process execution framework that automates, orchestrates, manages, and tracks all the processes between each handoff within the assembly line of software development, creating an automated software factory.");
|
||||||
|
|
||||||
|
Image image2 = new Image();
|
||||||
|
image2.setName("Rational Requirements Composer");
|
||||||
|
image2
|
||||||
|
.setManifest("https://www-180.ibm.com/cloud/enterprise/beta/ram.ws/RAMSecure/artifact/{28C7B870-2C0A-003F-F886-B89F5B413B77}/1.0/parameters.xml");
|
||||||
|
image2.setState(1);
|
||||||
|
image2.setVisibility("PUBLIC");
|
||||||
|
image2.setOwner("mutdosch@us.ibm.com");
|
||||||
|
image2.setArchitecture("i386");
|
||||||
|
image2.setPlatform("Redhat Enterprise Linux (32-bit)/5.4");
|
||||||
|
image2.setCreatedTime(1265647398869l);
|
||||||
|
image2.setLocation(1);
|
||||||
|
image2.setSupportedInstanceTypes(ImmutableSet.of("LARGE", "MEDIUM"));
|
||||||
|
// image.setProductCodes();
|
||||||
|
image2
|
||||||
|
.setDocumentation("https://www-180.ibm.com/cloud/enterprise/beta/ram.ws/RAMSecure/artifact/{28C7B870-2C0A-003F-F886-B89F5B413B77}/1.0/GettingStarted.html");
|
||||||
|
image2.setId(10005598);
|
||||||
|
image2
|
||||||
|
.setDescription("Rational Requirements Composer helps teams define and use requirements effectively across the project lifecycle.");
|
||||||
|
|
||||||
|
Set<? extends Image> compare = handler.apply(new HttpResponse(ParseImagesFromJsonTest.class
|
||||||
|
.getResourceAsStream("/images.json")));
|
||||||
|
assertEquals(compare, ImmutableSet.of(image2, image1));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
{"name":"Rational Requirements Composer",
|
||||||
|
"manifest":"https://www-180.ibm.com/cloud/enterprise/beta/ram.ws/RAMSecure/artifact/{28C7B870-2C0A-003F-F886-B89F5B413B77}/1.0/parameters.xml",
|
||||||
|
"state":1,
|
||||||
|
"visibility":"PUBLIC",
|
||||||
|
"owner":"mutdosch@us.ibm.com",
|
||||||
|
"architecture":"i386",
|
||||||
|
"platform":"Redhat Enterprise Linux (32-bit)/5.4",
|
||||||
|
"createdTime":1265647398000,
|
||||||
|
"location":"1",
|
||||||
|
"supportedInstanceTypes":["MEDIUM","LARGE"],
|
||||||
|
"productCodes":[""],
|
||||||
|
"documentation":"https://www-180.ibm.com/cloud/enterprise/beta/ram.ws/RAMSecure/artifact/{28C7B870-2C0A-003F-F886-B89F5B413B77}/1.0/GettingStarted.html",
|
||||||
|
"id":"10005598",
|
||||||
|
"description":"Rational Requirements Composer helps teams define and use requirements effectively across the project lifecycle."
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
{"images":
|
||||||
|
[
|
||||||
|
{ "name": "Rational Build Forge Agent",
|
||||||
|
"manifest":"https://www-180.ibm.com/cloud/enterprise/beta/ram.ws/RAMSecure/artifact/{A233F5A0-05A5-F21D-3E92-3793B722DFBD}/1.0/parameters.xml",
|
||||||
|
"state":1,
|
||||||
|
"visibility":"PUBLIC",
|
||||||
|
"owner":"SYSTEM",
|
||||||
|
"architecture":"i386",
|
||||||
|
"platform":"SUSE Linux Enterprise/10 SP2",
|
||||||
|
"createdTime":1240632000000,
|
||||||
|
"location":"1",
|
||||||
|
"supportedInstanceTypes":["SMALL","MEDIUM","LARGE"],
|
||||||
|
"productCodes":["fd2d0478b132490897526b9b4433a334"],
|
||||||
|
"documentation":"https://www-180.ibm.com/cloud/enterprise/beta/ram.ws/RAMSecure/artifact/{A233F5A0-05A5-F21D-3E92-3793B722DFBD}/1.0/GettingStarted.html",
|
||||||
|
"id":"2",
|
||||||
|
"description":"Rational Build Forge provides an adaptive process execution framework that automates, orchestrates, manages, and tracks all the processes between each handoff within the assembly line of software development, creating an automated software factory."
|
||||||
|
},
|
||||||
|
{ "name":"Rational Requirements Composer",
|
||||||
|
"manifest":"https://www-180.ibm.com/cloud/enterprise/beta/ram.ws/RAMSecure/artifact/{28C7B870-2C0A-003F-F886-B89F5B413B77}/1.0/parameters.xml",
|
||||||
|
"state":1,
|
||||||
|
"visibility":"PUBLIC",
|
||||||
|
"owner":"mutdosch@us.ibm.com",
|
||||||
|
"architecture":"i386",
|
||||||
|
"platform":"Redhat Enterprise Linux (32-bit)/5.4",
|
||||||
|
"createdTime":1265647398869,
|
||||||
|
"location":"1",
|
||||||
|
"supportedInstanceTypes":["MEDIUM","LARGE"],
|
||||||
|
"productCodes":[""],
|
||||||
|
"documentation":"https://www-180.ibm.com/cloud/enterprise/beta/ram.ws/RAMSecure/artifact/{28C7B870-2C0A-003F-F886-B89F5B413B77}/1.0/GettingStarted.html",
|
||||||
|
"id":"10005598",
|
||||||
|
"description":"Rational Requirements Composer helps teams define and use requirements effectively across the project lifecycle."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,142 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
|
||||||
|
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
|
||||||
|
====================================================================
|
||||||
|
Licensed 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.
|
||||||
|
====================================================================
|
||||||
|
|
||||||
|
-->
|
||||||
|
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
For more configuration infromation and examples see the Apache Log4j
|
||||||
|
website: http://logging.apache.org/log4j/
|
||||||
|
-->
|
||||||
|
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
|
||||||
|
debug="false">
|
||||||
|
|
||||||
|
<!-- A time/date based rolling appender -->
|
||||||
|
<appender name="COMPUTEFILE" class="org.apache.log4j.DailyRollingFileAppender">
|
||||||
|
<param name="File" value="target/test-data/jclouds-compute.log" />
|
||||||
|
<param name="Append" value="true" />
|
||||||
|
|
||||||
|
<!-- Rollover at midnight each day -->
|
||||||
|
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
||||||
|
|
||||||
|
<param name="Threshold" value="TRACE" />
|
||||||
|
|
||||||
|
<layout class="org.apache.log4j.PatternLayout">
|
||||||
|
<!-- The default pattern: Date Priority [Category] Message${symbol_escape}n -->
|
||||||
|
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The full pattern: Date MS Priority [Category]
|
||||||
|
(Thread:NDC) Message${symbol_escape}n <param name="ConversionPattern"
|
||||||
|
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
||||||
|
-->
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="ASYNCCOMPUTE" class="org.apache.log4j.AsyncAppender">
|
||||||
|
<appender-ref ref="COMPUTEFILE" />
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- A time/date based rolling appender -->
|
||||||
|
<appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
|
||||||
|
<param name="File" value="target/test-data/jclouds-wire.log" />
|
||||||
|
<param name="Append" value="true" />
|
||||||
|
|
||||||
|
<!-- Rollover at midnight each day -->
|
||||||
|
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
||||||
|
|
||||||
|
<param name="Threshold" value="TRACE" />
|
||||||
|
|
||||||
|
<layout class="org.apache.log4j.PatternLayout">
|
||||||
|
<!-- The default pattern: Date Priority [Category] Message${symbol_dollar}{symbol_escape}n -->
|
||||||
|
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The full pattern: Date MS Priority [Category] (Thread:NDC) Message${symbol_dollar}{symbol_escape}n
|
||||||
|
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x)
|
||||||
|
%m%n"/>
|
||||||
|
-->
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- A time/date based rolling appender -->
|
||||||
|
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
|
||||||
|
<param name="File" value="target/test-data/jclouds.log" />
|
||||||
|
<param name="Append" value="true" />
|
||||||
|
|
||||||
|
<!-- Rollover at midnight each day -->
|
||||||
|
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
||||||
|
|
||||||
|
<param name="Threshold" value="TRACE" />
|
||||||
|
|
||||||
|
<layout class="org.apache.log4j.PatternLayout">
|
||||||
|
<!-- The default pattern: Date Priority [Category] Message${symbol_dollar}{symbol_escape}n -->
|
||||||
|
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The full pattern: Date MS Priority [Category] (Thread:NDC) Message${symbol_dollar}{symbol_escape}n
|
||||||
|
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x)
|
||||||
|
%m%n"/>
|
||||||
|
-->
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
|
||||||
|
<appender-ref ref="FILE" />
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
|
||||||
|
<appender-ref ref="WIREFILE" />
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- ================ -->
|
||||||
|
<!-- Limit categories -->
|
||||||
|
<!-- ================ -->
|
||||||
|
|
||||||
|
<category name="org.jclouds">
|
||||||
|
<priority value="DEBUG" />
|
||||||
|
<appender-ref ref="ASYNC" />
|
||||||
|
</category>
|
||||||
|
|
||||||
|
<category name="jclouds.headers">
|
||||||
|
<priority value="DEBUG" />
|
||||||
|
<appender-ref ref="ASYNCWIRE" />
|
||||||
|
</category>
|
||||||
|
|
||||||
|
<category name="jclouds.wire">
|
||||||
|
<priority value="DEBUG" />
|
||||||
|
<appender-ref ref="ASYNCWIRE" />
|
||||||
|
</category>
|
||||||
|
|
||||||
|
<category name="jclouds.compute">
|
||||||
|
<priority value="TRACE" />
|
||||||
|
<appender-ref ref="ASYNCCOMPUTE" />
|
||||||
|
</category>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ======================= -->
|
||||||
|
<!-- Setup the Root category -->
|
||||||
|
<!-- ======================= -->
|
||||||
|
|
||||||
|
<root>
|
||||||
|
<priority value="WARN" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</log4j:configuration>
|
Loading…
Reference in New Issue