From 66d6326dd9947a13819d898a51856a669ad3ba42 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Tue, 1 Jun 2010 16:32:31 -0700 Subject: [PATCH] added uri factory method to context factory archaetype --- .../java/__providerName__ContextFactory.java | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) 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 index 5a388300be..e7368680ad 100644 --- 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 @@ -1,27 +1,9 @@ -/** - * - * 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. - * ==================================================================== - */ #set( $symbol_pound = '#' ) #set( $symbol_dollar = '$' ) #set( $symbol_escape = '\' ) /** * - * Copyright (C) 2009 Cloud Conscious, LLC. + * Copyright (C) 2010 Cloud Conscious, LLC. * * ==================================================================== * Licensed to the Apache Software Foundation (ASF) under one @@ -44,6 +26,7 @@ */ package ${package}; +import java.net.URI; import java.util.Properties; import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule; @@ -74,7 +57,13 @@ public class ${providerName}ContextFactory { return new ${providerName}ContextBuilder("${artifactId}", new ${providerName}PropertiesBuilder(user, password).build()) .withModules(modules).buildContext(); } - + + public static RestContext<${providerName}AsyncClient, ${providerName}Client> 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}AsyncClient, ${providerName}Client> createContext(Properties properties, Module... modules) { return new ${providerName}ContextBuilder("${artifactId}", new ${providerName}PropertiesBuilder(properties).build()) .withModules(modules).buildContext();