Package org.apache.camel.component.smpp
Class SmppUtils
- java.lang.Object
-
- org.apache.camel.component.smpp.SmppUtils
-
public final class SmppUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static short[]
ISO_GSM_0338
See http://unicode.org/Public/MAPPINGS/ETSI/GSM0338.TXTstatic short[][]
ISO_GSM_0338_EXT
See http://unicode.org/Public/MAPPINGS/ETSI/GSM0338.TXT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.jsmpp.bean.DataSm
copyDataSm(org.jsmpp.bean.DataSm src)
static org.jsmpp.bean.SubmitMulti
copySubmitMulti(org.jsmpp.bean.SubmitMulti src)
static org.jsmpp.bean.SubmitSm
copySubmitSm(org.jsmpp.bean.SubmitSm src)
static ScheduledExecutorService
createExecutor(org.apache.camel.support.service.BaseService service, org.apache.camel.Endpoint endpoint, String taskName)
static String
decodeBody(byte[] body, byte dataCoding, String defaultEncoding)
This method would try to decode the bytes provided a dataCoding.static String
formatTime(Date date)
static byte[]
getMessageBody(org.jsmpp.bean.DeliverSm deliverSm)
Returns the payload of a deliverSmstatic boolean
is8Bit(org.jsmpp.bean.Alphabet alphabet)
static boolean
isGsm0338Encodeable(byte[] aMessage)
Decides if the characters in the argument are GSM 3.38 encodeable.static boolean
isServiceStopping(org.apache.camel.support.service.BaseService service)
static boolean
isSessionClosed(org.jsmpp.session.SMPPSession session)
static org.apache.camel.support.task.BlockingTask
newReconnectTask(ScheduledExecutorService service, String taskName, long initialReconnectDelay, long reconnectDelay, int maxReconnect)
static void
shutdownReconnectService(ScheduledExecutorService service)
static Date
string2Date(String date)
YYMMDDhhmmSS where: YY = last two digits of the year (00-99) MM = month (01-12) DD = day (01-31) hh = hour (00-23) mm = minute (00-59) SS = second (00-59) Java format is (yyMMddHHmmSS).
-
-
-
Method Detail
-
string2Date
public static Date string2Date(String date)
YYMMDDhhmmSS where:- YY = last two digits of the year (00-99)
- MM = month (01-12)
- DD = day (01-31)
- hh = hour (00-23)
- mm = minute (00-59)
- SS = second (00-59)
- Parameters:
date
- in String format.- Returns:
- the date
- Throws:
NumberFormatException
- if there is contains non number ondate
parameter.IndexOutOfBoundsException
- if the date length in String format is less than 10.
-
getMessageBody
public static byte[] getMessageBody(org.jsmpp.bean.DeliverSm deliverSm)
Returns the payload of a deliverSm- Parameters:
deliverSm
-- Returns:
- the shortMessage, by first looking in the shortMessage field of the deliver_sm and if its null or empty, fallbacks to the optional parameter "MESSAGE_PAYLOAD".
-
is8Bit
public static boolean is8Bit(org.jsmpp.bean.Alphabet alphabet)
-
isGsm0338Encodeable
public static boolean isGsm0338Encodeable(byte[] aMessage)
Decides if the characters in the argument are GSM 3.38 encodeable.- Parameters:
aMessage
- must be a set of characters encoded in ISO-8859-1 or a compatible character set. In particular, UTF-8 encoded text should not be passed to this method.- Returns:
- true if the characters can be represented in GSM 3.38
-
copySubmitSm
public static org.jsmpp.bean.SubmitSm copySubmitSm(org.jsmpp.bean.SubmitSm src)
-
copySubmitMulti
public static org.jsmpp.bean.SubmitMulti copySubmitMulti(org.jsmpp.bean.SubmitMulti src)
-
copyDataSm
public static org.jsmpp.bean.DataSm copyDataSm(org.jsmpp.bean.DataSm src)
-
isServiceStopping
public static boolean isServiceStopping(org.apache.camel.support.service.BaseService service)
-
isSessionClosed
public static boolean isSessionClosed(org.jsmpp.session.SMPPSession session)
-
createExecutor
public static ScheduledExecutorService createExecutor(org.apache.camel.support.service.BaseService service, org.apache.camel.Endpoint endpoint, String taskName)
-
newReconnectTask
public static org.apache.camel.support.task.BlockingTask newReconnectTask(ScheduledExecutorService service, String taskName, long initialReconnectDelay, long reconnectDelay, int maxReconnect)
-
shutdownReconnectService
public static void shutdownReconnectService(ScheduledExecutorService service) throws InterruptedException
- Throws:
InterruptedException
-
decodeBody
public static String decodeBody(byte[] body, byte dataCoding, String defaultEncoding) throws UnsupportedEncodingException
This method would try to decode the bytes provided a dataCoding. Supports: US_ASCII, ISO_8859_1, UTF_16_BE alphabet values- Parameters:
body
- Body of the message in bytesdataCoding
- The data coding valuedefaultEncoding
- The default encoding- Returns:
- null if body is null or 8bit encoded, or the decoded body on success
- Throws:
UnsupportedEncodingException
- when the default encoding is unsupported
-
-