public class SpringClientFactory extends Object
Constructor and Description |
---|
SpringClientFactory() |
Modifier and Type | Method and Description |
---|---|
com.netflix.client.IClient<?,?> |
createNamedClient(String name,
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.
|
com.netflix.client.IClient<?,?> |
getNamedClient(String name)
Return the named client from map if already created.
|
com.netflix.client.IClient<?,?> |
getNamedClient(String name,
Class<? extends com.netflix.client.config.IClientConfig> configClass)
Return the named client from map if already created.
|
com.netflix.client.config.IClientConfig |
getNamedConfig(String name)
Get the client configuration given the name or create one with
DefaultClientConfigImpl if it does not exist. |
com.netflix.client.config.IClientConfig |
getNamedConfig(String name,
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.
|
com.netflix.loadbalancer.ILoadBalancer |
getNamedLoadBalancer(String name)
Get the load balancer associated with the name, or create one with an instance
DefaultClientConfigImpl if does not exist |
com.netflix.loadbalancer.ILoadBalancer |
getNamedLoadBalancer(String name,
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
|
Object |
instantiateInstanceWithClientConfig(String className,
com.netflix.client.config.IClientConfig clientConfig)
Creates instance related to client framework using reflection.
|
<C extends com.netflix.client.IClient<?,?>> |
namedClient(String name,
Class<C> clientClass) |
com.netflix.client.IClient<?,?> |
registerClientFromProperties(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.
|
com.netflix.loadbalancer.ILoadBalancer |
registerNamedLoadBalancerFromclientConfig(String name,
com.netflix.client.config.IClientConfig clientConfig)
Create and register a load balancer with the name and given the class of configClass.
|
com.netflix.loadbalancer.ILoadBalancer |
registerNamedLoadBalancerFromProperties(String name,
Class<? extends com.netflix.client.config.IClientConfig> configClass)
Create and register a load balancer with the name and given the class of configClass.
|
public com.netflix.client.IClient<?,?> registerClientFromProperties(String restClientName, com.netflix.client.config.IClientConfig clientConfig) throws com.netflix.client.ClientException
instantiateInstanceWithClientConfig(String, IClientConfig)
restClientName
- clientConfig
- com.netflix.client.ClientException
- if any errors occurs in the process, or if the client with the same name already existspublic com.netflix.client.IClient<?,?> getNamedClient(String name)
getNamedConfig(String)
.RuntimeException
- if an error occurs in creating the client.public <C extends com.netflix.client.IClient<?,?>> C namedClient(String name, Class<C> clientClass)
public com.netflix.client.IClient<?,?> getNamedClient(String name, Class<? extends com.netflix.client.config.IClientConfig> configClass)
createNamedClient(String, Class)
.RuntimeException
- if an error occurs in creating the client.public com.netflix.client.IClient<?,?> createNamedClient(String name, Class<? extends com.netflix.client.config.IClientConfig> configClass) throws com.netflix.client.ClientException
com.netflix.client.ClientException
- if any error occurs, or if the client with the same name already existspublic com.netflix.loadbalancer.ILoadBalancer getNamedLoadBalancer(String name)
DefaultClientConfigImpl
if does not existRuntimeException
- if any error occurspublic com.netflix.loadbalancer.ILoadBalancer getNamedLoadBalancer(String name, Class<? extends com.netflix.client.config.IClientConfig> configClass)
RuntimeException
- if any error occursregisterNamedLoadBalancerFromProperties(String, Class)
public com.netflix.loadbalancer.ILoadBalancer registerNamedLoadBalancerFromclientConfig(String name, com.netflix.client.config.IClientConfig clientConfig) throws com.netflix.client.ClientException
com.netflix.client.ClientException
- if load balancer with the same name already exists or any error occursinstantiateInstanceWithClientConfig(String, IClientConfig)
public com.netflix.loadbalancer.ILoadBalancer registerNamedLoadBalancerFromProperties(String name, Class<? extends com.netflix.client.config.IClientConfig> configClass) throws com.netflix.client.ClientException
com.netflix.client.ClientException
- if load balancer with the same name already exists or any error occursinstantiateInstanceWithClientConfig(String, IClientConfig)
public Object instantiateInstanceWithClientConfig(String className, com.netflix.client.config.IClientConfig clientConfig) throws InstantiationException, IllegalAccessException, 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.InstantiationException
IllegalAccessException
ClassNotFoundException
public com.netflix.client.config.IClientConfig getNamedConfig(String name)
DefaultClientConfigImpl
if it does not exist.getNamedConfig(String, Class)
public com.netflix.client.config.IClientConfig getNamedConfig(String name, Class<? extends com.netflix.client.config.IClientConfig> clientConfigClass)
IClientConfig.loadProperties(String)
will be called.Copyright © 2014 Pivotal Software, Inc.. All rights reserved.