public abstract class BaseClient extends Object implements DataStore
Constructor and Description |
---|
BaseClient(ClientConfiguration clientConfiguration,
CacheManager cacheManager) |
BaseClient(ClientConfiguration clientConfiguration,
CacheManager cacheManager,
com.okta.commons.http.RequestExecutor requestExecutor) |
Modifier and Type | Method and Description |
---|---|
<T extends Resource> |
create(String parentHref,
T resource)
Creates a new resource and returns the instance as represented by the server.
|
protected InternalDataStore |
createDataStore(com.okta.commons.http.RequestExecutor requestExecutor,
com.okta.commons.http.config.BaseUrlResolver baseUrlResolver,
ClientCredentialsResolver clientCredentialsResolver,
CacheManager cacheManager) |
protected com.okta.commons.http.RequestExecutor |
createRequestExecutor(ClientConfiguration clientConfiguration) |
<T extends Resource> |
delete(String href,
T resource)
Deleted a resource on the remote server.
|
CacheManager |
getCacheManager()
Returns the CacheManager used to improve data store performance.
|
ClientCredentials |
getClientCredentials()
Returns the ClientCredentials used to authenticate HTTPS requests sent to the Okta API server.
|
InternalDataStore |
getDataStore() |
<T extends Resource> |
getResource(String href,
Class<T> clazz)
Delegates to the internal
dataStore instance. |
RequestBuilder |
http()
Returns an http request builder to help make requests to Okta endpoints that are NOT implemented by this SDK.
|
<T extends Resource> |
instantiate(Class<T> clazz)
Delegates to the internal
dataStore instance. |
boolean |
isReady(Supplier<? extends Resource> methodReference)
Check if Datastore is configured correctly and able to execute requests.
|
<T extends Resource> |
save(String href,
T resource)
Saves an exiting resource to the remote server.
|
public BaseClient(ClientConfiguration clientConfiguration, CacheManager cacheManager)
public BaseClient(ClientConfiguration clientConfiguration, CacheManager cacheManager, com.okta.commons.http.RequestExecutor requestExecutor)
protected InternalDataStore createDataStore(com.okta.commons.http.RequestExecutor requestExecutor, com.okta.commons.http.config.BaseUrlResolver baseUrlResolver, ClientCredentialsResolver clientCredentialsResolver, CacheManager cacheManager)
public ClientCredentials getClientCredentials()
DataStore
getClientCredentials
in interface DataStore
public CacheManager getCacheManager()
DataStore
getCacheManager
in interface DataStore
public InternalDataStore getDataStore()
protected com.okta.commons.http.RequestExecutor createRequestExecutor(ClientConfiguration clientConfiguration)
public <T extends Resource> T instantiate(Class<T> clazz)
dataStore
instance. This is a convenience mechanism to eliminate the constant
need to call client.getDataStore()
every time one needs to instantiate Resource.instantiate
in interface DataStore
T
- the Resource sub-typeclazz
- the Resource class to instantiate.public <T extends Resource> T getResource(String href, Class<T> clazz)
dataStore
instance. This is a convenience mechanism to eliminate the constant
need to call client.getDataStore()
every time one needs to look up a Resource.getResource
in interface DataStore
T
- type parameter indicating the returned value is a Resource
instance.href
- the resource URL of the resource to retrieveclazz
- the Resource
sub-interface to instantiatehref
URL.public <T extends Resource> T create(String parentHref, T resource)
DataStore
create
in interface DataStore
T
- type parameter indicating the returned value is a Resource
instance.parentHref
- the resource URL of the resource to retrieveresource
- the object payload to to send to the serverpublic <T extends Resource> void save(String href, T resource)
DataStore
NOTE: this is typically done by using resource.save()
instead of this method.
public <T extends Resource> void delete(String href, T resource)
DataStore
NOTE: this is typically done by using resource.delete()
instead of this method.
public RequestBuilder http()
DataStore
Copyright © 2017–2023 Okta. All rights reserved.