public class Session extends Object implements Externalizable
Constructor and Description |
---|
Session()
Used by Externalizable.
|
Session(Application app)
Creates a new client Session for the specified Application.
|
Session(Application app,
String id)
Creates a new server Session for the specified Application and session id.
|
Session(Application app,
String id,
Object parent)
Creates a new server Session for the specified Application and session id.
|
Modifier and Type | Method and Description |
---|---|
XmlBuffer |
appendXml(XmlBuffer xb) |
Request |
createRequest(Command cmd)
Creates a new Request for this session.
|
Object |
getAdapter() |
Application |
getApplication()
Returns the Application for this Session.
|
Object |
getAttribute(String name)
Returns the value of the specified session attribute.
|
String |
getId()
Returns the session identifier.
|
SessionListener |
getListener()
Returns the SessionListener for this session.
|
boolean |
isTerminated()
Returns true if this session has been terminated.
|
protected void |
notifyListener(Message msg)
Delivers the specified message to the session listener.
|
protected void |
rcvAnswer(Answer ans)
Called when an answer message has been received for this session.
|
void |
rcvMessage(Message msg)
Called when a new Request or Answer has been received for this session.
|
protected void |
rcvRequest(Request req)
Called when a new request message has been received for this session.
|
void |
readExternal(ObjectInput is) |
void |
removeAttribute(String name)
Removes the session attribute with the specified name.
|
void |
setAdapter(Object adapter) |
void |
setAttribute(String name,
Object value)
Sets the new value of a session attribute, replacing any previous value.
|
void |
setListener(SessionListener listener)
Sets the SessionListener for this session.
|
void |
sndMessage(Message msg)
Called by the container when a message is about to be sent but before
it has been committed.
|
void |
terminate()
Terminates the session.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
public Session()
public Session(Application app, String id, Object parent)
app
- the Application for the sessionid
- the session idparent
- the Parent Session of this sessionIllegalStateException
- if a session with the same id has already been createdpublic Session(Application app, String id)
app
- the Application for the sessionid
- the session idIllegalStateException
- if a session with the same id has already been createdpublic Session(Application app)
app
- the Application for the sessionpublic void setListener(SessionListener listener)
listener
- the new SessionListenerpublic SessionListener getListener()
public Object getAdapter()
public void setAdapter(Object adapter)
public final String getId()
public final Application getApplication()
public void setAttribute(String name, Object value)
name
- the attribute namevalue
- the new attribute valuepublic Object getAttribute(String name)
name
- the attribute namepublic void removeAttribute(String name)
name
- the attribute namepublic void terminate()
public boolean isTerminated()
public Request createRequest(Command cmd)
cmd
- the command for the requestprotected void notifyListener(Message msg) throws DiameterException, IOException
msg
- the message to be deliveredDiameterException
IOException
public void rcvMessage(Message msg) throws DiameterException, IOException
msg
- the message that has been receivedIOException
- if an error occured while processing the messageDiameterException
protected void rcvRequest(Request req) throws DiameterException, IOException
req
- the request that has been receivedIOException
- if an error occurred while processing the requestDiameterException
protected void rcvAnswer(Answer ans) throws DiameterException, IOException
ans
- the answer message that has been receivedIOException
- if an error occured while processing the answerDiameterException
public void sndMessage(Message msg) throws IOException
msg
- the message being sentIOException
- if an I/O error occurred while sending the messagepublic void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput is) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException