@ComponentProfile(summary="Make a HTTP(s) request to an OAUTH server and retrieve an access token", tag="service,http,https,oauth") public class GetOauthToken extends ServiceImp
In the adapter configuration file this class is aliased as get-oauth-token which is the preferred alternative to the fully qualified classname when building your configuration.
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
GetOauthToken() |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
AccessTokenBuilder |
getAccessTokenBuilder() |
java.lang.String |
getTokenExpiryKey() |
java.lang.String |
getTokenKey() |
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
setAccessTokenBuilder(AccessTokenBuilder b)
Set the access token builder.
|
void |
setTokenExpiryKey(java.lang.String key)
Set the metadata key for storing the expiry date (ISO8601 style).
|
void |
setTokenKey(java.lang.String key)
Set the metadata to store the token against.
|
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
spublic void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
protected void initService() throws CoreException
initService
in class ServiceImp
CoreException
public void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling start will begin message delivery.
start
in interface ComponentLifecycle
start
in class ServiceImp
CoreException
- wrapping any underlying Exception
spublic void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling stop will pause message delivery. Throwing a
RuntimeException
may cause unintended consequences
stop
in interface ComponentLifecycle
stop
in class ServiceImp
protected void closeService()
closeService
in class ServiceImp
public java.lang.String getTokenKey()
public void setTokenKey(java.lang.String key)
key
- the key.public java.lang.String getTokenExpiryKey()
public void setTokenExpiryKey(java.lang.String key)
In some cases, there is no expiry date for a token, in which case, the metadata key will never be set even if configured.
key
- key.public AccessTokenBuilder getAccessTokenBuilder()
public void setAccessTokenBuilder(AccessTokenBuilder b)
b
- the builder.