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 Details

  • Constructor Details

    • NotificationTransportApiManagerRest

      public NotificationTransportApiManagerRest()
      Simple Constructor
    • NotificationTransportApiManagerRest

      public NotificationTransportApiManagerRest(String strNotificationEndPoint, String strApiManagerEndPoint, String strApiManagerCredentials)
      Constructor
      Parameters:
      strNotificationEndPoint - the notification end point
      strApiManagerEndPoint - the token end point
      strApiManagerCredentials - the API Manager credentials
    • NotificationTransportApiManagerRest

      @Inject public NotificationTransportApiManagerRest(String strNotificationEndPoint, String strApiManagerEndPoint, String strApiManagerCredentials, int nTokenExpiryMargin)
      Constructor
      Parameters:
      strNotificationEndPoint - the notification end point
      strApiManagerEndPoint - the token end point
      strApiManagerCredentials - the API Manager credentials
      nTokenExpiryMargin - the seconds removed from the token lifetime
  • Method Details

    • setApiManagerEndPoint

      public void setApiManagerEndPoint(String strApiManagerEndPoint)
      setter of apiManagerEndPoint
      Parameters:
      strApiManagerEndPoint - value to use
    • setApiManagerCredentials

      public void setApiManagerCredentials(String strApiManagerCredentials)
      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:
      send in interface INotificationTransportProvider
      Parameters:
      notification - the notification
      Returns:
      a notifyGruResponse
    • setNotificationEndPoint

      public void setNotificationEndPoint(String strNotificationEndPoint)
      setter of notificationEndPoint
      Parameters:
      strNotificationEndPoint - value to use
    • setHttpTransport

      public void setHttpTransport(IHttpTransportProvider httpTransport)
      setter of httpTransport
      Parameters:
      httpTransport - IHttpTransportProvider to use