Class NotificationTransportApiManagerRest
java.lang.Object
fr.paris.lutece.plugins.librarynotifygru.rs.service.NotificationTransportApiManagerRest
- All Implemented Interfaces:
INotificationTransportProvider
@ApplicationScoped
@Named("library-notifygru.apiManagerTransport")
public class NotificationTransportApiManagerRest
extends Object
NotificationTransport which authenticates with an API Manager OAuth2 token (client credentials). The token is kept in memory, per instance, until it
expires: it is a secret, it is never shared between instances.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSimple ConstructorNotificationTransportApiManagerRest(String strNotificationEndPoint, String strApiManagerEndPoint, String strApiManagerCredentials) ConstructorNotificationTransportApiManagerRest(String strNotificationEndPoint, String strApiManagerEndPoint, String strApiManagerCredentials, int nTokenExpiryMargin) Constructor -
Method Summary
Modifier and TypeMethodDescriptionfr.paris.lutece.plugins.grubusiness.business.notification.NotifyGruResponsesend(fr.paris.lutece.plugins.grubusiness.business.notification.Notification notification) Send a Notification GRU can throw AppException in case of problem with the JSON requestvoidsetApiManagerCredentials(String strApiManagerCredentials) Sets the API Manager credentialsvoidsetApiManagerEndPoint(String strApiManagerEndPoint) setter of apiManagerEndPointvoidsetHttpTransport(IHttpTransportProvider httpTransport) setter of httpTransportvoidsetNotificationEndPoint(String strNotificationEndPoint) setter of notificationEndPointvoidsetTokenExpiryMargin(int nTokenExpiryMargin) Sets the seconds removed from the token lifetime before it is renewed
-
Field Details
-
BEAN_NAME
- See Also:
-
-
Constructor Details
-
NotificationTransportApiManagerRest
public NotificationTransportApiManagerRest()Simple Constructor -
NotificationTransportApiManagerRest
public NotificationTransportApiManagerRest(String strNotificationEndPoint, String strApiManagerEndPoint, String strApiManagerCredentials) Constructor- Parameters:
strNotificationEndPoint- the notification end pointstrApiManagerEndPoint- the token end pointstrApiManagerCredentials- the API Manager credentials
-
NotificationTransportApiManagerRest
@Inject public NotificationTransportApiManagerRest(String strNotificationEndPoint, String strApiManagerEndPoint, String strApiManagerCredentials, int nTokenExpiryMargin) Constructor- Parameters:
strNotificationEndPoint- the notification end pointstrApiManagerEndPoint- the token end pointstrApiManagerCredentials- the API Manager credentialsnTokenExpiryMargin- the seconds removed from the token lifetime
-
-
Method Details
-
setApiManagerEndPoint
setter of apiManagerEndPoint- Parameters:
strApiManagerEndPoint- value to use
-
setApiManagerCredentials
Sets the API Manager credentials- Parameters:
strApiManagerCredentials- the API Manager credentials
-
setTokenExpiryMargin
public void setTokenExpiryMargin(int nTokenExpiryMargin) Sets the seconds removed from the token lifetime before it is renewed- Parameters:
nTokenExpiryMargin- the margin in seconds
-
send
public fr.paris.lutece.plugins.grubusiness.business.notification.NotifyGruResponse send(fr.paris.lutece.plugins.grubusiness.business.notification.Notification notification) Send a Notification GRU can throw AppException in case of problem with the JSON request- Specified by:
sendin interfaceINotificationTransportProvider- Parameters:
notification- the notification- Returns:
- a notifyGruResponse
-
setNotificationEndPoint
setter of notificationEndPoint- Parameters:
strNotificationEndPoint- value to use
-
setHttpTransport
setter of httpTransport- Parameters:
httpTransport- IHttpTransportProvider to use
-