?? request.java
字號(hào):
/*
* Copyright (c) 1996-2001
* Logica Mobile Networks Limited
* All rights reserved.
*
* This software is distributed under Logica Open Source License Version 1.0
* ("Licence Agreement"). You shall use it and distribute only in accordance
* with the terms of the License Agreement.
*
*/
package org.smpp.pdu;
/**
* Represents a PDU request. All classes which are used as SMPP requests are
* derived from this class.
*
* @author Logica Mobile Networks SMPP Open Source Team
* @version $Revision: 1.1 $
*/
public abstract class Request extends PDU {
/**
* This method should instantiate a response corresponding to the request.
*/
protected abstract Response createResponse();
/** Create a request PDU with default parameters. */
public Request() {
}
/**
* Create request PDU with given command id.
* Derived classes usually uses <code>super(THE_COMMAND_ID)</code>
* where the <code>THE_COMMAND_ID</code> is the command id of the
* PDU the derived class represents.
*/
public Request(int commandId) {
super(commandId);
}
/**
* This method is used to create generate a response corresponding to
* this request. It creates the response using <code>createResponse</code>
* and then sets the sequence number of the response to the sequence
* number of this request. This way is ensured automatic matching
* of the response to the request.
* The created response is set this as the original request.
* @see #createResponse()
* @see Response#setOriginalRequest(Request)
*/
public Response getResponse() {
Response response = createResponse();
response.setSequenceNumber(getSequenceNumber());
response.setOriginalRequest(this);
return response;
}
/**
* Returns the command id of the corresponing response.
*/
public int getResponseCommandId() {
Response response = createResponse();
return response.getCommandId();
}
/**
* Returns true. If the derived class cannot respond, then it must
* overwrite this function to return false.
* @see PDU#canResponse()
*/
public boolean canResponse() {
return true;
}
/**
* Returns true.
* @see PDU#isRequest()
*/
public boolean isRequest() {
return true;
}
/** Returns false.
* @see PDU#isResponse()
*/
public boolean isResponse() {
return false;
}
}
/*
* $Log: Request.java,v $
* Revision 1.1 2003/07/23 00:28:39 sverkera
* Imported
*
*
* Old changelog:
* 02-10-01 ticp@logica.com comments added, indentation changed -> spaces
* 09-10-01 ticp@logica.com added registration of the request as original request
* to the response created by getResponse
*/
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -