added uri factory method to context factory archaetype

This commit is contained in:
Adrian Cole 2010-06-01 16:32:31 -07:00
parent e4e47748d4
commit 66d6326dd9
1 changed files with 9 additions and 20 deletions

View File

@ -1,27 +1,9 @@
/**
*
* 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.
* ====================================================================
*/
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
/**
*
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* 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;
@ -75,6 +58,12 @@ public class ${providerName}ContextFactory {
.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();