public class DefaultDataStore extends Object implements InternalDataStore
Constructor and Description |
---|
DefaultDataStore(com.okta.commons.http.RequestExecutor requestExecutor,
com.okta.commons.http.config.BaseUrlResolver baseUrlResolver,
ClientCredentialsResolver clientCredentialsResolver,
CacheManager cacheManager) |
DefaultDataStore(com.okta.commons.http.RequestExecutor requestExecutor,
String baseUrl,
ClientCredentialsResolver clientCredentialsResolver) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyDefaultRequestHeaders(com.okta.commons.http.Request request) |
<T extends Resource> |
create(String parentHref,
T resource,
T parentResource) |
<T extends Resource,R extends Resource> |
create(String parentHref,
T resource,
T parentResource,
Class<? extends R> returnType) |
<T extends Resource,R extends Resource> |
create(String parentHref,
T resource,
T parentResource,
Class<? extends R> returnType,
Map<String,Object> queryParameters) |
<T extends Resource,R extends Resource> |
create(String parentHref,
T resource,
T parentResource,
Class<? extends R> returnType,
Map<String,Object> queryParameters,
Map<String,List<String>> headerParameters) |
void |
delete(String href) |
void |
delete(String href,
Map<String,Object> queryParameters) |
void |
delete(String href,
Map<String,Object> queryParameters,
Map<String,List<String>> headerParameters) |
<T extends Resource> |
delete(String href,
T resource)
Deleted a resource on the remote server.
|
<T extends Resource> |
delete(String href,
T resource,
Map<String,Object> queryParameters,
Map<String,List<String>> headerParameters) |
<T extends Resource> |
delete(T resource) |
String |
getBaseUrl() |
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.
|
InputStream |
getRawResponse(String href,
Map<String,Object> queryParameters,
Map<String,List<String>> headerParameters) |
<T extends Resource> |
getResource(String href,
Class<T> clazz)
Looks up (retrieves) the resource at the specified
href URL and returns the resource as an instance of
the specified class . |
<T extends Resource> |
getResource(String href,
Class<T> clazz,
Map<String,Object> queryParameters) |
<T extends Resource> |
getResource(String href,
Class<T> clazz,
Map<String,Object> queryParameters,
Map<String,List<String>> headerParameters) |
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)
Instantiates and returns a new instance of the specified Resource type.
|
<T extends Resource> |
instantiate(Class<T> clazz,
Map<String,Object> properties) |
protected boolean |
isCachingEnabled() |
boolean |
isReady(Supplier<? extends Resource> methodReference)
Check if Datastore is configured correctly and able to execute requests.
|
<T extends Resource,R extends Resource> |
save(String parentHref,
T resource,
Class<? extends R> returnType,
boolean create) |
<T extends Resource> |
save(String href,
T resource,
T parentResource) |
<T extends Resource> |
save(String href,
T resource,
T parentResource,
Map<String,Object> queryParameters) |
<T extends Resource> |
save(String href,
T resource,
T parentResource,
Map<String,Object> queryParameters,
Map<String,List<String>> headerParameters) |
<T extends Resource> |
save(T resource) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
create, create, save
public DefaultDataStore(com.okta.commons.http.RequestExecutor requestExecutor, String baseUrl, ClientCredentialsResolver clientCredentialsResolver)
public DefaultDataStore(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 <T extends Resource> T instantiate(Class<T> clazz)
DataStore
This method effectively replaces the new
keyword that would have been used otherwise if the concrete implementation was known (Resource implementation
classes are intentionally not exposed to SDK end-users).
instantiate
in interface DataStore
T
- the Resource sub-typeclazz
- the Resource class to instantiate.public <T extends Resource> T instantiate(Class<T> clazz, Map<String,Object> properties)
instantiate
in interface InternalDataStore
public <T extends Resource> T getResource(String href, Class<T> clazz)
DataStore
href
URL and returns the resource as an instance of
the specified class
. The Class
argument must represent an interface that is a sub-interface
of 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 getResource(String href, Class<T> clazz, Map<String,Object> queryParameters)
getResource
in interface InternalDataStore
public <T extends Resource> T getResource(String href, Class<T> clazz, Map<String,Object> queryParameters, Map<String,List<String>> headerParameters)
getResource
in interface InternalDataStore
public InputStream getRawResponse(String href, Map<String,Object> queryParameters, Map<String,List<String>> headerParameters)
getRawResponse
in interface InternalDataStore
public <T extends Resource> T create(String parentHref, T resource, T parentResource)
create
in interface InternalDataStore
public <T extends Resource,R extends Resource> R create(String parentHref, T resource, T parentResource, Class<? extends R> returnType)
create
in interface InternalDataStore
public <T extends Resource,R extends Resource> R create(String parentHref, T resource, T parentResource, Class<? extends R> returnType, Map<String,Object> queryParameters)
create
in interface InternalDataStore
public <T extends Resource,R extends Resource> R create(String parentHref, T resource, T parentResource, Class<? extends R> returnType, Map<String,Object> queryParameters, Map<String,List<String>> headerParameters)
create
in interface InternalDataStore
public <T extends Resource,R extends Resource> R save(String parentHref, T resource, Class<? extends R> returnType, boolean create)
save
in interface InternalDataStore
public <T extends Resource> void save(T resource)
save
in interface InternalDataStore
public <T extends Resource> void save(String href, T resource, T parentResource)
save
in interface InternalDataStore
public <T extends Resource> void save(String href, T resource, T parentResource, Map<String,Object> queryParameters)
save
in interface InternalDataStore
public <T extends Resource> void save(String href, T resource, T parentResource, Map<String,Object> queryParameters, Map<String,List<String>> headerParameters)
save
in interface InternalDataStore
public void delete(String href)
delete
in interface InternalDataStore
public void delete(String href, Map<String,Object> queryParameters)
delete
in interface InternalDataStore
public void delete(String href, Map<String,Object> queryParameters, Map<String,List<String>> headerParameters)
delete
in interface InternalDataStore
public <T extends Resource> void delete(String href, T resource, Map<String,Object> queryParameters, Map<String,List<String>> headerParameters)
delete
in interface InternalDataStore
public <T extends Resource> void delete(T resource)
delete
in interface InternalDataStore
public <T extends Resource> void delete(String href, T resource)
DataStore
NOTE: this is typically done by using resource.delete()
instead of this method.
delete
in interface DataStore
delete
in interface InternalDataStore
T
- type parameter indicating the type of Resource
instance.href
- the resource URL of the resource to deletedresource
- the object payload to to send to the serverprotected boolean isCachingEnabled()
public String getBaseUrl()
getBaseUrl
in interface InternalDataStore
protected void applyDefaultRequestHeaders(com.okta.commons.http.Request request)
public RequestBuilder http()
DataStore
Copyright © 2017–2023 Okta. All rights reserved.