Package org.gcube.event.publisher
Class AbstractHTTPWithJWTTokenAuthEventSender
- java.lang.Object
-
- org.gcube.event.publisher.AbstractHTTPWithJWTTokenAuthEventSender
-
- All Implemented Interfaces:
EventSender
- Direct Known Subclasses:
HTTPWithOIDCAuthEventSender
public abstract class AbstractHTTPWithJWTTokenAuthEventSender extends Object implements EventSender
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classAbstractHTTPWithJWTTokenAuthEventSender.HTTPGetclassAbstractHTTPWithJWTTokenAuthEventSender.HTTPPostclassAbstractHTTPWithJWTTokenAuthEventSender.HTTPVerb
-
Field Summary
Fields Modifier and Type Field Description protected URLbaseEndpointURLprotected StringclientIdprotected StringclientSecretprotected intconnectionTimeoutprotected AbstractHTTPWithJWTTokenAuthEventSender.HTTPGetlastHTTPGetprotected AbstractHTTPWithJWTTokenAuthEventSender.HTTPPostlastHTTPPostprotected static org.slf4j.Loggerlogprotected intreadTimeoutprotected URLtokenURL
-
Constructor Summary
Constructors Constructor Description AbstractHTTPWithJWTTokenAuthEventSender(URL baseEndpointURL, String clientId, String clientSecret, URL tokenURL)AbstractHTTPWithJWTTokenAuthEventSender(URL baseEndpointURL, String clientId, String clientSecret, URL tokenURL, int connectionTimeout, int readTimeout)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract org.gcube.oidc.rest.JWTTokengetAuthorizationToken()intgetConnectionTimeout()intgetLastRetrieveHTTPResponseCode()Return the last retrieve HTTP response code.intgetLastSendHTTPResponseCode()Return the last send HTTP response code.intgetReadTimeout()protected URLgetTokenURL()org.json.simple.JSONObjectretrive(String id)Retrieves the instance of the provided workflow instance.voidsend(Event event)Sends an event.StringsendAndGetResult(Event event)Send an event and get results.voidsetConnectionTimeout(int connectionTimeout)voidsetReadTimeout(int readTimeout)
-
-
-
Field Detail
-
log
protected static final org.slf4j.Logger log
-
baseEndpointURL
protected URL baseEndpointURL
-
clientId
protected String clientId
-
clientSecret
protected String clientSecret
-
tokenURL
protected URL tokenURL
-
connectionTimeout
protected int connectionTimeout
-
readTimeout
protected int readTimeout
-
lastHTTPPost
protected AbstractHTTPWithJWTTokenAuthEventSender.HTTPPost lastHTTPPost
-
lastHTTPGet
protected AbstractHTTPWithJWTTokenAuthEventSender.HTTPGet lastHTTPGet
-
-
Method Detail
-
getReadTimeout
public int getReadTimeout()
-
setReadTimeout
public void setReadTimeout(int readTimeout)
-
getConnectionTimeout
public int getConnectionTimeout()
-
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout)
-
send
public void send(Event event)
Description copied from interface:EventSenderSends an event.- Specified by:
sendin interfaceEventSender- Parameters:
event- the event to send
-
getLastSendHTTPResponseCode
public int getLastSendHTTPResponseCode()
Description copied from interface:EventSenderReturn the last send HTTP response code.- Specified by:
getLastSendHTTPResponseCodein interfaceEventSender- Returns:
- the HTTP response code or -1 if an error occurred before the call (e.g. during the authorization or connection)
-
sendAndGetResult
public String sendAndGetResult(Event event)
Description copied from interface:EventSenderSend an event and get results.- Specified by:
sendAndGetResultin interfaceEventSender- Parameters:
event- the event to send- Returns:
- the result of the call
-
retrive
public org.json.simple.JSONObject retrive(String id)
Description copied from interface:EventSenderRetrieves the instance of the provided workflow instance.- Specified by:
retrivein interfaceEventSender- Parameters:
id- the workflow instance id- Returns:
-
getLastRetrieveHTTPResponseCode
public int getLastRetrieveHTTPResponseCode()
Description copied from interface:EventSenderReturn the last retrieve HTTP response code.- Specified by:
getLastRetrieveHTTPResponseCodein interfaceEventSender- Returns:
- the HTTP response code or -1 if an error occurred before the call (e.g. during the authorization or connection)
-
getTokenURL
protected URL getTokenURL()
-
getAuthorizationToken
protected abstract org.gcube.oidc.rest.JWTToken getAuthorizationToken() throws org.gcube.oidc.rest.OpenIdConnectRESTHelperException- Throws:
org.gcube.oidc.rest.OpenIdConnectRESTHelperException
-
-