Class SnsHttpDelegate
- java.lang.Object
-
- org.forgerock.openam.services.push.sns.SnsHttpDelegate
-
- All Implemented Interfaces:
Closeable,AutoCloseable,PushNotificationDelegate
public class SnsHttpDelegate extends Object implements PushNotificationDelegate
Delegate for communicating with SNS over HTTP.
-
-
Constructor Summary
Constructors Constructor Description SnsHttpDelegate(com.amazonaws.services.sns.AmazonSNSClient client, PushNotificationServiceConfig config, SnsPushMessageConverter pushMessageConverter, String realm, MessageDispatcher messageDispatcher)Generates a new SNS HTTP Delegate, used to communicate over the Internet with the SNS service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Set<Predicate>getAuthenticationMessagePredicates()Returns a set of authentication message predicates required by this delegate.StringgetAuthServiceLocation()Returns the (public, relative) authentication service location of this delegate - if appropriate.MessageDispatchergetMessageDispatcher()Returns the MessageDispatcher for this delegate.Set<Predicate>getRegistrationMessagePredicates()Returns a set of registration message predicates required by this delegate.StringgetRegServiceLocation()Returns the (public, relative) registration service location of this delegate - if appropriate.booleanisRequireNewDelegate(PushNotificationServiceConfig newConfig)Returns whether or not the new config is so different from the old that the existing delegate should be removed from the pool.voidsend(PushMessage message)Used to send a message out to the PushNotificationDelegate to be delivered.voidstartServices()Starts any required services for this delegate.voidupdateDelegate(PushNotificationServiceConfig newConfig)Updates the existing delegate's config.
-
-
-
Constructor Detail
-
SnsHttpDelegate
public SnsHttpDelegate(com.amazonaws.services.sns.AmazonSNSClient client, PushNotificationServiceConfig config, SnsPushMessageConverter pushMessageConverter, String realm, MessageDispatcher messageDispatcher)Generates a new SNS HTTP Delegate, used to communicate over the Internet with the SNS service.- Parameters:
client- AmazonSnsClient - used to put messages on the wire.config- Necessary to configure this delegate.pushMessageConverter- a message converter, to ensure the message sent is of the correct format.realm- the realm in which this delegate exists.messageDispatcher- the MessageDispatcher used to redirect incoming messages to their caller.
-
-
Method Detail
-
send
public void send(PushMessage message)
Description copied from interface:PushNotificationDelegateUsed to send a message out to the PushNotificationDelegate to be delivered.- Specified by:
sendin interfacePushNotificationDelegate- Parameters:
message- The message to send.
-
isRequireNewDelegate
public boolean isRequireNewDelegate(PushNotificationServiceConfig newConfig)
Description copied from interface:PushNotificationDelegateReturns whether or not the new config is so different from the old that the existing delegate should be removed from the pool.- Specified by:
isRequireNewDelegatein interfacePushNotificationDelegate- Parameters:
newConfig- The new configuration to check against the old.- Returns:
- True if the configuration change requires the PushNotificationService to instantiate a new instance of this delegate.
-
updateDelegate
public void updateDelegate(PushNotificationServiceConfig newConfig)
Description copied from interface:PushNotificationDelegateUpdates the existing delegate's config. Implementors must not alter the connection parameters of the delegate, but may alter extraneous information such as values added to static fields in the delegate's communicated messages.- Specified by:
updateDelegatein interfacePushNotificationDelegate- Parameters:
newConfig- The new config from which to update the existing delegate.
-
getAuthServiceLocation
public String getAuthServiceLocation()
Description copied from interface:PushNotificationDelegateReturns the (public, relative) authentication service location of this delegate - if appropriate. Otherwise returns null.- Specified by:
getAuthServiceLocationin interfacePushNotificationDelegate- Returns:
- The (public, relative) service location of this delegate as exposed to the world, may be relative to the
OpenAM server instance ID
WebtopNaming.
-
getRegistrationMessagePredicates
public Set<Predicate> getRegistrationMessagePredicates()
Description copied from interface:PushNotificationDelegateReturns a set of registration message predicates required by this delegate. Must return an empty set if there are no predicates to be run.- Specified by:
getRegistrationMessagePredicatesin interfacePushNotificationDelegate- Returns:
- A set of predicate delegates.
-
getAuthenticationMessagePredicates
public Set<Predicate> getAuthenticationMessagePredicates()
Description copied from interface:PushNotificationDelegateReturns a set of authentication message predicates required by this delegate. Must return an empty set if there are no predicates to be run.- Specified by:
getAuthenticationMessagePredicatesin interfacePushNotificationDelegate- Returns:
- A set of predicate delegates.
-
getRegServiceLocation
public String getRegServiceLocation()
Description copied from interface:PushNotificationDelegateReturns the (public, relative) registration service location of this delegate - if appropriate. Otherwise returns null.- Specified by:
getRegServiceLocationin interfacePushNotificationDelegate- Returns:
- The (public, relative) service location of this delegate as exposed to the world, may be relative to the
OpenAM server instance ID
WebtopNaming.
-
startServices
public void startServices() throws PushNotificationExceptionDescription copied from interface:PushNotificationDelegateStarts any required services for this delegate. This may include e.g. listeners to specific ports. This method is called once after a new delegate is generated, but before it is made available for general use by the PushNotificationService.- Specified by:
startServicesin interfacePushNotificationDelegate- Throws:
PushNotificationException- if there were any issues starting the service.
-
getMessageDispatcher
public MessageDispatcher getMessageDispatcher()
Description copied from interface:PushNotificationDelegateReturns the MessageDispatcher for this delegate. Used to get messages back to the originator when returned through a different medium.- Specified by:
getMessageDispatcherin interfacePushNotificationDelegate- Returns:
- The MessageDispatcher for this delegate.
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-