ie.omk.smpp.version
Class SMPPVersion

java.lang.Object
  extended by ie.omk.smpp.version.SMPPVersion
Direct Known Subclasses:
SMPPVersion33, SMPPVersion34

public abstract class SMPPVersion
extends Object

Class representing an SMPP protocol version. Instances of this object are used by the rest of the API to determine is an SMPP message is supported by a certain version of the protocol.

Since:
0.3.0
Author:
Oran Kelly

Field Summary
static int MESSAGE_PAYLOAD
          Constant representing the message payload mandatory parameter.
static SMPPVersion V33
          Static SMPPVersion instance representing version SMPP v3.3.
static SMPPVersion V34
          Static SMPPVersion instance representing version SMPP v3.4.
 
Constructor Summary
protected SMPPVersion(int versionID, String versionString)
          Create a new SMPPVersion object.
 
Method Summary
 boolean equals(int versionNum)
          Test versionNum is the numeric representation of this SMPP version.
 boolean equals(Object obj)
          Test another SMPPVersion object for equality with this one.
static SMPPVersion getDefaultVersion()
          Get an object representing the default version of the API, which is 3.4.
abstract  int getMaxLength(int field)
          Get the maximum allowed length for a particular field.
static SMPPVersion getVersion(int id)
           
 int getVersionID()
          Get the integer value for this protocol version object.
 int hashCode()
           
 boolean isNewer(SMPPVersion ver)
          Check if a version is newer than this one.
 boolean isOlder(SMPPVersion ver)
          Check if a version is older than this one.
abstract  boolean isSupported(int commandID)
          Determine if a particular command is supported by this protocol version.
abstract  boolean isSupportOptionalParams()
          Determine if this SMPP version supports optional parameters.
 String toString()
          Return a descriptive string of this protocol version.
abstract  boolean validateAddress(Address s)
          Validate and SMPP address for this SMPP version number.
abstract  boolean validateAddressRange(String addressRange)
           
abstract  boolean validateDataCoding(int dc)
          Validate the data coding mandatory parameter.
abstract  boolean validateDefaultMsg(int id)
          Validate the default message ID mandatory parameter.
abstract  boolean validateDistListName(String name)
           
abstract  boolean validateErrorCode(int code)
          Validate the error code mandatory parameter.
abstract  boolean validateEsmClass(int c)
          Validate the ESM class mandatory parameter.
abstract  boolean validateMessage(byte[] message, MessageEncoding encoding)
          Validate the length of the message bytes.
abstract  boolean validateMessageId(String id)
          Validate the message ID mandatory parameter.
abstract  boolean validateMessageState(int state)
          Validate the message state mandatory parameter.
 boolean validateMessageStatus(int st)
          Validate the message state mandatory parameter.
abstract  boolean validateMessageText(String text, AlphabetEncoding alphabet)
          Validate the message text length.
abstract  boolean validateNumberOfDests(int num)
           
abstract  boolean validateNumUnsuccessful(int num)
           
abstract  boolean validateParamName(String paramName)
           
abstract  boolean validateParamValue(String paramValue)
           
abstract  boolean validatePassword(String password)
           
abstract  boolean validatePriorityFlag(int flag)
           
abstract  boolean validateProtocolID(int id)
          Validate the Protocol ID mandatory parameter.
abstract  boolean validateRegisteredDelivery(int flag)
           
abstract  boolean validateReplaceIfPresent(int flag)
           
abstract  boolean validateServiceType(String type)
          Validate the service type mandatory parameter.
abstract  boolean validateSystemId(String sysId)
           
abstract  boolean validateSystemType(String sysType)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MESSAGE_PAYLOAD

public static final int MESSAGE_PAYLOAD
Constant representing the message payload mandatory parameter.

See Also:
Constant Field Values

V33

public static final SMPPVersion V33
Static SMPPVersion instance representing version SMPP v3.3.


V34

public static final SMPPVersion V34
Static SMPPVersion instance representing version SMPP v3.4.

Constructor Detail

SMPPVersion

protected SMPPVersion(int versionID,
                      String versionString)
