public class ClientContext
extends java.lang.Object
LDClient
when creating components.
This is passed as a parameter to component factories that implement ComponentConfigurer
.
Component factories do not receive the entire LDConfig
because
it could contain factory objects that have mutable state, and because components should not be able
to access the configurations of unrelated components.
The actual implementation class may contain other properties that are only relevant to the built-in SDK components and are therefore not part of this base class; this allows the SDK to add its own context information as needed without disturbing the public API.
Modifier | Constructor and Description |
---|---|
protected |
ClientContext(ClientContext copyFrom)
Copy constructor.
|
|
ClientContext(java.lang.String sdkKey)
Basic constructor for convenience in testing, using defaults for most properties.
|
|
ClientContext(java.lang.String sdkKey,
ApplicationInfo applicationInfo,
HttpConfiguration http,
LoggingConfiguration logging,
boolean offline,
ServiceEndpoints serviceEndpoints,
int threadPriority,
WrapperInfo wrapperInfo)
Constructor that sets all properties.
|
Modifier and Type | Method and Description |
---|---|
ApplicationInfo |
getApplicationInfo()
Returns the application metadata, if any, set by
LDConfig.Builder.applicationInfo(com.launchdarkly.sdk.server.integrations.ApplicationInfoBuilder) . |
LDLogger |
getBaseLogger()
The base logger for the SDK.
|
DataSourceUpdateSink |
getDataSourceUpdateSink()
Returns the component that
DataSource implementations use to deliver data and status
updates to the SDK. |
DataStoreUpdateSink |
getDataStoreUpdateSink()
Returns the component that
DataStore implementations use to deliver data store status
updates to the SDK. |
HttpConfiguration |
getHttp()
The configured networking properties that apply to all components.
|
LoggingConfiguration |
getLogging()
The configured logging properties that apply to all components.
|
java.lang.String |
getSdkKey()
Returns the configured SDK key.
|
ServiceEndpoints |
getServiceEndpoints()
Returns the base service URIs used by SDK components.
|
int |
getThreadPriority()
Returns the worker thread priority that is set by
LDConfig.Builder.threadPriority(int) . |
WrapperInfo |
getWrapperInfo()
Returns the wrapper information.
|
boolean |
isOffline()
Returns true if the SDK was configured to be completely offline.
|
public ClientContext(java.lang.String sdkKey, ApplicationInfo applicationInfo, HttpConfiguration http, LoggingConfiguration logging, boolean offline, ServiceEndpoints serviceEndpoints, int threadPriority, WrapperInfo wrapperInfo)
sdkKey
- the SDK keyapplicationInfo
- application metadata properties from
LDConfig.Builder.applicationInfo(com.launchdarkly.sdk.server.integrations.ApplicationInfoBuilder)
http
- HTTP configuration properties from LDConfig.Builder.http(ComponentConfigurer)
logging
- logging configuration properties from LDConfig.Builder.logging(ComponentConfigurer)
offline
- true if the SDK should be entirely offlineserviceEndpoints
- service endpoint URI properties from
LDConfig.Builder.serviceEndpoints(com.launchdarkly.sdk.server.integrations.ServiceEndpointsBuilder)
threadPriority
- worker thread priority from LDConfig.Builder.threadPriority(int)
wrapperInfo
- wrapper configuration from LDConfig.Builder.wrapper(com.launchdarkly.sdk.server.integrations.WrapperInfoBuilder)
protected ClientContext(ClientContext copyFrom)
copyFrom
- the instance to copy frompublic ClientContext(java.lang.String sdkKey)
sdkKey
- the SDK keypublic java.lang.String getSdkKey()
public ApplicationInfo getApplicationInfo()
LDConfig.Builder.applicationInfo(com.launchdarkly.sdk.server.integrations.ApplicationInfoBuilder)
.public LDLogger getBaseLogger()
public DataSourceUpdateSink getDataSourceUpdateSink()
DataSource
implementations use to deliver data and status
updates to the SDK.
This component is only available when the SDK is calling a DataSource
factory.
Otherwise the method returns null.
DataSourceUpdateSink
, if applicablepublic DataStoreUpdateSink getDataStoreUpdateSink()
DataStore
implementations use to deliver data store status
updates to the SDK.
This component is only available when the SDK is calling a DataStore
factory.
Otherwise the method returns null.
DataStoreUpdateSink
, if applicablepublic HttpConfiguration getHttp()
public LoggingConfiguration getLogging()
public boolean isOffline()
public ServiceEndpoints getServiceEndpoints()
public int getThreadPriority()
LDConfig.Builder.threadPriority(int)
.public WrapperInfo getWrapperInfo()