Class ClientContext
- java.lang.Object
-
- com.launchdarkly.sdk.server.subsystems.ClientContext
-
public class ClientContext extends java.lang.Object
Context information provided by theLDClient
when creating components.This is passed as a parameter to component factories that implement
ComponentConfigurer
. Component factories do not receive the entireLDConfig
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.
- Since:
- 5.0.0
-
-
Constructor Summary
Constructors Modifier Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApplicationInfo
getApplicationInfo()
Returns the application metadata, if any, set byLDConfig.Builder.applicationInfo(com.launchdarkly.sdk.server.integrations.ApplicationInfoBuilder)
.LDLogger
getBaseLogger()
The base logger for the SDK.DataSourceUpdateSink
getDataSourceUpdateSink()
Returns the component thatDataSource
implementations use to deliver data and status updates to the SDK.DataStoreUpdateSink
getDataStoreUpdateSink()
Returns the component thatDataStore
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 byLDConfig.Builder.threadPriority(int)
.WrapperInfo
getWrapperInfo()
Returns the wrapper information.boolean
isOffline()
Returns true if the SDK was configured to be completely offline.
-
-
-
Constructor Detail
-
ClientContext
public ClientContext(java.lang.String sdkKey, ApplicationInfo applicationInfo, HttpConfiguration http, LoggingConfiguration logging, boolean offline, ServiceEndpoints serviceEndpoints, int threadPriority, WrapperInfo wrapperInfo)
Constructor that sets all properties. All should be non-null.- Parameters:
sdkKey
- the SDK keyapplicationInfo
- application metadata properties fromLDConfig.Builder.applicationInfo(com.launchdarkly.sdk.server.integrations.ApplicationInfoBuilder)
http
- HTTP configuration properties fromLDConfig.Builder.http(ComponentConfigurer)
logging
- logging configuration properties fromLDConfig.Builder.logging(ComponentConfigurer)
offline
- true if the SDK should be entirely offlineserviceEndpoints
- service endpoint URI properties fromLDConfig.Builder.serviceEndpoints(com.launchdarkly.sdk.server.integrations.ServiceEndpointsBuilder)
threadPriority
- worker thread priority fromLDConfig.Builder.threadPriority(int)
wrapperInfo
- wrapper configuration fromLDConfig.Builder.wrapper(com.launchdarkly.sdk.server.integrations.WrapperInfoBuilder)
-
ClientContext
protected ClientContext(ClientContext copyFrom)
Copy constructor.- Parameters:
copyFrom
- the instance to copy from
-
ClientContext
public ClientContext(java.lang.String sdkKey)
Basic constructor for convenience in testing, using defaults for most properties.- Parameters:
sdkKey
- the SDK key
-
-
Method Detail
-
getSdkKey
public java.lang.String getSdkKey()
Returns the configured SDK key.- Returns:
- the SDK key
-
getApplicationInfo
public ApplicationInfo getApplicationInfo()
Returns the application metadata, if any, set byLDConfig.Builder.applicationInfo(com.launchdarkly.sdk.server.integrations.ApplicationInfoBuilder)
.- Returns:
- the application metadata or null
-
getBaseLogger
public LDLogger getBaseLogger()
The base logger for the SDK.- Returns:
- a logger instance
-
getDataSourceUpdateSink
public DataSourceUpdateSink getDataSourceUpdateSink()
Returns the component thatDataSource
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.- Returns:
- the
DataSourceUpdateSink
, if applicable
-
getDataStoreUpdateSink
public DataStoreUpdateSink getDataStoreUpdateSink()
Returns the component thatDataStore
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.- Returns:
- the
DataStoreUpdateSink
, if applicable
-
getHttp
public HttpConfiguration getHttp()
The configured networking properties that apply to all components.- Returns:
- the HTTP configuration
-
getLogging
public LoggingConfiguration getLogging()
The configured logging properties that apply to all components.- Returns:
- the logging configuration
-
isOffline
public boolean isOffline()
Returns true if the SDK was configured to be completely offline.- Returns:
- true if configured to be offline
-
getServiceEndpoints
public ServiceEndpoints getServiceEndpoints()
Returns the base service URIs used by SDK components.- Returns:
- the service endpoint URIs
-
getThreadPriority
public int getThreadPriority()
Returns the worker thread priority that is set byLDConfig.Builder.threadPriority(int)
.- Returns:
- the thread priority
-
getWrapperInfo
public WrapperInfo getWrapperInfo()
Returns the wrapper information.- Returns:
- the wrapper information
-
-