Create a new SMPPVersion object.

Method Detail

getDefaultVersion

public static final SMPPVersion getDefaultVersion()
Get an object representing the default version of the API, which is 3.4.


getVersion

public static final SMPPVersion getVersion(int id)
                                    throws VersionException
Throws:
VersionException

getVersionID

public int getVersionID()
Get the integer value for this protocol version object.


isOlder

public boolean isOlder(SMPPVersion ver)
Check if a version is older than this one. If ver is equal to this version, false will be returned.


isNewer

public boolean isNewer(SMPPVersion ver)
Check if a version is newer than this one. If ver is equal to this version, false will be returned.


equals

public boolean equals(Object obj)
Test another SMPPVersion object for equality with this one.

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
the hash code for this SMPP version.

equals

public boolean equals(int versionNum)
Test versionNum is the numeric representation of this SMPP version.


toString

public String toString()
Return a descriptive string of this protocol version.

Overrides:
toString in class Object

getMaxLength

public abstract int getMaxLength(int field)
Get the maximum allowed length for a particular field.


isSupported

public abstract boolean isSupported(int commandID)
Determine if a particular command is supported by this protocol version. This method takes any valid SMPP command ID (for both requests and responses) and returns true or false based on whether the protocol version this object represents supports that command or not.

Parameters:
commandID - the SMPP command ID to check support for.

isSupportOptionalParams

public abstract boolean isSupportOptionalParams()
Determine if this SMPP version supports optional parameters.

Returns:
true if optional parameters are supported, false if they are not.

validateAddress

public abstract boolean validateAddress(Address s)
Validate and SMPP address for this SMPP version number.


validateEsmClass

public abstract boolean validateEsmClass(int c)
Validate the ESM class mandatory parameter.


validateProtocolID

public abstract boolean validateProtocolID(int id)
Validate the Protocol ID mandatory parameter.


validateDataCoding

public abstract boolean validateDataCoding(int dc)
Validate the data coding mandatory parameter.


validateDefaultMsg

public abstract boolean validateDefaultMsg(int id)
Validate the default message ID mandatory parameter.


validateMessageText

public abstract boolean validateMessageText(String text,
                                            AlphabetEncoding alphabet)
Validate the message text length.


validateMessage

public abstract boolean validateMessage(byte[] message,
                                        MessageEncoding encoding)
Validate the length of the message bytes.


validateServiceType

public abstract boolean validateServiceType(String type)
Validate the service type mandatory parameter.


validateMessageId

public abstract boolean validateMessageId(String id)
Validate the message ID mandatory parameter.


validateMessageStatus

public final boolean validateMessageStatus(int st)
Validate the message state mandatory parameter. The message state and message status are the same. The name of the parameter changed between version 3.3 and version 3.4. The semantics, however, remain the same.


validateMessageState

public abstract boolean validateMessageState(int state)
Validate the message state mandatory parameter. The message state and message status are the same. The name of the parameter changed between version 3.3 and version 3.4. The semantics, however, remain the same.


validateErrorCode

public abstract boolean validateErrorCode(int code)
Validate the error code mandatory parameter.


validatePriorityFlag

public abstract boolean validatePriorityFlag(int flag)

validateRegisteredDelivery

public abstract boolean validateRegisteredDelivery(int flag)

validateReplaceIfPresent

public abstract boolean validateReplaceIfPresent(int flag)

validateNumberOfDests

public abstract boolean validateNumberOfDests(int num)

validateNumUnsuccessful

public abstract boolean validateNumUnsuccessful(int num)

validateDistListName

public abstract boolean validateDistListName(String name)

validateSystemId

public abstract boolean validateSystemId(String sysId)

validatePassword

public abstract boolean validatePassword(String password)

validateSystemType

public abstract boolean validateSystemType(String sysType)

validateAddressRange

public abstract boolean validateAddressRange(String addressRange)

validateParamName

public abstract boolean validateParamName(String paramName)

validateParamValue

public abstract boolean validateParamValue(String paramValue)


Copyright © 2011 smppapi at Sourceforge. All Rights Reserved.