diff --git a/README.txt b/README.txt
index 9a7f6fba99..7ad2d21887 100644
--- a/README.txt
+++ b/README.txt
@@ -39,8 +39,8 @@ our blobstore api supports: s3, rackspace, azure, atmos online, att synaptic,
* note * the pom dependency org.jclouds/jclouds-allblobstore gives you access to
to all of these providers
-we also have rest clients for: chef, opscodeplatform, twitter, as well a number of features
- in the sandbox
+we also have support for: ibmdev, mezeo, nirvanix, boxdotnet, as well a number of features
+ the sandbox
If you want access to all jclouds components, include the maven dependency org.jclouds/jclouds-all
diff --git a/all/pom.xml b/all/pom.xml
index 2e6577c690..51f0aab3ea 100644
--- a/all/pom.xml
+++ b/all/pom.xml
@@ -39,10 +39,5 @@
jclouds-allblobstore
${project.version}
-
- ${project.groupId}
- jclouds-twitter
- ${project.version}
-
diff --git a/archetypes/compute-service-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetypes/compute-service-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
index 989b4d6648..534c896390 100644
--- a/archetypes/compute-service-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/archetypes/compute-service-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -32,8 +32,8 @@
-
-
+
+
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/pom.xml b/archetypes/json-client-archetype/src/main/resources/archetype-resources/pom.xml
deleted file mode 100644
index 2efa11e0a5..0000000000
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/pom.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-#set( $lcaseProviderName = ${providerName.toLowerCase()} )
-#set( $symbol_dollar = '$' )
-
-
-
- 4.0.0
-
- org.jclouds
- jclouds-project
- 1.0-SNAPSHOT
- ../project/pom.xml
-
- ${groupId}
- jclouds-${artifactId}
- jclouds ${providerName} core
- jclouds components to access ${providerName}
-
-
- scm:svn:http://jclouds.googlecode.com/svn/trunk/${lcaseProviderName}
- scm:svn:https://jclouds.googlecode.com/svn/trunk/${lcaseProviderName}
- http://jclouds.googlecode.com/svn/trunk/${lcaseProviderName}
-
-
-
-
-
- jclouds-googlecode-deploy
- http://jclouds.googlecode.com/svn/repo
-
-
- jclouds-rimu-snapshots-nexus
- https://oss.sonatype.org/content/repositories/snapshots
-
- true
-
-
-
-
-
- ${providerAccount}
- ${providerKey}
-
-
-
- ${symbol_dollar}{project.groupId}
- jclouds-core
- ${symbol_dollar}{project.version}
-
-
- ${symbol_dollar}{project.groupId}
- jclouds-core
- ${symbol_dollar}{project.version}
- test-jar
- test
-
-
- log4j
- log4j
- 1.2.14
- test
-
-
- ${symbol_dollar}{project.groupId}
- jclouds-log4j
- ${symbol_dollar}{project.version}
- test
-
-
-
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__.java b/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__.java
deleted file mode 100644
index f83271f6b7..0000000000
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__.java
+++ /dev/null
@@ -1,42 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-/**
- *
- * Copyright (C) 2009 Cloud Conscious, LLC.
- *
- * ====================================================================
- * 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 ${package};
-
-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 ${providerName} resource.
- *
- * @author ${author}
- *
- */
-@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
-@Qualifier
-public @interface ${providerName} {
-
-}
\ No newline at end of file
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__ContextBuilder.java b/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__ContextBuilder.java
deleted file mode 100644
index 7a0f22b88c..0000000000
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__ContextBuilder.java
+++ /dev/null
@@ -1,66 +0,0 @@
-#set( $ucaseProviderName = ${providerName.toUpperCase()} )
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-/**
- *
- * Copyright (C) 2010 Cloud Conscious, LLC.
- *
- * ====================================================================
- * 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 ${package};
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.jclouds.rest.RestContextBuilder;
-import ${package}.${providerName}AsyncClient;
-import ${package}.${providerName}Client;
-
-import ${package}.config.${providerName}ContextModule;
-import ${package}.config.${providerName}RestClientModule;
-import ${package}.reference.${providerName}Constants;
-
-import com.google.inject.Module;
-
-/**
- *
- * @author ${author}
- */
-public class ${providerName}ContextBuilder extends RestContextBuilder<${providerName}Client, ${providerName}AsyncClient> {
-
- public ${providerName}ContextBuilder(String providerName, Properties props) {
- super(providerName, ${providerName}Client.class, ${providerName}AsyncClient.class, props);
- checkNotNull(properties.getProperty(${providerName}Constants.PROPERTY_${ucaseProviderName}_USER));
- checkNotNull(properties.getProperty(${providerName}Constants.PROPERTY_${ucaseProviderName}_PASSWORD));
- }
-
- protected void addClientModule(List modules) {
- modules.add(new ${providerName}RestClientModule());
- }
-
- @Override
- protected void addContextModule(String providerName, List modules) {
- modules.add(new ${providerName}ContextModule(providerName));
- }
-
-}
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__ContextFactory.java b/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__ContextFactory.java
deleted file mode 100644
index dbd72ed404..0000000000
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__ContextFactory.java
+++ /dev/null
@@ -1,72 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-/**
- *
- * Copyright (C) 2010 Cloud Conscious, LLC.
- *
- * ====================================================================
- * 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 ${package};
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
-import org.jclouds.logging.jdk.config.JDKLoggingModule;
-import org.jclouds.rest.RestContext;
-
-import com.google.inject.Module;
-
-/**
- * Creates {@link RestContext} for {@link ${providerName}Client} instances based on the most commonly
- * requested arguments.
- *
- * Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
- *
- *
- * If no Module
s are specified, the default {@link JDKLoggingModule logging} and
- * {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed.
- *
- * @author ${author}
- * @see RestContext
- * @see ${providerName}Client
- * @see ${providerName}AsyncClient
- */
-public class ${providerName}ContextFactory {
-
- public static RestContext<${providerName}Client, ${providerName}AsyncClient> createContext(String user, String password,
- Module... modules) {
- return new ${providerName}ContextBuilder("${artifactId}", new ${providerName}PropertiesBuilder(user, password).build())
- .withModules(modules).buildContext();
- }
-
- public static RestContext<${providerName}Client, ${providerName}AsyncClient> createContext(URI endpoint, String user, String password,
- Module... modules) {
- return new ${providerName}ContextBuilder("${artifactId}", new ${providerName}PropertiesBuilder(user, password).withEndpoint(endpoint).build())
- .withModules(modules).buildContext();
- }
-
- public static RestContext<${providerName}Client, ${providerName}AsyncClient> createContext(Properties properties, Module... modules) {
- return new ${providerName}ContextBuilder("${artifactId}", new ${providerName}PropertiesBuilder(properties).build())
- .withModules(modules).buildContext();
- }
-
-}
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__PropertiesBuilder.java b/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__PropertiesBuilder.java
deleted file mode 100644
index 4bd7d58f4e..0000000000
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__PropertiesBuilder.java
+++ /dev/null
@@ -1,73 +0,0 @@
-#set( $ucaseProviderName = ${providerName.toUpperCase()} )
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-/**
- *
- * Copyright (C) 2010 Cloud Conscious, LLC.
- *
- * ====================================================================
- * 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 ${package};
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static ${package}.reference.${providerName}Constants.PROPERTY_${ucaseProviderName}_ENDPOINT;
-import static ${package}.reference.${providerName}Constants.PROPERTY_${ucaseProviderName}_PASSWORD;
-import static ${package}.reference.${providerName}Constants.PROPERTY_${ucaseProviderName}_USER;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.PropertiesBuilder;
-
-/**
- * Builds properties used in ${providerName} Clients
- *
- * @author ${author}
- */
-public class ${providerName}PropertiesBuilder extends PropertiesBuilder {
- @Override
- protected Properties defaultProperties() {
- Properties properties = super.defaultProperties();
- properties.setProperty(PROPERTY_${ucaseProviderName}_ENDPOINT, "${providerEndpoint}");
- return properties;
- }
-
- public ${providerName}PropertiesBuilder(Properties properties) {
- super(properties);
- }
-
- public ${providerName}PropertiesBuilder(String id, String secret) {
- super();
- withCredentials(id, secret);
- }
-
- public ${providerName}PropertiesBuilder withCredentials(String id, String secret) {
- properties.setProperty(PROPERTY_${ucaseProviderName}_USER, checkNotNull(id, "user"));
- properties.setProperty(PROPERTY_${ucaseProviderName}_PASSWORD, checkNotNull(secret, "password"));
- return this;
- }
-
- public ${providerName}PropertiesBuilder withEndpoint(URI endpoint) {
- properties.setProperty(PROPERTY_${ucaseProviderName}_ENDPOINT, checkNotNull(endpoint, "endpoint")
- .toString());
- return this;
- }
-}
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/config/__providerName__ContextModule.java b/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/config/__providerName__ContextModule.java
deleted file mode 100644
index 57bec14654..0000000000
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/config/__providerName__ContextModule.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- *
- * Copyright (C) 2010 Cloud Conscious, LLC.
- *
- * ====================================================================
- * 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.
- * ====================================================================
- */
-
-#set( $ucaseProviderName = ${providerName.toUpperCase()} )
-package ${package}.config;
-
-import java.net.URI;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.lifecycle.Closer;
-import org.jclouds.rest.RestContext;
-import org.jclouds.rest.internal.RestContextImpl;
-import ${package}.${providerName};
-import ${package}.${providerName}AsyncClient;
-import ${package}.${providerName}Client;
-import ${package}.reference.${providerName}Constants;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-
-/**
- * Configures the ${providerName} connection, including logging and http transport.
- *
- * @author ${author}
- */
-public class ${providerName}ContextModule extends AbstractModule {
-
- public ${providerName}ContextModule(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<${providerName}Client, ${providerName}AsyncClient> provideContext(Closer closer, ${providerName}AsyncClient asyncApi,
- ${providerName}Client syncApi, @${providerName} URI endPoint, @Named(${providerName}Constants.PROPERTY_${ucaseProviderName}_USER) String identity) {
- return new RestContextImpl<${providerName}Client, ${providerName}AsyncClient>(closer, asyncApi, syncApi, endPoint, identity);
- }
-
-}
\ No newline at end of file
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/config/__providerName__RestClientModule.java b/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/config/__providerName__RestClientModule.java
deleted file mode 100644
index ffb80e1ca6..0000000000
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/config/__providerName__RestClientModule.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- *
- * Copyright (C) 2010 Cloud Conscious, LLC.
- *
- * ====================================================================
- * 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.
- * ====================================================================
- */
-
-#set( $ucaseProviderName = ${providerName.toUpperCase()} )
-package ${package}.config;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.RequiresHttp;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.config.RestClientModule;
-import org.jclouds.crypto.Crypto;
-
-import ${package}.${providerName};
-import ${package}.${providerName}Client;
-import ${package}.${providerName}AsyncClient;
-import ${package}.reference.${providerName}Constants;
-import ${package}.handlers.${providerName}ErrorHandler;
-
-import com.google.inject.Provides;
-
-/**
- * Configures the ${providerName} connection.
- *
- * @author ${author}
- */
-@RequiresHttp
-@ConfiguresRestClient
-public class ${providerName}RestClientModule extends
- RestClientModule<${providerName}Client, ${providerName}AsyncClient> {
-
- public ${providerName}RestClientModule() {
- super(${providerName}Client.class, ${providerName}AsyncClient.class);
- }
-
- @Provides
- @Singleton
- public BasicAuthentication provideBasicAuthentication(
- @Named(${providerName}Constants.PROPERTY_${ucaseProviderName}_USER) String user,
- @Named(${providerName}Constants.PROPERTY_${ucaseProviderName}_PASSWORD) String password,
- Crypto crypto)
- throws UnsupportedEncodingException {
- return new BasicAuthentication(user, password, crypto);
- }
-
- @Provides
- @Singleton
- @${providerName}
- protected URI provideURI(@Named(${providerName}Constants.PROPERTY_${ucaseProviderName}_ENDPOINT) String endpoint) {
- return URI.create(endpoint);
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(
- ${providerName}ErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(
- ${providerName}ErrorHandler.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(
- ${providerName}ErrorHandler.class);
- }
-
- @Override
- protected void bindRetryHandlers() {
- // TODO
- }
-
-}
\ No newline at end of file
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/handlers/__providerName__ErrorHandler.java b/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/handlers/__providerName__ErrorHandler.java
deleted file mode 100644
index 81828ee43d..0000000000
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/handlers/__providerName__ErrorHandler.java
+++ /dev/null
@@ -1,92 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-/**
- *
- * Copyright (C) 2009 Cloud Conscious, LLC.
- *
- * ====================================================================
- * 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 ${package}.handlers;
-
-import java.io.IOException;
-
-import javax.annotation.Resource;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.logging.Logger;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.jclouds.util.Utils;
-
-import com.google.common.base.Throwables;
-import com.google.common.io.Closeables;
-
-/**
- * This will parse and set an appropriate exception on the command object.
- *
- * @author Adrian Cole
- *
- */
-@Singleton
-public class ${providerName}ErrorHandler implements HttpErrorHandler {
- @Resource
- protected Logger logger = Logger.NULL;
-
- public void handleError(HttpCommand command, HttpResponse response) {
- // it is important to always read fully and close streams
- String message = parseMessage(response);
- Exception exception = message != null ? new HttpResponseException(command, response, message)
- : new HttpResponseException(command, response);
- try {
- message = message != null ? message : String.format("%s -> %s", command.getRequest()
- .getRequestLine(), response.getStatusLine());
- switch (response.getStatusCode()) {
- case 401:
- case 403:
- exception = new AuthorizationException(message, exception);
- break;
- case 404:
- if (!command.getRequest().getMethod().equals("DELETE")) {
- exception = new ResourceNotFoundException(message, exception);
- }
- break;
- }
- } finally {
- Closeables.closeQuietly(response.getContent());
- command.setException(exception);
- }
- }
-
- public String parseMessage(HttpResponse response) {
- if (response.getContent() == null)
- return null;
- try {
- return Utils.toStringAndClose(response.getContent());
- } catch (IOException e) {
- throw new RuntimeException(e);
- } finally {
- try {
- response.getContent().close();
- } catch (IOException e) {
- Throwables.propagate(e);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/reference/__providerName__Constants.java b/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/reference/__providerName__Constants.java
deleted file mode 100644
index 2e5967ec9f..0000000000
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/reference/__providerName__Constants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- * Copyright (C) 2010 Cloud Conscious, LLC.
- *
- * ====================================================================
- * 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.
- * ====================================================================
- */
-
-#set( $lcaseProviderName = ${providerName.toLowerCase()} )
-#set( $ucaseProviderName = ${providerName.toUpperCase()} )
-package ${package}.reference;
-
-/**
- * Configuration properties and constants used in ${providerName} connections.
- *
- * @author ${author}
- */
-public interface ${providerName}Constants {
- public static final String PROPERTY_${ucaseProviderName}_ENDPOINT = "jclouds.${lcaseProviderName}.endpoint";
- public static final String PROPERTY_${ucaseProviderName}_USER = "jclouds.${lcaseProviderName}.user";
- public static final String PROPERTY_${ucaseProviderName}_PASSWORD = "jclouds.${lcaseProviderName}.password";
-}
diff --git a/archetypes/pom.xml b/archetypes/pom.xml
index 1cde673547..b0fd181e10 100644
--- a/archetypes/pom.xml
+++ b/archetypes/pom.xml
@@ -32,7 +32,7 @@
pom
jclouds Maven archetypes
- json-client-archetype
+ rest-client-archetype
compute-service-archetype
diff --git a/archetypes/json-client-archetype/pom.xml b/archetypes/rest-client-archetype/pom.xml
similarity index 91%
rename from archetypes/json-client-archetype/pom.xml
rename to archetypes/rest-client-archetype/pom.xml
index 6ecb274b36..5def0a3240 100644
--- a/archetypes/json-client-archetype/pom.xml
+++ b/archetypes/rest-client-archetype/pom.xml
@@ -28,9 +28,9 @@
jclouds-archetypes
1.0-SNAPSHOT
- jclouds-json-client-archetype
- jclouds JSON client archetype
- Maven archetype for a provider of a JSON-speaking service
+ jclouds-rest-client-archetype
+ jclouds rest client archetype
+ Maven archetype for a provider of a rest-speaking service
maven-archetype
diff --git a/archetypes/json-client-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetypes/rest-client-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
similarity index 90%
rename from archetypes/json-client-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
rename to archetypes/rest-client-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
index c1e4697fdb..fbec7acbec 100644
--- a/archetypes/json-client-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/archetypes/rest-client-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -19,7 +19,7 @@
====================================================================
-->
-
+
org.jclouds
@@ -32,8 +32,9 @@
-
-
+
+
+
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/.gitignore b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/.gitignore
similarity index 100%
rename from archetypes/json-client-archetype/src/main/resources/archetype-resources/.gitignore
rename to archetypes/rest-client-archetype/src/main/resources/archetype-resources/.gitignore
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/README.txt b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/README.txt
similarity index 88%
rename from archetypes/json-client-archetype/src/main/resources/archetype-resources/README.txt
rename to archetypes/rest-client-archetype/src/main/resources/archetype-resources/README.txt
index 6e8f252495..d67da0edb4 100644
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/README.txt
+++ b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/README.txt
@@ -1,8 +1,8 @@
In this module, you can run just unit tests, or run tests that connect directly to the service. To run against the service, you'll need to specify the maven profile live.
When live is enabled, any tests that have "LiveTest" suffix will be run during the integration-test phase. In order for this to operate, you must specify the following
properties:
- * jclouds.test.account
- * jclouds.test.key
+ * test.${lcaseProviderName}.identity
+ * test.${lcaseProviderName}.credential
Note that this module is intentionally incomplete. You should global replace and create your own client from this example. Make sure that you use tests propertly. For
example, the test ending in *AsyncClientTest will help ensure that your annotations parse in the way you expect.
diff --git a/archetypes/rest-client-archetype/src/main/resources/archetype-resources/pom.xml b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000000..0f67f4507b
--- /dev/null
+++ b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,141 @@
+
+#set( $lcaseProviderName = ${providerName.toLowerCase()} )
+#set(
+$symbol_dollar = '$' )
+
+
+
+ 4.0.0
+
+ org.jclouds
+ jclouds-project
+ 1.0-SNAPSHOT
+ ../project/pom.xml
+
+ ${groupId}
+ jclouds-${artifactId}
+ jclouds ${providerName} core
+ jclouds components to access ${providerName}
+
+
+ scm:git:git@github.com:jclouds/jclouds.git
+ scm:git:git@github.com:jclouds/jclouds.git
+ http://github.com/jclouds/jclouds/tree/master/${lcaseProviderName}
+
+
+
+
+
+ jclouds-googlecode-deploy
+ http://jclouds.googlecode.com/svn/repo
+
+ false
+
+
+
+ jclouds-rimu-snapshots-nexus
+ https://oss.sonatype.org/content/repositories/snapshots
+
+ true
+
+
+
+
+
+ ${providerIdentity}
+ ${providerCredential}
+ ${providerApiVersion}
+ ${providerEndpoint}
+
+
+
+ ${symbol_dollar}{project.groupId}
+ jclouds-core
+ ${symbol_dollar}{project.version}
+
+
+ ${symbol_dollar}{project.groupId}
+ jclouds-core
+ ${symbol_dollar}{project.version}
+ test-jar
+ test
+
+
+ log4j
+ log4j
+ 1.2.14
+ test
+
+
+ ${symbol_dollar}{project.groupId}
+ jclouds-log4j
+ ${symbol_dollar}{project.version}
+ test
+
+
+
+
+ live
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ integration
+ integration-test
+
+ test
+
+
+
+
+ test.${lcaseProviderName}.identity
+ \$\{test.${lcaseProviderName}.identity\}
+
+
+ test.${lcaseProviderName}.credential
+ \$\{test.${lcaseProviderName}.credential\}
+
+
+ test.${lcaseProviderName}.endpoint
+ \$\{test.${lcaseProviderName}.endpoint\}
+
+
+ test.${lcaseProviderName}.apiversion
+ \$\{test.${lcaseProviderName}.apiversion\}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__AsyncClient.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__AsyncClient.java
similarity index 90%
rename from archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__AsyncClient.java
rename to archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__AsyncClient.java
index a90c112722..e951e69693 100644
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__AsyncClient.java
+++ b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__AsyncClient.java
@@ -35,9 +35,9 @@ import javax.ws.rs.core.MediaType;
import org.jclouds.http.filters.BasicAuthentication;
import ${package}.${providerName}Client;
-import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
@@ -51,10 +51,10 @@ import com.google.common.util.concurrent.ListenableFuture;
* @see
* @author ${author}
*/
-@Endpoint(${providerName}.class)
@RequestFilters(BasicAuthentication.class)
-@Consumes(MediaType.APPLICATION_JSON)
public interface ${providerName}AsyncClient {
+ public static final String API_VERSION = "${providerApiVersion}";
+
/*
* TODO: define interface methods for ${providerName}
*/
@@ -64,6 +64,8 @@ public interface ${providerName}AsyncClient {
*/
@GET
@Path("/items")
+ @Consumes(MediaType.TEXT_PLAIN)
+ @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture list();
/**
@@ -71,6 +73,7 @@ public interface ${providerName}AsyncClient {
*/
@GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
+ @Consumes(MediaType.TEXT_PLAIN)
@Path("/items/{itemId}")
ListenableFuture get(@PathParam("itemId") long id);
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__Client.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__Client.java
similarity index 100%
rename from archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__Client.java
rename to archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__Client.java
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/test/java/__providerName__AsyncClientTest.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/__providerName__AsyncClientTest.java
similarity index 54%
rename from archetypes/json-client-archetype/src/main/resources/archetype-resources/src/test/java/__providerName__AsyncClientTest.java
rename to archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/__providerName__AsyncClientTest.java
index 448e25410d..9c63707ccb 100644
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/test/java/__providerName__AsyncClientTest.java
+++ b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/__providerName__AsyncClientTest.java
@@ -27,27 +27,29 @@
*/
package ${package};
+import static org.jclouds.rest.RestContextFactory.contextSpec;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.lang.reflect.Method;
-import ${package}.config.${providerName}RestClientModule;
+import org.jclouds.http.HttpRequest;
import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.http.functions.CloseContentAndReturn;
-import org.jclouds.http.functions.ReturnStringIf200;
-import org.jclouds.logging.config.NullLoggingModule;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.http.functions.ReturnStringIf2xx;
import org.jclouds.rest.RestClientTest;
+import org.jclouds.rest.RestContextFactory.ContextSpec;
+import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.jclouds.rest.internal.RestAnnotationProcessor;
+import ${package}.${providerName}AsyncClient;
+import ${package}.${providerName}Client;
import org.testng.annotations.Test;
import com.google.common.collect.Iterables;
-import com.google.inject.Module;
import com.google.inject.TypeLiteral;
-import com.google.inject.name.Names;
/**
* Tests annotation parsing of {@code ${providerName}AsyncClient}
@@ -60,69 +62,66 @@ public class ${providerName}AsyncClientTest extends RestClientTest<${providerNam
public void testList() throws SecurityException, NoSuchMethodException, IOException {
Method method = ${providerName}AsyncClient.class.getMethod("list");
- GeneratedHttpRequest<${providerName}AsyncClient> httpRequest = processor.createRequest(method);
+ GeneratedHttpRequest<${providerName}AsyncClient> request = processor.createRequest(method);
- assertRequestLineEquals(httpRequest, "GET ${providerEndpoint}/items HTTP/1.1");
- assertHeadersEqual(httpRequest, "Accept: application/json\n");
- assertPayloadEquals(httpRequest, null);
+ assertRequestLineEquals(request, "GET ${providerEndpoint}/items HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: text/plain\n");
+ assertPayloadEquals(request, null, null, false);
// now make sure request filters apply by replaying
- Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
- Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
+ Iterables.getOnlyElement(request.getFilters()).filter(request);
+ Iterables.getOnlyElement(request.getFilters()).filter(request);
- assertRequestLineEquals(httpRequest, "GET ${providerEndpoint}/items HTTP/1.1");
+ assertRequestLineEquals(request, "GET ${providerEndpoint}/items HTTP/1.1");
// for example, using basic authentication, we should get "only one" header
- assertHeadersEqual(httpRequest, "Accept: application/json\nAuthorization: Basic dXNlcjprZXk=\n");
- assertPayloadEquals(httpRequest, null);
+ assertNonPayloadHeadersEqual(request, "Accept: text/plain\nAuthorization: Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==\n");
+ assertPayloadEquals(request, null, null, false);
- // TODO: insert expected response class, which probably extends ParseJson
- assertResponseParserClassEquals(method, httpRequest, ReturnStringIf200.class);
+ assertResponseParserClassEquals(method, request, ReturnStringIf2xx.class);
assertSaxResponseParserClassEquals(method, null);
- assertExceptionParserClassEquals(method, null);
+ assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
- checkFilters(httpRequest);
+ checkFilters(request);
}
public void testGet() throws SecurityException, NoSuchMethodException, IOException {
Method method = ${providerName}AsyncClient.class.getMethod("get", long.class);
- GeneratedHttpRequest<${providerName}AsyncClient> httpRequest = processor.createRequest(method, 1);
+ GeneratedHttpRequest<${providerName}AsyncClient> request = processor.createRequest(method, 1);
- assertRequestLineEquals(httpRequest, "GET ${providerEndpoint}/items/1 HTTP/1.1");
- assertHeadersEqual(httpRequest, "Accept: application/json\n");
- assertPayloadEquals(httpRequest, null);
+ assertRequestLineEquals(request, "GET ${providerEndpoint}/items/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: text/plain\n");
+ assertPayloadEquals(request, null, null, false);
- // TODO: insert expected response class, which probably extends ParseJson
- assertResponseParserClassEquals(method, httpRequest, ReturnStringIf200.class);
+ assertResponseParserClassEquals(method, request, ReturnStringIf2xx.class);
assertSaxResponseParserClassEquals(method, null);
- // note that get methods should convert 404's to null
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
- checkFilters(httpRequest);
+ checkFilters(request);
}
public void testDelete() throws SecurityException, NoSuchMethodException, IOException {
Method method = ${providerName}AsyncClient.class.getMethod("delete", long.class);
- GeneratedHttpRequest<${providerName}AsyncClient> httpRequest = processor.createRequest(
+ GeneratedHttpRequest<${providerName}AsyncClient> request = processor.createRequest(
method, 1);
- assertRequestLineEquals(httpRequest,
- "DELETE ${providerEndpoint}/items/1 HTTP/1.1");
- assertHeadersEqual(httpRequest, "Accept: application/json\n");
- assertPayloadEquals(httpRequest, null);
+ assertRequestLineEquals(request, "DELETE ${providerEndpoint}/items/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
- assertResponseParserClassEquals(method, httpRequest, CloseContentAndReturn.class);
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
- checkFilters(httpRequest);
+ checkFilters(request);
}
+
@Override
- protected void checkFilters(GeneratedHttpRequest<${providerName}AsyncClient> httpRequest) {
- assertEquals(httpRequest.getFilters().size(), 1);
- assertEquals(httpRequest.getFilters().get(0).getClass(), BasicAuthentication.class);
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 1);
+ assertEquals(request.getFilters().get(0).getClass(), BasicAuthentication.class);
}
@Override
@@ -132,14 +131,8 @@ public class ${providerName}AsyncClientTest extends RestClientTest<${providerNam
}
@Override
- protected Module createModule() {
- return new ${providerName}RestClientModule() {
- @Override
- protected void configure() {
- Names.bindProperties(binder(), new ${providerName}PropertiesBuilder("user", "key").build());
- install(new NullLoggingModule());
- super.configure();
- }
- };
+ public ContextSpec<${providerName}Client, ${providerName}AsyncClient> createContextSpec() {
+ return contextSpec("${lcaseProviderName}", "${providerEndpoint}", "${providerApiVersion}", "identity", "credential", ${providerName}Client.class,
+ ${providerName}AsyncClient.class);
}
}
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/test/java/__providerName__ClientLiveTest.java b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/__providerName__ClientLiveTest.java
similarity index 58%
rename from archetypes/json-client-archetype/src/main/resources/archetype-resources/src/test/java/__providerName__ClientLiveTest.java
rename to archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/__providerName__ClientLiveTest.java
index 082e2462c9..7c8d9f4baf 100644
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/test/java/__providerName__ClientLiveTest.java
+++ b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/java/__providerName__ClientLiveTest.java
@@ -28,12 +28,19 @@
package ${package};
import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.rest.RestContextFactory.contextSpec;
+import static org.jclouds.rest.RestContextFactory.createContext;
import static org.testng.Assert.assertNotNull;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
+import org.jclouds.rest.RestContext;
+
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+
/**
* Tests behavior of {@code ${providerName}Client}
*
@@ -42,26 +49,36 @@ import org.testng.annotations.Test;
@Test(groups = "live", testName = "${lcaseProviderName}.${providerName}ClientLiveTest")
public class ${providerName}ClientLiveTest {
- private ${providerName}Client connection;
+ protected RestContext<${providerName}Client, ${providerName}AsyncClient> context;
+ protected String provider = "${lcaseProviderName}";
+ protected String identity;
+ protected String credential;
+ protected String endpoint;
+ protected String apiVersion;
+ protected void setupCredentials() {
+ identity = checkNotNull(System.getProperty("test.${lcaseProviderName}.identity"), "test.${lcaseProviderName}.identity");
+ credential = checkNotNull(System.getProperty("test.${lcaseProviderName}.credential"), "test.${lcaseProviderName}.credential");
+ endpoint = checkNotNull(System.getProperty("test.${lcaseProviderName}.endpoint"), "test.${lcaseProviderName}.endpoint");
+ apiVersion = checkNotNull(System.getProperty("test.${lcaseProviderName}.apiversion"), "test.${lcaseProviderName}.apiversion");
+ }
+
@BeforeGroups(groups = { "live" })
public void setupClient() {
- String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
- String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
-
- connection = ${providerName}ContextFactory.createContext(identity, credential, new Log4JLoggingModule())
- .getApi();
+ setupCredentials();
+ context = createContext(contextSpec(provider, endpoint, apiVersion, identity, credential,
+ ${providerName}Client.class, ${providerName}AsyncClient.class), ImmutableSet. of(new Log4JLoggingModule()));
}
@Test
public void testList() throws Exception {
- String response = connection.list();
+ String response = context.getApi().list();
assertNotNull(response);
}
@Test
public void testGet() throws Exception {
- String response = connection.get(1l);
+ String response = context.getApi().get(1l);
assertNotNull(response);
}
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/test/resources/log4j.xml b/archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/log4j.xml
similarity index 100%
rename from archetypes/json-client-archetype/src/main/resources/archetype-resources/src/test/resources/log4j.xml
rename to archetypes/rest-client-archetype/src/main/resources/archetype-resources/src/test/resources/log4j.xml
diff --git a/demos/gae-tweetstore-spring/pom.xml b/demos/gae-tweetstore-spring/pom.xml
index 9233720d10..33825908e0 100644
--- a/demos/gae-tweetstore-spring/pom.xml
+++ b/demos/gae-tweetstore-spring/pom.xml
@@ -51,6 +51,11 @@
jclouds-blobstore
${project.version}
+
+ org.twitter4j
+ twitter4j-core
+ [2.1,)
+
${project.groupId}
jclouds-blobstore
@@ -77,11 +82,6 @@
1.2.14
test
-
- ${project.groupId}
- jclouds-twitter
- ${project.version}
-
${project.groupId}
jclouds-aws
diff --git a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java b/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java
index ca1f9f9692..cdfebf94a3 100644
--- a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java
+++ b/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/config/SpringServletConfig.java
@@ -41,8 +41,6 @@ import org.jclouds.demo.tweetstore.controller.AddTweetsController;
import org.jclouds.demo.tweetstore.controller.StoreTweetsController;
import org.jclouds.demo.tweetstore.functions.ServiceToStoredTweetStatuses;
import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
-import org.jclouds.rest.RestContextFactory;
-import org.jclouds.twitter.TwitterClient;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -52,6 +50,9 @@ import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.handler.SimpleServletHandlerAdapter;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
+import twitter4j.Twitter;
+import twitter4j.TwitterFactory;
+
import com.google.appengine.api.labs.taskqueue.Queue;
import com.google.appengine.api.labs.taskqueue.QueueFactory;
import com.google.appengine.api.labs.taskqueue.TaskOptions.Method;
@@ -74,7 +75,7 @@ public class SpringServletConfig extends LoggingConfig implements ServletConfigA
private ServletConfig servletConfig;
private Map providerTypeToBlobStoreMap;
- private TwitterClient twitterClient;
+ private Twitter twitterClient;
private String container;
@PostConstruct
@@ -88,24 +89,19 @@ public class SpringServletConfig extends LoggingConfig implements ServletConfigA
Set modules = ImmutableSet. of(googleModule);
// shared across all blobstores and used to retrieve tweets
try {
- twitterClient = (TwitterClient) new RestContextFactory().createContext("twitter", modules,
- props).getApi();
-
+ twitterClient = new TwitterFactory().getInstance(props.getProperty("twitter.identity"), props
+ .getProperty("credential"));
} catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("properties for twitter not configured properly in "
- + props.toString(), e);
+ throw new IllegalArgumentException("properties for twitter not configured properly in " + props.toString(), e);
}
// common namespace for storing tweets
- container = checkNotNull(props.getProperty(PROPERTY_TWEETSTORE_CONTAINER),
- PROPERTY_TWEETSTORE_CONTAINER);
+ container = checkNotNull(props.getProperty(PROPERTY_TWEETSTORE_CONTAINER), PROPERTY_TWEETSTORE_CONTAINER);
// instantiate and store references to all blobstores by provider name
providerTypeToBlobStoreMap = Maps.newHashMap();
for (String hint : Splitter.on(',').split(
- checkNotNull(props.getProperty(PROPERTY_BLOBSTORE_CONTEXTS),
- PROPERTY_BLOBSTORE_CONTEXTS))) {
- providerTypeToBlobStoreMap.put(hint, blobStoreContextFactory.createContext(hint, modules,
- props));
+ checkNotNull(props.getProperty(PROPERTY_BLOBSTORE_CONTEXTS), PROPERTY_BLOBSTORE_CONTEXTS))) {
+ providerTypeToBlobStoreMap.put(hint, blobStoreContextFactory.createContext(hint, modules, props));
}
// get a queue for submitting store tweet requests
@@ -114,16 +110,14 @@ public class SpringServletConfig extends LoggingConfig implements ServletConfigA
for (String name : providerTypeToBlobStoreMap.keySet()) {
queue.add(url("/store/do").header("context", name).method(Method.GET));
}
- logger.trace(
- "Members initialized. TwitterClient: '%s', container: '%s', provider types: '%s'",
- twitterClient, container, providerTypeToBlobStoreMap.keySet());
+ logger.trace("Members initialized. Twitter: '%s', container: '%s', provider types: '%s'", twitterClient,
+ container, providerTypeToBlobStoreMap.keySet());
}
private Properties loadJCloudsProperties() {
logger.trace("About to read properties from '%s'", "/WEB-INF/jclouds.properties");
Properties props = new Properties();
- InputStream input = servletConfig.getServletContext().getResourceAsStream(
- "/WEB-INF/jclouds.properties");
+ InputStream input = servletConfig.getServletContext().getResourceAsStream("/WEB-INF/jclouds.properties");
try {
props.load(input);
} catch (IOException e) {
@@ -137,8 +131,7 @@ public class SpringServletConfig extends LoggingConfig implements ServletConfigA
@Bean
public StoreTweetsController storeTweetsController() {
- StoreTweetsController controller = new StoreTweetsController(providerTypeToBlobStoreMap,
- container, twitterClient);
+ StoreTweetsController controller = new StoreTweetsController(providerTypeToBlobStoreMap, container, twitterClient);
injectServletConfig(controller);
return controller;
}
diff --git a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java b/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java
index 414014e20a..3621e659e6 100644
--- a/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java
+++ b/demos/gae-tweetstore-spring/src/main/java/org/jclouds/demo/tweetstore/controller/StoreTweetsController.java
@@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.io.IOException;
import java.util.Map;
-import java.util.Set;
import javax.annotation.Resource;
import javax.inject.Inject;
@@ -41,8 +40,9 @@ import org.jclouds.blobstore.domain.Blob;
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
import org.jclouds.logging.Logger;
import org.jclouds.rest.AuthorizationException;
-import org.jclouds.twitter.TwitterClient;
-import org.jclouds.twitter.domain.Status;
+
+import twitter4j.Status;
+import twitter4j.Twitter;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
@@ -75,7 +75,7 @@ public class StoreTweetsController extends HttpServlet {
private static final long serialVersionUID = 7215420527854203714L;
private final Map contexts;
- private final TwitterClient client;
+ private final Twitter client;
private final String container;
@Resource
@@ -84,18 +84,18 @@ public class StoreTweetsController extends HttpServlet {
@Inject
@VisibleForTesting
public StoreTweetsController(Map contexts,
- @Named(TweetStoreConstants.PROPERTY_TWEETSTORE_CONTAINER) String container, TwitterClient client) {
+ @Named(TweetStoreConstants.PROPERTY_TWEETSTORE_CONTAINER) String container, Twitter client) {
this.container = container;
this.contexts = contexts;
this.client = client;
}
@VisibleForTesting
- public void addMyTweets(String contextName, Set allAboutMe) {
+ public void addMyTweets(String contextName, Iterable responseList) {
BlobStoreContext context = checkNotNull(contexts.get(contextName), "no context for " + contextName + " in "
+ contexts.keySet());
BlobMap map = context.createBlobMap(container);
- for (Status status : allAboutMe) {
+ for (Status status : responseList) {
Blob blob = null;
try {
blob = new StatusToBlob(map).apply(status);
@@ -115,7 +115,7 @@ public class StoreTweetsController extends HttpServlet {
try {
String contextName = checkNotNull(request.getHeader("context"), "missing header context");
logger.info("retrieving tweets");
- addMyTweets(contextName, client.getMyMentions());
+ addMyTweets(contextName, client.getMentions());
logger.debug("done storing tweets");
response.setContentType(MediaType.TEXT_PLAIN);
response.getWriter().println("Done!");
diff --git a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java b/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java
index 75b665f84b..4687561ebd 100644
--- a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java
+++ b/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/controller/StoreTweetsControllerTest.java
@@ -19,13 +19,15 @@
package org.jclouds.demo.tweetstore.controller;
+import static org.easymock.EasyMock.expect;
import static org.easymock.classextension.EasyMock.createMock;
+import static org.easymock.classextension.EasyMock.replay;
+import static org.easymock.classextension.EasyMock.verify;
import static org.jclouds.util.Utils.toStringAndClose;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.util.Map;
-import java.util.SortedSet;
import java.util.Map.Entry;
import java.util.concurrent.ExecutionException;
@@ -34,13 +36,14 @@ import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
-import org.jclouds.twitter.TwitterClient;
-import org.jclouds.twitter.domain.Status;
-import org.jclouds.twitter.domain.User;
import org.testng.annotations.Test;
+import twitter4j.Status;
+import twitter4j.Twitter;
+import twitter4j.User;
+
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Sets;
/**
* Tests behavior of {@code StoreTweetsController}
@@ -50,8 +53,8 @@ import com.google.common.collect.Sets;
@Test(groups = "unit", testName = "tweetstore.StoreTweetsControllerTest")
public class StoreTweetsControllerTest {
- TwitterClient createTwitterClient() {
- return createMock(TwitterClient.class);
+ Twitter createTwitter() {
+ return createMock(Twitter.class);
}
Map createBlobStores() throws InterruptedException, ExecutionException {
@@ -66,35 +69,48 @@ public class StoreTweetsControllerTest {
public void testStoreTweets() throws IOException, InterruptedException, ExecutionException {
Map stores = createBlobStores();
- StoreTweetsController function = new StoreTweetsController(stores, "favo",
- createTwitterClient());
+ StoreTweetsController function = new StoreTweetsController(stores, "favo", createTwitter());
- SortedSet allAboutMe = Sets.newTreeSet();
- User frank = new User(1l, "frank");
- Status frankStatus = new Status(1l, frank, "I love beans!");
+ User frank = createMock(User.class);
+ expect(frank.getScreenName()).andReturn("frank").atLeastOnce();
- User jimmy = new User(2l, "jimmy");
- Status jimmyStatus = new Status(2l, jimmy, "cloud is king");
+ Status frankStatus = createMock(Status.class);
+ expect(frankStatus.getId()).andReturn(1l).atLeastOnce();
+ expect(frankStatus.getUser()).andReturn(frank).atLeastOnce();
+ expect(frankStatus.getText()).andReturn("I love beans!").atLeastOnce();
+
+ User jimmy = createMock(User.class);
+ expect(jimmy.getScreenName()).andReturn("jimmy").atLeastOnce();
- allAboutMe.add(frankStatus);
- allAboutMe.add(jimmyStatus);
+ Status jimmyStatus = createMock(Status.class);
+ expect(jimmyStatus.getId()).andReturn(2l).atLeastOnce();
+ expect(jimmyStatus.getUser()).andReturn(jimmy).atLeastOnce();
+ expect(jimmyStatus.getText()).andReturn("cloud is king").atLeastOnce();
- function.addMyTweets("test1", allAboutMe);
- function.addMyTweets("test2", allAboutMe);
+ replay(frank);
+ replay(frankStatus);
+ replay(jimmy);
+ replay(jimmyStatus);
+
+ function.addMyTweets("test1", ImmutableList.of(frankStatus, jimmyStatus));
+ function.addMyTweets("test2", ImmutableList.of(frankStatus, jimmyStatus));
+
+ verify(frank);
+ verify(frankStatus);
+ verify(jimmy);
+ verify(jimmyStatus);
for (Entry entry : stores.entrySet()) {
BlobMap map = entry.getValue().createBlobMap("favo");
Blob frankBlob = map.get("1");
assertEquals(frankBlob.getMetadata().getName(), "1");
- assertEquals(frankBlob.getMetadata().getUserMetadata()
- .get(TweetStoreConstants.SENDER_NAME), "frank");
+ assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
assertEquals(frankBlob.getMetadata().getContentType(), "text/plain");
assertEquals(toStringAndClose(frankBlob.getPayload().getInput()), "I love beans!");
Blob jimmyBlob = map.get("2");
assertEquals(jimmyBlob.getMetadata().getName(), "2");
- assertEquals(jimmyBlob.getMetadata().getUserMetadata()
- .get(TweetStoreConstants.SENDER_NAME), "jimmy");
+ assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
assertEquals(jimmyBlob.getMetadata().getContentType(), "text/plain");
assertEquals(toStringAndClose(jimmyBlob.getPayload().getInput()), "cloud is king");
}
diff --git a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java b/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java
index 1191c13242..79c9a43a4a 100644
--- a/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java
+++ b/demos/gae-tweetstore-spring/src/test/java/org/jclouds/demo/tweetstore/integration/TweetStoreLiveTest.java
@@ -21,7 +21,6 @@ package org.jclouds.demo.tweetstore.integration;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.demo.tweetstore.reference.TweetStoreConstants.PROPERTY_TWEETSTORE_CONTAINER;
-import static org.jclouds.rest.RestContextFactory.contextSpec;
import java.io.IOException;
import java.io.InputStream;
@@ -39,16 +38,17 @@ import org.jclouds.blobstore.BlobStoreContextFactory;
import org.jclouds.demo.tweetstore.config.SpringServletConfig;
import org.jclouds.demo.tweetstore.controller.StoreTweetsController;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
-import org.jclouds.rest.RestContext;
-import org.jclouds.rest.RestContextFactory;
-import org.jclouds.twitter.TwitterAsyncClient;
-import org.jclouds.twitter.TwitterClient;
-import org.jclouds.twitter.domain.Status;
import org.jclouds.util.Utils;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
+import twitter4j.ResponseList;
+import twitter4j.Status;
+import twitter4j.Twitter;
+import twitter4j.TwitterException;
+import twitter4j.TwitterFactory;
+
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
@@ -56,8 +56,8 @@ import com.google.common.collect.Maps;
import com.google.inject.Module;
/**
- * Starts up the Google App Engine for Java Development environment and deploys
- * an application which tests accesses twitter and blobstores.
+ * Starts up the Google App Engine for Java Development environment and deploys an application which
+ * tests accesses twitter and blobstores.
*
* @author Adrian Cole
*/
@@ -70,16 +70,16 @@ public class TweetStoreLiveTest {
private String container;
private static final String blobs = System.getProperty("jclouds.tweetstore.blobstores",
- "cloudfiles,googlestorage,s3,azureblob");
+ "cloudfiles,googlestorage,s3,azureblob");
private static final Iterable blobstores = Splitter.on(',').split(blobs);
private static final Properties props = new Properties();
@BeforeTest
- void clearAndCreateContainers() throws InterruptedException, ExecutionException, TimeoutException, IOException {
+ void clearAndCreateContainers() throws InterruptedException, ExecutionException, TimeoutException, IOException, TwitterException {
container = checkNotNull(System.getProperty(PROPERTY_TWEETSTORE_CONTAINER));
props.setProperty(PROPERTY_TWEETSTORE_CONTAINER, checkNotNull(System.getProperty(PROPERTY_TWEETSTORE_CONTAINER),
- PROPERTY_TWEETSTORE_CONTAINER));
+ PROPERTY_TWEETSTORE_CONTAINER));
props.setProperty(SpringServletConfig.PROPERTY_BLOBSTORE_CONTEXTS, Joiner.on(',').join(blobstores));
@@ -98,17 +98,17 @@ public class TweetStoreLiveTest {
contexts.put(provider, factory.createContext(provider, wiring, props));
}
- RestContext twitterContext = new RestContextFactory().createContext("twitter",
- wiring, props);
- StoreTweetsController controller = new StoreTweetsController(contexts, container, twitterContext.getApi());
+ Twitter client = new TwitterFactory().getInstance(props.getProperty("twitter.identity"), props
+ .getProperty("twitter.credential"));
+ StoreTweetsController controller = new StoreTweetsController(contexts, container, client);
- Set statuses = twitterContext.getApi().getMyMentions();
+ ResponseList statuses = client.getMentions();
boolean deleted = false;
for (BlobStoreContext context : contexts.values()) {
if (context.getBlobStore().containerExists(container)) {
System.err.printf("deleting container %s at %s%n", container, context.getProviderSpecificContext()
- .getEndpoint());
+ .getEndpoint());
context.getBlobStore().deleteContainer(container);
deleted = true;
}
@@ -119,7 +119,7 @@ public class TweetStoreLiveTest {
}
for (BlobStoreContext context : contexts.values()) {
System.err.printf("creating container %s at %s%n", container, context.getProviderSpecificContext()
- .getEndpoint());
+ .getEndpoint());
context.getBlobStore().createContainerInLocation(null, container);
}
if (deleted) {
@@ -134,19 +134,17 @@ public class TweetStoreLiveTest {
}
private void addConfigurationForTwitter(Properties props) {
- String twitterIdentity = checkNotNull(System.getProperty("twitter.identity"), "twitter.identity");
- String twitterCredential = checkNotNull(System.getProperty("twitter.credential"), "twitter.credential");
-
- props.putAll(RestContextFactory.toProperties(contextSpec("twitter", "http://twitter.com", "1", twitterIdentity,
- twitterCredential, TwitterClient.class, TwitterAsyncClient.class)));
+ props.setProperty("twitter.identity", checkNotNull(System.getProperty("twitter.identity"), "twitter.identity"));
+ props.setProperty("twitter.credential", checkNotNull(System.getProperty("twitter.credential"),
+ "twitter.credential"));
}
private void addCredentialsForBlobStores(Properties props) {
for (String provider : blobstores) {
props.setProperty(provider + ".identity", checkNotNull(System.getProperty(provider + ".identity"), provider
- + ".identity"));
+ + ".identity"));
props.setProperty(provider + ".credential", checkNotNull(System.getProperty(provider + ".credential"),
- provider + ".credential"));
+ provider + ".credential"));
}
}
diff --git a/demos/gae-tweetstore/pom.xml b/demos/gae-tweetstore/pom.xml
index 0cde8b8c4b..9f3a676c18 100644
--- a/demos/gae-tweetstore/pom.xml
+++ b/demos/gae-tweetstore/pom.xml
@@ -44,6 +44,11 @@
+
+ org.twitter4j
+ twitter4j-core
+ [2.1,)
+
${project.groupId}
jclouds-blobstore
@@ -75,11 +80,6 @@
1.2.14
test
-
- ${project.groupId}
- jclouds-twitter
- ${project.version}
-
${project.groupId}
jclouds-aws
diff --git a/demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/GuiceServletConfig.java b/demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/GuiceServletConfig.java
index de6913b92c..cbd5dd0538 100755
--- a/demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/GuiceServletConfig.java
+++ b/demos/gae-tweetstore/src/main/java/org/jclouds/demo/tweetstore/config/GuiceServletConfig.java
@@ -36,8 +36,9 @@ import org.jclouds.blobstore.BlobStoreContextFactory;
import org.jclouds.demo.tweetstore.controller.AddTweetsController;
import org.jclouds.demo.tweetstore.controller.StoreTweetsController;
import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
-import org.jclouds.rest.RestContextFactory;
-import org.jclouds.twitter.TwitterClient;
+
+import twitter4j.Twitter;
+import twitter4j.TwitterFactory;
import com.google.appengine.api.labs.taskqueue.Queue;
import com.google.appengine.api.labs.taskqueue.QueueFactory;
@@ -63,7 +64,7 @@ public class GuiceServletConfig extends GuiceServletContextListener {
public static final String PROPERTY_BLOBSTORE_CONTEXTS = "blobstore.contexts";
private Map providerTypeToBlobStoreMap;
- private TwitterClient twitterClient;
+ private Twitter twitterClient;
private String container;
@Override
@@ -77,24 +78,19 @@ public class GuiceServletConfig extends GuiceServletContextListener {
Set modules = ImmutableSet. of(googleModule);
// shared across all blobstores and used to retrieve tweets
try {
- twitterClient = (TwitterClient) new RestContextFactory().createContext("twitter", modules,
- props).getApi();
-
+ twitterClient = new TwitterFactory().getInstance(props.getProperty("twitter.identity"), props
+ .getProperty("credential"));
} catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("properties for twitter not configured properly in "
- + props.toString(), e);
+ throw new IllegalArgumentException("properties for twitter not configured properly in " + props.toString(), e);
}
// common namespace for storing tweets
- container = checkNotNull(props.getProperty(PROPERTY_TWEETSTORE_CONTAINER),
- PROPERTY_TWEETSTORE_CONTAINER);
+ container = checkNotNull(props.getProperty(PROPERTY_TWEETSTORE_CONTAINER), PROPERTY_TWEETSTORE_CONTAINER);
// instantiate and store references to all blobstores by provider name
providerTypeToBlobStoreMap = Maps.newHashMap();
for (String hint : Splitter.on(',').split(
- checkNotNull(props.getProperty(PROPERTY_BLOBSTORE_CONTEXTS),
- PROPERTY_BLOBSTORE_CONTEXTS))) {
- providerTypeToBlobStoreMap.put(hint, blobStoreContextFactory.createContext(hint, modules,
- props));
+ checkNotNull(props.getProperty(PROPERTY_BLOBSTORE_CONTEXTS), PROPERTY_BLOBSTORE_CONTEXTS))) {
+ providerTypeToBlobStoreMap.put(hint, blobStoreContextFactory.createContext(hint, modules, props));
}
// get a queue for submitting store tweet requests
@@ -108,8 +104,7 @@ public class GuiceServletConfig extends GuiceServletContextListener {
}
private Properties loadJCloudsProperties(ServletContextEvent servletContextEvent) {
- InputStream input = servletContextEvent.getServletContext().getResourceAsStream(
- "/WEB-INF/jclouds.properties");
+ InputStream input = servletContextEvent.getServletContext().getResourceAsStream("/WEB-INF/jclouds.properties");
Properties props = new Properties();
try {
props.load(input);
@@ -128,7 +123,7 @@ public class GuiceServletConfig extends GuiceServletContextListener {
protected void configureServlets() {
bind(new TypeLiteral