Package org.cyclos.impl.utils.sms
Class ScriptInboundSmsRequestHandlerImpl
- java.lang.Object
-
- org.cyclos.impl.utils.sms.ScriptInboundSmsRequestHandlerImpl
-
- All Implemented Interfaces:
InboundSmsRequestHandler
public class ScriptInboundSmsRequestHandlerImpl extends Object implements InboundSmsRequestHandler
Implementation ofInboundSmsRequestHandlerwhich delegates the logic to a custom script
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_CHANNEL_CONFIGURATIONScript attribute: theSmsChannelConfigurationstatic StringATTR_CONFIGURATIONScript attribute: theConfigurationAccessorstatic StringATTR_INBOUND_SMSScript attribute: theInboundSmsstatic StringATTR_INBOUND_SMS_DATAScript attribute: theInboundSmsDatastatic StringATTR_INBOUND_SMS_EXCEPTIONScript attribute: theExceptionstatic StringATTR_INBOUND_SMS_RESPONSE_TYPEScript attribute: theInboundSmsResponseTypestatic StringATTR_REQUESTScript attribute: theRequestInfostatic StringGENERATE_RESPONSE_FUNCTION_NAMEThe function name called on scripts for generating the gateway response for a well-formatted requeststatic StringGENERATE_RESPONSE_MISSING_PARAMETERS_FUNCTION_NAMEThe function name called on scripts for generating the gateway response for a request missing parametersstatic StringRESOLVE_SMS_DATA_FUNCTION_NAMEThe function name called on scripts for resolving theInboundSmsData
-
Constructor Summary
Constructors Constructor Description ScriptInboundSmsRequestHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResponseInfogenerateResponse(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, InboundSmsData smsData, InboundSms sms)Generates the response to the SMS gatewayResponseInfogenerateResponseForError(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, Exception exception)Generates the response to the SMS gateway when there is a general errorResponseInfogenerateResponseForMissingParameters(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request)Generates the response to the SMS gateway when the bare minimum parameters - number and message - are missingvoidinitialize()InboundSmsBasicDataresolveSmsData(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request)Parses, from the given request, the inbound SMS data
-
-
-
Field Detail
-
GENERATE_RESPONSE_FUNCTION_NAME
public static final String GENERATE_RESPONSE_FUNCTION_NAME
The function name called on scripts for generating the gateway response for a well-formatted request- See Also:
- Constant Field Values
-
GENERATE_RESPONSE_MISSING_PARAMETERS_FUNCTION_NAME
public static final String GENERATE_RESPONSE_MISSING_PARAMETERS_FUNCTION_NAME
The function name called on scripts for generating the gateway response for a request missing parameters- See Also:
- Constant Field Values
-
RESOLVE_SMS_DATA_FUNCTION_NAME
public static final String RESOLVE_SMS_DATA_FUNCTION_NAME
The function name called on scripts for resolving theInboundSmsData- See Also:
- Constant Field Values
-
ATTR_CONFIGURATION
public static final String ATTR_CONFIGURATION
Script attribute: theConfigurationAccessor- See Also:
- Constant Field Values
-
ATTR_CHANNEL_CONFIGURATION
public static final String ATTR_CHANNEL_CONFIGURATION
Script attribute: theSmsChannelConfiguration- See Also:
- Constant Field Values
-
ATTR_REQUEST
public static final String ATTR_REQUEST
Script attribute: theRequestInfo- See Also:
- Constant Field Values
-
ATTR_INBOUND_SMS_RESPONSE_TYPE
public static final String ATTR_INBOUND_SMS_RESPONSE_TYPE
Script attribute: theInboundSmsResponseType- See Also:
- Constant Field Values
-
ATTR_INBOUND_SMS_EXCEPTION
public static final String ATTR_INBOUND_SMS_EXCEPTION
Script attribute: theException- See Also:
- Constant Field Values
-
ATTR_INBOUND_SMS_DATA
public static final String ATTR_INBOUND_SMS_DATA
Script attribute: theInboundSmsData- See Also:
- Constant Field Values
-
ATTR_INBOUND_SMS
public static final String ATTR_INBOUND_SMS
Script attribute: theInboundSms- See Also:
- Constant Field Values
-
-
Method Detail
-
generateResponse
public ResponseInfo generateResponse(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, InboundSmsData smsData, InboundSms sms)
Description copied from interface:InboundSmsRequestHandlerGenerates the response to the SMS gateway- Specified by:
generateResponsein interfaceInboundSmsRequestHandler
-
generateResponseForError
public ResponseInfo generateResponseForError(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request, Exception exception)
Description copied from interface:InboundSmsRequestHandlerGenerates the response to the SMS gateway when there is a general error- Specified by:
generateResponseForErrorin interfaceInboundSmsRequestHandler
-
generateResponseForMissingParameters
public ResponseInfo generateResponseForMissingParameters(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request)
Description copied from interface:InboundSmsRequestHandlerGenerates the response to the SMS gateway when the bare minimum parameters - number and message - are missing- Specified by:
generateResponseForMissingParametersin interfaceInboundSmsRequestHandler
-
initialize
@PostConstruct public void initialize()
-
resolveSmsData
public InboundSmsBasicData resolveSmsData(ConfigurationAccessor configuration, SmsChannelConfiguration channelConfiguration, RequestInfo request)
Description copied from interface:InboundSmsRequestHandlerParses, from the given request, the inbound SMS data- Specified by:
resolveSmsDatain interfaceInboundSmsRequestHandler
-
-