public class ClientComponent extends java.lang.Object implements ClientFactory
Modifier and Type | Class and Description |
---|---|
static class |
ClientComponent.ClientResourceNotReady |
ClientFactory.ContextAwareRESTErrorListener, ClientFactory.RemoteFunction<T,R>, ClientFactory.RemoteRunnable<T>
Modifier and Type | Field and Description |
---|---|
static int |
MAX_RETRIES |
Constructor and Description |
---|
ClientComponent(ConfigurationComponent configurationComponent,
MetricRegistry metricRegistry,
ObjectMapper objectMapper,
com.lucidworks.apollo.config.CuratorConfiguration curatorConfiguration,
CuratorComponent curator) |
Modifier and Type | Method and Description |
---|---|
<T> void |
executeWithRetries(java.lang.Class<T> clientResourceClass,
ClientFactory.RemoteRunnable<T> toExecute) |
<T> void |
executeWithRetries(java.lang.Class<T> clientResourceClass,
ClientFactory.RemoteRunnable<T> toExecute,
ClientFactory.ContextAwareRESTErrorListener retryListener) |
<T> <any> |
getAllResourceClients(java.lang.Class<T> clazz) |
<T> <any> |
getAllResourceClients(java.lang.Class<T> clazz,
<any> headers) |
<T> java.util.List<T> |
getAllResourceClients(java.lang.String className) |
com.lucidworks.apollo.config.CuratorConfiguration |
getCuratorConfiguration() |
MetricRegistry |
getMetricRegistry() |
Client |
getOrCreateJerseyClient(java.lang.String clientId) |
Client |
getOrCreateSystemClient() |
<T> <any> |
getResourceClient(java.lang.Class<T> clazz) |
<T> <any> |
getResourceClient(java.lang.Class<T> clazz,
<any> headers) |
<T> <any> |
getResourceClient(java.lang.Class<T> clazz,
com.lucidworks.apollo.security.AuthorizationContext authorizationContext) |
<T> <any> |
getResourceClient(java.lang.String className) |
<T> <any> |
getResourceClient(java.lang.String className,
<any> headers) |
<T> <any> |
getResourceClientWithQueryParams(java.lang.Class<T> clazz,
<any> queryParams) |
com.lucidworks.apollo.client.ClientResourceFactory |
getResourceFactory()
ClientComponent is meant to wrap ClientResourceFactory, so it's ugly to pierce the veil this way, but there are
times when we want access to the underlying factory.
|
<T,R> R |
getWithRetries(java.lang.Class<T> clientResourceClass,
ClientFactory.RemoteFunction<T,R> toExecute) |
<T,R> R |
getWithRetries(java.lang.Class<T> clientResourceClass,
ClientFactory.RemoteFunction<T,R> toExecute,
ClientFactory.ContextAwareRESTErrorListener retryListener) |
void |
initializeFactory(CuratorComponent curator) |
void |
invalidateClient(java.lang.String key) |
<T> void |
onResourceAvailable(java.lang.Class<T> clazz,
com.lucidworks.apollo.client.ClientResourceFactory.ResourceAvailableCallback<T> callback)
If the resource is already available, it will be called immediately.
|
void |
shutdown() |
public static final int MAX_RETRIES
public ClientComponent(ConfigurationComponent configurationComponent, MetricRegistry metricRegistry, ObjectMapper objectMapper, com.lucidworks.apollo.config.CuratorConfiguration curatorConfiguration, CuratorComponent curator) throws java.lang.Exception
java.lang.Exception
public void initializeFactory(CuratorComponent curator)
public <T> <any> getResourceClient(java.lang.Class<T> clazz)
getResourceClient
in interface ClientFactory
public <T> <any> getResourceClientWithQueryParams(java.lang.Class<T> clazz, <any> queryParams)
getResourceClientWithQueryParams
in interface ClientFactory
public <T> <any> getResourceClient(java.lang.Class<T> clazz, com.lucidworks.apollo.security.AuthorizationContext authorizationContext)
getResourceClient
in interface ClientFactory
public <T> <any> getResourceClient(java.lang.Class<T> clazz, <any> headers)
getResourceClient
in interface ClientFactory
public <T> <any> getResourceClient(java.lang.String className) throws com.lucidworks.apollo.common.error.RESTError
getResourceClient
in interface ClientFactory
com.lucidworks.apollo.common.error.RESTError
public <T> <any> getAllResourceClients(java.lang.Class<T> clazz)
getAllResourceClients
in interface ClientFactory
public <T> <any> getAllResourceClients(java.lang.Class<T> clazz, <any> headers)
getAllResourceClients
in interface ClientFactory
public <T> java.util.List<T> getAllResourceClients(java.lang.String className) throws com.lucidworks.apollo.common.error.RESTError
getAllResourceClients
in interface ClientFactory
com.lucidworks.apollo.common.error.RESTError
public <T> <any> getResourceClient(java.lang.String className, <any> headers) throws com.lucidworks.apollo.common.error.RESTError
getResourceClient
in interface ClientFactory
com.lucidworks.apollo.common.error.RESTError
public <T> void onResourceAvailable(java.lang.Class<T> clazz, com.lucidworks.apollo.client.ClientResourceFactory.ResourceAvailableCallback<T> callback)
T
- clazz
- callback
- public Client getOrCreateSystemClient()
public Client getOrCreateJerseyClient(java.lang.String clientId)
public MetricRegistry getMetricRegistry()
public com.lucidworks.apollo.client.ClientResourceFactory getResourceFactory()
public com.lucidworks.apollo.config.CuratorConfiguration getCuratorConfiguration()
@PreDestroy public void shutdown() throws java.lang.Exception
java.lang.Exception
public <T> void executeWithRetries(java.lang.Class<T> clientResourceClass, ClientFactory.RemoteRunnable<T> toExecute) throws com.lucidworks.apollo.common.error.RESTError
executeWithRetries
in interface ClientFactory
com.lucidworks.apollo.common.error.RESTError
public <T> void executeWithRetries(java.lang.Class<T> clientResourceClass, ClientFactory.RemoteRunnable<T> toExecute, ClientFactory.ContextAwareRESTErrorListener retryListener) throws com.lucidworks.apollo.common.error.RESTError
executeWithRetries
in interface ClientFactory
com.lucidworks.apollo.common.error.RESTError
public <T,R> R getWithRetries(java.lang.Class<T> clientResourceClass, ClientFactory.RemoteFunction<T,R> toExecute) throws com.lucidworks.apollo.common.error.RESTError
getWithRetries
in interface ClientFactory
com.lucidworks.apollo.common.error.RESTError
public <T,R> R getWithRetries(java.lang.Class<T> clientResourceClass, ClientFactory.RemoteFunction<T,R> toExecute, ClientFactory.ContextAwareRESTErrorListener retryListener) throws com.lucidworks.apollo.common.error.RESTError
getWithRetries
in interface ClientFactory
com.lucidworks.apollo.common.error.RESTError
public void invalidateClient(java.lang.String key)