public abstract class

Transaction

extends Observable
java.lang.Object
   ↳ com.android.mms.transaction.Observable
     ↳ com.android.mms.transaction.Transaction
Known Direct Subclasses

Class Overview

Transaction is an abstract class for notification transaction, send transaction and other transactions described in MMS spec. It provides the interfaces of them and some common methods for them.

Summary

Constants
int NOTIFICATION_TRANSACTION Identifies push requests.
int READREC_TRANSACTION Identifies send read report requests.
int RETRIEVE_TRANSACTION Identifies deferred retrieve requests.
int SEND_TRANSACTION Identifies send multimedia message requests.
Fields
protected Context mContext
protected String mId
protected TransactionSettings mTransactionSettings
protected TransactionState mTransactionState
Public Constructors
Transaction(Context context, int serviceId, TransactionSettings settings)
Public Methods
TransactionSettings getConnectionSettings()
int getServiceId()
Get the service-id of this transaction which was assigned by the framework.
TransactionState getState()
Returns the transaction state of this transaction.
abstract int getType()
Get the type of the transaction.
boolean isEquivalent(Transaction transaction)
Used to determine whether a transaction is equivalent to this instance.
static int lookupHost(String hostname)
Look up a host name and return the result as an int.
abstract void process()
An instance of Transaction encapsulates the actions required during a MMS Client transaction.
void setConnectionSettings(TransactionSettings settings)
String toString()
Protected Methods
byte[] getPdu(String url)
A common method to retrieve a PDU from MMSC.
byte[] sendPdu(byte[] pdu)
A common method to send a PDU to MMSC.
byte[] sendPdu(long token, byte[] pdu)
A common method to send a PDU to MMSC.
byte[] sendPdu(byte[] pdu, String mmscUrl)
A common method to send a PDU to MMSC.
byte[] sendPdu(long token, byte[] pdu, String mmscUrl)
A common method to send a PDU to MMSC.
[Expand]
Inherited Methods
From class com.android.mms.transaction.Observable
From class java.lang.Object

Constants

public static final int NOTIFICATION_TRANSACTION

Identifies push requests.

Constant Value: 0 (0x00000000)

public static final int READREC_TRANSACTION

Identifies send read report requests.

Constant Value: 3 (0x00000003)

public static final int RETRIEVE_TRANSACTION

Identifies deferred retrieve requests.

Constant Value: 1 (0x00000001)

public static final int SEND_TRANSACTION

Identifies send multimedia message requests.

Constant Value: 2 (0x00000002)

Fields

protected Context mContext

protected String mId

protected TransactionSettings mTransactionSettings

protected TransactionState mTransactionState

Public Constructors

public Transaction (Context context, int serviceId, TransactionSettings settings)

Public Methods

public TransactionSettings getConnectionSettings ()

public int getServiceId ()

Get the service-id of this transaction which was assigned by the framework.

Returns
  • the service-id of the transaction

public TransactionState getState ()

Returns the transaction state of this transaction.

Returns
  • Current state of the Transaction.

public abstract int getType ()

Get the type of the transaction.

Returns
  • Transaction type in integer.

public boolean isEquivalent (Transaction transaction)

Used to determine whether a transaction is equivalent to this instance.

Parameters
transaction the transaction which is compared to this instance.
Returns
  • true if transaction is equivalent to this instance, false otherwise.

public static int lookupHost (String hostname)

Look up a host name and return the result as an int. Works if the argument is an IP address in dot notation. Obviously, this can only be used for IPv4 addresses.

Parameters
hostname the name of the host (or the IP address)
Returns
  • the IP address as an int in network byte order

public abstract void process ()

An instance of Transaction encapsulates the actions required during a MMS Client transaction.

public void setConnectionSettings (TransactionSettings settings)

public String toString ()

Protected Methods

protected byte[] getPdu (String url)

A common method to retrieve a PDU from MMSC.

Parameters
url The URL of the message which we are going to retrieve.
Returns
  • A byte array which contains the data of the PDU. If the status code is not correct, an IOException will be thrown.
Throws
IOException if any error occurred on network interface or an HTTP error code(>=400) returned from the server.

protected byte[] sendPdu (byte[] pdu)

A common method to send a PDU to MMSC.

Parameters
pdu A byte array which contains the data of the PDU.
Returns
  • A byte array which contains the response data. If an HTTP error code is returned, an IOException will be thrown.
Throws
IOException if any error occurred on network interface or an HTTP error code(>=400) returned from the server.

protected byte[] sendPdu (long token, byte[] pdu)

A common method to send a PDU to MMSC.

Parameters
token The token to identify the sending progress.
pdu A byte array which contains the data of the PDU.
Returns
  • A byte array which contains the response data. If an HTTP error code is returned, an IOException will be thrown.
Throws
IOException if any error occurred on network interface or an HTTP error code(>=400) returned from the server.

protected byte[] sendPdu (byte[] pdu, String mmscUrl)

A common method to send a PDU to MMSC.

Parameters
pdu A byte array which contains the data of the PDU.
mmscUrl Url of the recipient MMSC.
Returns
  • A byte array which contains the response data. If an HTTP error code is returned, an IOException will be thrown.
Throws
IOException if any error occurred on network interface or an HTTP error code(>=400) returned from the server.

protected byte[] sendPdu (long token, byte[] pdu, String mmscUrl)

A common method to send a PDU to MMSC.

Parameters
token The token to identify the sending progress.
pdu A byte array which contains the data of the PDU.
mmscUrl Url of the recipient MMSC.
Returns
  • A byte array which contains the response data. If an HTTP error code is returned, an IOException will be thrown.
Throws
IOException if any error occurred on network interface or an HTTP error code(>=400) returned from the server.