public class ClientFactory
extends java.lang.Object
| Constructor and Description |
|---|
ClientFactory() |
| Modifier and Type | Method and Description |
|---|---|
static com.netflix.client.IClient |
createNamedClient(java.lang.String name,
java.lang.Class<? extends com.netflix.client.config.IClientConfig> configClass)
Creates a named client using a IClientConfig instance created off the configClass class object passed in as the parameter.
|
static com.netflix.client.IClient |
getNamedClient(java.lang.String name)
Return the named client from map if already created.
|
static com.netflix.client.IClient |
getNamedClient(java.lang.String name,
java.lang.Class<? extends com.netflix.client.config.IClientConfig> configClass)
Return the named client from map if already created.
|
static com.netflix.client.config.IClientConfig |
getNamedConfig(java.lang.String name)
Get the client configuration given the name or create one with
DefaultClientConfigImpl if it does not exist. |
static com.netflix.client.config.IClientConfig |
getNamedConfig(java.lang.String name,
java.lang.Class<? extends com.netflix.client.config.IClientConfig> clientConfigClass)
Get the client configuration given the name or create one with clientConfigClass if it does not exist.
|
static ILoadBalancer |
getNamedLoadBalancer(java.lang.String name)
Get the load balancer associated with the name, or create one with an instance
DefaultClientConfigImpl if does not exist |
static ILoadBalancer |
getNamedLoadBalancer(java.lang.String name,
java.lang.Class<? extends com.netflix.client.config.IClientConfig> configClass)
Get the load balancer associated with the name, or create one with an instance of configClass if does not exist
|
static java.lang.Object |
instantiateInstanceWithClientConfig(java.lang.String className,
com.netflix.client.config.IClientConfig clientConfig)
Creates instance related to client framework using reflection.
|
static com.netflix.client.IClient<?,?> |
registerClientFromProperties(java.lang.String restClientName,
com.netflix.client.config.IClientConfig clientConfig)
Utility method to create client and load balancer (if enabled in client config) given the name and client config.
|
static ILoadBalancer |
registerNamedLoadBalancerFromclientConfig(java.lang.String name,
com.netflix.client.config.IClientConfig clientConfig)
Create and register a load balancer with the name and given the class of configClass.
|
static ILoadBalancer |
registerNamedLoadBalancerFromProperties(java.lang.String name,
java.lang.Class<? extends com.netflix.client.config.IClientConfig> configClass)
Create and register a load balancer with the name and given the class of configClass.
|
public static com.netflix.client.IClient<?,?> registerClientFromProperties(java.lang.String restClientName,
com.netflix.client.config.IClientConfig clientConfig)
throws com.netflix.client.ClientException
instantiateInstanceWithClientConfig(String, IClientConfig)restClientName - clientConfig - ClientException - if any errors occurs in the process, or if the client with the same name already existspublic static com.netflix.client.IClient getNamedClient(java.lang.String name)
getNamedConfig(String).java.lang.RuntimeException - if an error occurs in creating the client.public static com.netflix.client.IClient getNamedClient(java.lang.String name,
java.lang.Class<? extends com.netflix.client.config.IClientConfig> configClass)
createNamedClient(String, Class).java.lang.RuntimeException - if an error occurs in creating the client.public static com.netflix.client.IClient createNamedClient(java.lang.String name,
java.lang.Class<? extends com.netflix.client.config.IClientConfig> configClass)
throws com.netflix.client.ClientException
ClientException - if any error occurs, or if the client with the same name already existspublic static ILoadBalancer getNamedLoadBalancer(java.lang.String name)
DefaultClientConfigImpl if does not existjava.lang.RuntimeException - if any error occurspublic static ILoadBalancer getNamedLoadBalancer(java.lang.String name, java.lang.Class<? extends com.netflix.client.config.IClientConfig> configClass)
java.lang.RuntimeException - if any error occursregisterNamedLoadBalancerFromProperties(String, Class)public static ILoadBalancer registerNamedLoadBalancerFromclientConfig(java.lang.String name, com.netflix.client.config.IClientConfig clientConfig) throws com.netflix.client.ClientException
ClientException - if load balancer with the same name already exists or any error occursinstantiateInstanceWithClientConfig(String, IClientConfig)public static ILoadBalancer registerNamedLoadBalancerFromProperties(java.lang.String name, java.lang.Class<? extends com.netflix.client.config.IClientConfig> configClass) throws com.netflix.client.ClientException
ClientException - if load balancer with the same name already exists or any error occursinstantiateInstanceWithClientConfig(String, IClientConfig)public static java.lang.Object instantiateInstanceWithClientConfig(java.lang.String className,
com.netflix.client.config.IClientConfig clientConfig)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.ClassNotFoundException
IClientConfigAware and if so invoke IClientConfigAware.initWithNiwsConfig(IClientConfig). If that does not
apply, it tries to find if there is a constructor with IClientConfig as a parameter and if so invoke that constructor. If neither applies,
it simply invokes the no-arg constructor and ignores the clientConfig parameter.className - Class name of the objectclientConfig - IClientConfig object used for initialization.java.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionjava.lang.ClassNotFoundExceptionpublic static com.netflix.client.config.IClientConfig getNamedConfig(java.lang.String name)
DefaultClientConfigImpl if it does not exist.getNamedConfig(String, Class)public static com.netflix.client.config.IClientConfig getNamedConfig(java.lang.String name,
java.lang.Class<? extends com.netflix.client.config.IClientConfig> clientConfigClass)
IClientConfig.loadProperties(String) will be called.