Repository: camel Updated Branches: refs/heads/master 36b7fda38 -> 4a3dfb5cc
Component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4a3dfb5c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4a3dfb5c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4a3dfb5c Branch: refs/heads/master Commit: 4a3dfb5cc9e48e46b1dc8bbfa0b55ce4a3c69ee0 Parents: 36b7fda Author: Claus Ibsen <davscl...@apache.org> Authored: Wed May 13 10:24:19 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Wed May 13 11:03:51 2015 +0200 ---------------------------------------------------------------------- .../camel/component/smpp/SmppComponent.java | 3 + .../camel/component/smpp/SmppConfiguration.java | 263 +++++++++++++++++-- .../camel/component/smpp/SmppEndpoint.java | 2 +- 3 files changed, 250 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/4a3dfb5c/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppComponent.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppComponent.java index eb917e2..6a8eb43 100644 --- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppComponent.java +++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppComponent.java @@ -88,6 +88,9 @@ public class SmppComponent extends UriEndpointComponent { return configuration; } + /** + * To use the shared SmppConfiguration as configuration. + */ public void setConfiguration(SmppConfiguration configuration) { this.configuration = configuration; } http://git-wip-us.apache.org/repos/asf/camel/blob/4a3dfb5c/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java index 903916e..dec1661 100644 --- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java +++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java @@ -53,7 +53,7 @@ public class SmppConfiguration implements Cloneable { private String systemType = "cp"; @UriParam private byte dataCoding = (byte) 0; - @UriParam + @UriParam(enums = "0,4,8") private byte alphabet = Alphabet.ALPHA_DEFAULT.value(); @UriParam(defaultValue = "ISO-8859-1") private String encoding = "ISO-8859-1"; @@ -61,33 +61,33 @@ public class SmppConfiguration implements Cloneable { private Integer enquireLinkTimer = 5000; @UriParam(defaultValue = "10000") private Integer transactionTimer = 10000; - @UriParam + @UriParam(enums = "0,1,2") private byte registeredDelivery = SMSCDeliveryReceipt.SUCCESS_FAILURE.value(); - @UriParam(defaultValue = "CMT") + @UriParam(defaultValue = "CMT", enums = "CMT,CPT,VMN,VMA,WAP,USSD") private String serviceType = "CMT"; @UriParam(defaultValue = "1616") private String sourceAddr = "1616"; @UriParam(defaultValue = "1717") private String destAddr = "1717"; - @UriParam + @UriParam(enums = "0,1,2,3,4,5,6") private byte sourceAddrTon = TypeOfNumber.UNKNOWN.value(); - @UriParam + @UriParam(enums = "0,1,2,3,4,5,6") private byte destAddrTon = TypeOfNumber.UNKNOWN.value(); - @UriParam + @UriParam(enums = "0,1,2,3,6,8,9,10,13,18") private byte sourceAddrNpi = NumberingPlanIndicator.UNKNOWN.value(); - @UriParam + @UriParam(enums = "0,1,2,3,6,8,9,10,13,18") private byte destAddrNpi = NumberingPlanIndicator.UNKNOWN.value(); @UriParam private String addressRange = ""; @UriParam private byte protocolId = (byte) 0; - @UriParam + @UriParam(enums = "0,1,2,3") private byte priorityFlag = (byte) 1; - @UriParam + @UriParam(enums = "0,1") private byte replaceIfPresentFlag = ReplaceIfPresentFlag.DEFAULT.value(); - @UriParam + @UriParam(enums = "0,1,2,3,4,5,6") private byte typeOfNumber = TypeOfNumber.UNKNOWN.value(); - @UriParam + @UriParam(enums = "0,1,2,3,6,8,9,10,13,18") private byte numberingPlanIndicator = NumberingPlanIndicator.UNKNOWN.value(); @UriParam private boolean usingSSL; @@ -137,6 +137,9 @@ public class SmppConfiguration implements Cloneable { return host; } + /** + * Hostname for the SMSC server to use. + */ public void setHost(String host) { this.host = host; } @@ -145,6 +148,9 @@ public class SmppConfiguration implements Cloneable { return port; } + /** + * Port number for the SMSC server to use. + */ public void setPort(Integer port) { this.port = port; } @@ -153,10 +159,16 @@ public class SmppConfiguration implements Cloneable { return systemId; } + /** + * The system id (username) for connecting to SMSC server. + */ public void setSystemId(String systemId) { this.systemId = systemId; } + /** + * The password for connecting to SMSC server. + */ public String getPassword() { return password; } @@ -165,6 +177,17 @@ public class SmppConfiguration implements Cloneable { return dataCoding; } + /** + * Defines the data coding according the SMPP 3.4 specification, section 5.2.19. + * Example data encodings are: + * <ul> + * <li>0: SMSC Default Alphabet</li> + * <li>3: Latin 1 (ISO-8859-1)</li> + * <li>4: Octet unspecified (8-bit binary)</li> + * <li>8: UCS2 (ISO/IEC-10646)</li> + * <li>13: Extended Kanji JIS(X 0212-1990)</li> + * </ul> + */ public void setDataCoding(byte dataCoding) { this.dataCoding = dataCoding; } @@ -173,14 +196,26 @@ public class SmppConfiguration implements Cloneable { return alphabet; } + /** + * Defines encoding of data according the SMPP 3.4 specification, section 5.2.19. + * <ul> + * <li>0: SMSC Default Alphabet + * <li>4: 8 bit Alphabet</li> + * <li>8: UCS2 Alphabet</li></li> + * </ul> + */ public void setAlphabet(byte alphabet) { this.alphabet = alphabet; } - + public String getEncoding() { return encoding; } + /** + * Defines the encoding scheme of the short message user data. + * Only for SubmitSm, ReplaceSm and SubmitMulti. + */ public void setEncoding(String encoding) { if (!Charset.isSupported(encoding)) { LOG.warn("Unsupported encoding \"{}\" is being set.", encoding); @@ -196,6 +231,10 @@ public class SmppConfiguration implements Cloneable { return enquireLinkTimer; } + /** + * Defines the interval in milliseconds between the confidence checks. + * The confidence check is used to test the communication path between an ESME and an SMSC. + */ public void setEnquireLinkTimer(Integer enquireLinkTimer) { this.enquireLinkTimer = enquireLinkTimer; } @@ -204,6 +243,11 @@ public class SmppConfiguration implements Cloneable { return transactionTimer; } + /** + * Defines the maximum period of inactivity allowed after a transaction, after which + * an SMPP entity may assume that the session is no longer active. + * This timer may be active on either communicating SMPP entity (i.e. SMSC or ESME). + */ public void setTransactionTimer(Integer transactionTimer) { this.transactionTimer = transactionTimer; } @@ -212,6 +256,9 @@ public class SmppConfiguration implements Cloneable { return systemType; } + /** + * This parameter is used to categorize the type of ESME (External Short Message Entity) that is binding to the SMSC (max. 13 characters). + */ public void setSystemType(String systemType) { this.systemType = systemType; } @@ -220,6 +267,14 @@ public class SmppConfiguration implements Cloneable { return registeredDelivery; } + /** + * Is used to request an SMSC delivery receipt and/or SME originated acknowledgements. The following values are defined: + * <ul> + * <li>0: No SMSC delivery receipt requested.</li> + * <li>1: SMSC delivery receipt requested where final delivery outcome is success or failure.</li> + * <li>2: SMSC delivery receipt requested where the final delivery outcome is delivery failure.</li> + * </ul> + */ public void setRegisteredDelivery(byte registeredDelivery) { this.registeredDelivery = registeredDelivery; } @@ -228,6 +283,18 @@ public class SmppConfiguration implements Cloneable { return serviceType; } + /** + * The service type parameter can be used to indicate the SMS Application service associated with the message. + * The following generic service_types are defined: + * <ul> + * <li>CMT: Cellular Messaging</li> + * <li>CPT: Cellular Paging</li> + * <li>VMN: Voice Mail Notification</li> + * <li>VMA: Voice Mail Alerting</li> + * <li>WAP: Wireless Application Protocol</li> + * <li>USSD: Unstructured Supplementary Services Data</li> + * </ul> + */ public void setServiceType(String serviceType) { this.serviceType = serviceType; } @@ -236,6 +303,19 @@ public class SmppConfiguration implements Cloneable { return sourceAddrTon; } + /** + * Defines the type of number (TON) to be used in the SME originator address parameters. + * The following TON values are defined: + * <ul> + * <li>0: Unknown</li> + * <li>1: International</li> + * <li>2: National</li> + * <li>3: Network Specific</li> + * <li>4: Subscriber Number</li> + * <li>5: Alphanumeric</li> + * <li>6: Abbreviated</li> + * </ul> + */ public void setSourceAddrTon(byte sourceAddrTon) { this.sourceAddrTon = sourceAddrTon; } @@ -244,6 +324,20 @@ public class SmppConfiguration implements Cloneable { return destAddrTon; } + /** + * Defines the type of number (TON) to be used in the SME destination address parameters. + * Only for SubmitSm, SubmitMulti, CancelSm and DataSm. + * The following TON values are defined: + * <ul> + * <li>0: Unknown</li> + * <li>1: International</li> + * <li>2: National</li> + * <li>3: Network Specific</li> + * <li>4: Subscriber Number</li> + * <li>5: Alphanumeric</li> + * <li>6: Abbreviated</li> + * </ul> + */ public void setDestAddrTon(byte destAddrTon) { this.destAddrTon = destAddrTon; } @@ -252,6 +346,22 @@ public class SmppConfiguration implements Cloneable { return sourceAddrNpi; } + /** + * Defines the numeric plan indicator (NPI) to be used in the SME originator address parameters. + * The following NPI values are defined: + * <ul> + * <li>0: Unknown</li> + * <li>1: ISDN (E163/E164)</li> + * <li>2: Data (X.121)</li> + * <li>3: Telex (F.69)</li> + * <li>6: Land Mobile (E.212)</li> + * <li>8: National</li> + * <li>9: Private</li> + * <li>10: ERMES</li> + * <li>13: Internet (IP)</li> + * <li>18: WAP Client Id (to be defined by WAP Forum)</li> + * </ul> + */ public void setSourceAddrNpi(byte sourceAddrNpi) { this.sourceAddrNpi = sourceAddrNpi; } @@ -260,6 +370,23 @@ public class SmppConfiguration implements Cloneable { return destAddrNpi; } + /** + * Defines the type of number (TON) to be used in the SME destination address parameters. + * Only for SubmitSm, SubmitMulti, CancelSm and DataSm. + * The following NPI values are defined: + * <ul> + * <li>0: Unknown</li> + * <li>1: ISDN (E163/E164)</li> + * <li>2: Data (X.121)</li> + * <li>3: Telex (F.69)</li> + * <li>6: Land Mobile (E.212)</li> + * <li>8: National</li> + * <li>9: Private</li> + * <li>10: ERMES</li> + * <li>13: Internet (IP)</li> + * <li>18: WAP Client Id (to be defined by WAP Forum)</li> + * </ul> + */ public void setDestAddrNpi(byte destAddrNpi) { this.destAddrNpi = destAddrNpi; } @@ -268,6 +395,9 @@ public class SmppConfiguration implements Cloneable { return protocolId; } + /** + * The protocol id + */ public void setProtocolId(byte protocolId) { this.protocolId = protocolId; } @@ -276,6 +406,17 @@ public class SmppConfiguration implements Cloneable { return priorityFlag; } + /** + * Allows the originating SME to assign a priority level to the short message. + * Only for SubmitSm and SubmitMulti. + * Four Priority Levels are supported: + * <ul> + * <li>0: Level 0 (lowest) priority</li> + * <li>1: Level 1 priority</li> + * <li>2: Level 2 priority</li> + * <li>3: Level 3 (highest) priority</li> + * </ul> + */ public void setPriorityFlag(byte priorityFlag) { this.priorityFlag = priorityFlag; } @@ -284,6 +425,16 @@ public class SmppConfiguration implements Cloneable { return replaceIfPresentFlag; } + /** + * Used to request the SMSC to replace a previously submitted message, that is still pending delivery. + * The SMSC will replace an existing message provided that the source address, destination address and service + * type match the same fields in the new message. + * The following replace if present flag values are defined: + * <ul> + * <li>0: Don't replace</li> + * <li>1: Replace</li> + * </ul> + */ public void setReplaceIfPresentFlag(byte replaceIfPresentFlag) { this.replaceIfPresentFlag = replaceIfPresentFlag; } @@ -292,6 +443,9 @@ public class SmppConfiguration implements Cloneable { return sourceAddr; } + /** + * Defines the address of SME (Short Message Entity) which originated this message. + */ public void setSourceAddr(String sourceAddr) { this.sourceAddr = sourceAddr; } @@ -300,6 +454,10 @@ public class SmppConfiguration implements Cloneable { return destAddr; } + /** + * Defines the destination SME address. For mobile terminated messages, this is the directory number of the recipient MS. + * Only for SubmitSm, SubmitMulti, CancelSm and DataSm. + */ public void setDestAddr(String destAddr) { this.destAddr = destAddr; } @@ -308,6 +466,19 @@ public class SmppConfiguration implements Cloneable { return typeOfNumber; } + /** + * Defines the type of number (TON) to be used in the SME. + * The following TON values are defined: + * <ul> + * <li>0: Unknown</li> + * <li>1: International</li> + * <li>2: National</li> + * <li>3: Network Specific</li> + * <li>4: Subscriber Number</li> + * <li>5: Alphanumeric</li> + * <li>6: Abbreviated</li> + * </ul> + */ public void setTypeOfNumber(byte typeOfNumber) { this.typeOfNumber = typeOfNumber; } @@ -316,6 +487,22 @@ public class SmppConfiguration implements Cloneable { return numberingPlanIndicator; } + /** + * Defines the numeric plan indicator (NPI) to be used in the SME. + * The following NPI values are defined: + * <ul> + * <li>0: Unknown</li> + * <li>1: ISDN (E163/E164)</li> + * <li>2: Data (X.121)</li> + * <li>3: Telex (F.69)</li> + * <li>6: Land Mobile (E.212)</li> + * <li>8: National</li> + * <li>9: Private</li> + * <li>10: ERMES</li> + * <li>13: Internet (IP)</li> + * <li>18: WAP Client Id (to be defined by WAP Forum)</li> + * </ul> + */ public void setNumberingPlanIndicator(byte numberingPlanIndicator) { this.numberingPlanIndicator = numberingPlanIndicator; } @@ -323,7 +510,10 @@ public class SmppConfiguration implements Cloneable { public boolean getUsingSSL() { return usingSSL; } - + + /** + * Whether using SSL with the smpps protocol + */ public void setUsingSSL(boolean usingSSL) { this.usingSSL = usingSSL; } @@ -332,6 +522,9 @@ public class SmppConfiguration implements Cloneable { return initialReconnectDelay; } + /** + * Defines the initial delay in milliseconds after the consumer/producer tries to reconnect to the SMSC, after the connection was lost. + */ public void setInitialReconnectDelay(long initialReconnectDelay) { this.initialReconnectDelay = initialReconnectDelay; } @@ -340,6 +533,9 @@ public class SmppConfiguration implements Cloneable { return reconnectDelay; } + /** + * Defines the interval in milliseconds between the reconnect attempts, if the connection to the SMSC was lost and the previous was not succeed. + */ public void setReconnectDelay(long reconnectDelay) { this.reconnectDelay = reconnectDelay; } @@ -348,6 +544,11 @@ public class SmppConfiguration implements Cloneable { return lazySessionCreation; } + /** + * Sessions can be lazily created to avoid exceptions, if the SMSC is not available when the Camel producer is started. + * Camel will check the in message headers 'CamelSmppSystemId' and 'CamelSmppPassword' of the first exchange. + * If they are present, Camel will use these data to connect to the SMSC. + */ public void setLazySessionCreation(boolean lazySessionCreation) { this.lazySessionCreation = lazySessionCreation; } @@ -355,7 +556,10 @@ public class SmppConfiguration implements Cloneable { public String getHttpProxyHost() { return httpProxyHost; } - + + /** + * If you need to tunnel SMPP through a HTTP proxy, set this attribute to the hostname or ip address of your HTTP proxy. + */ public void setHttpProxyHost(String httpProxyHost) { this.httpProxyHost = httpProxyHost; } @@ -363,7 +567,10 @@ public class SmppConfiguration implements Cloneable { public Integer getHttpProxyPort() { return httpProxyPort; } - + + /** + * If you need to tunnel SMPP through a HTTP proxy, set this attribute to the port of your HTTP proxy. + */ public void setHttpProxyPort(Integer httpProxyPort) { this.httpProxyPort = httpProxyPort; } @@ -371,7 +578,10 @@ public class SmppConfiguration implements Cloneable { public String getHttpProxyUsername() { return httpProxyUsername; } - + + /** + * If your HTTP proxy requires basic authentication, set this attribute to the username required for your HTTP proxy. + */ public void setHttpProxyUsername(String httpProxyUsername) { this.httpProxyUsername = httpProxyUsername; } @@ -379,7 +589,10 @@ public class SmppConfiguration implements Cloneable { public String getHttpProxyPassword() { return httpProxyPassword; } - + + /** + * If your HTTP proxy requires basic authentication, set this attribute to the password required for your HTTP proxy. + */ public void setHttpProxyPassword(String httpProxyPassword) { this.httpProxyPassword = httpProxyPassword; } @@ -388,6 +601,9 @@ public class SmppConfiguration implements Cloneable { return sessionStateListener; } + /** + * You can refer to a org.jsmpp.session.SessionStateListener in the Registry to receive callbacks when the session state changed. + */ public void setSessionStateListener(SessionStateListener sessionStateListener) { this.sessionStateListener = sessionStateListener; } @@ -396,6 +612,10 @@ public class SmppConfiguration implements Cloneable { return addressRange; } + /** + * You can specify the address range for the SmppConsumer as defined in section 5.2.7 of the SMPP 3.4 specification. + * The SmppConsumer will receive messages only from SMSC's which target an address (MSISDN or IP address) within this range. + */ public void setAddressRange(String addressRange) { this.addressRange = addressRange; } @@ -404,6 +624,15 @@ public class SmppConfiguration implements Cloneable { return splittingPolicy; } + /** + * You can specify a policy for handling long messages: + * <ul> + * <li>ALLOW - the default, long messages are split to 140 bytes per message</li> + * <li>TRUNCATE - long messages are split and only the first fragment will be sent to the SMSC. + * Some carriers drop subsequent fragments so this reduces load on the SMPP connection sending parts of a message that will never be delivered.</li> + * <li>REJECT - if a message would need to be split, it is rejected with an SMPP NegativeResponseException and the reason code signifying the message is too long.</li> + * </ul> + */ public void setSplittingPolicy(SmppSplittingPolicy splittingPolicy) { this.splittingPolicy = splittingPolicy; } http://git-wip-us.apache.org/repos/asf/camel/blob/4a3dfb5c/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppEndpoint.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppEndpoint.java index 53656f2..99cd38f 100644 --- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppEndpoint.java +++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppEndpoint.java @@ -34,7 +34,7 @@ import org.jsmpp.bean.DeliverSm; * * @version */ -@UriEndpoint(scheme = "smpp", title = "SMPP", syntax = "smpp:host:port", consumerClass = SmppConsumer.class, label = "mobile,messaging") +@UriEndpoint(scheme = "smpp,smpps", title = "SMPP", syntax = "smpp:host:port", consumerClass = SmppConsumer.class, label = "mobile,messaging") public class SmppEndpoint extends DefaultEndpoint { private SmppBinding binding;