Oracle Corp.

Oracle WebLogic Communications Server 10.1 API Reference


com.bea.wcp.diameter
Class Session

java.lang.Object
  extended bycom.bea.wcp.diameter.Session
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ClientSession, ClientSession, ShSession, Simulator.ServerSession

public class Session
extends java.lang.Object
implements java.io.Serializable

Base class for Diameter application sessions. Diameter applications extend this class in order to provide application-specific handling of requests or answer messages for the application.

See Also:
Serialized Form
Copyright © 2008 Oracle Corp. All Rights Reserved.

Constructor Summary
Session(Application app)
          Creates a new client Session for the specified Application.
Session(Application app, java.lang.String id)
          Creates a new server Session for the specified Application and session id.
 
Method Summary
 Request createRequest(Command cmd)
          Creates a new Request for this session.
 Application getApplication()
          Returns the Application for this Session.
 java.lang.Object getAttribute(java.lang.String name)
          Returns the value of the specified session attribute.
 java.lang.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)
          Deliver specified message to 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 http://news.com.com/2061-10802_3-6160230.html?tag=nefd.aoffor this session.
protected  void rcvRequest(Request req)
          Called when a new request message has been received for this session.
 void removeAttribute(java.lang.String name)
          Removes the session attribute with the specified name.
 void setAttribute(java.lang.String name, java.lang.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.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Session

public Session(Application app)
Creates a new client Session for the specified Application. The session id will be created by calling @{link Application#createSessionId()}.


Session

public Session(Application app,
               java.lang.String id)
Creates a new server Session for the specified Application and session id. This constructor is used by server applications when creating a Session for an existing session id.

Throws:
java.lang.IllegalStateException - if a session with the same id has already been created
Method Detail

createRequest

public Request createRequest(Command cmd)
Creates a new Request for this session. If the application has a default destination realm and/or host, then they will be used for the new request.

Parameters:
cmd - the command for the request
Returns:
the new Request

getApplication

public final Application getApplication()
Returns the Application for this Session.


getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Returns the value of the specified session attribute.

Parameters:
name - the attribute name
Returns:
the attribute value, or null if not found

getId

public final java.lang.String getId()
Returns the session identifier.


getListener

public SessionListener getListener()
Returns the SessionListener for this session.

Returns:
the SessionListener, or null if none.
Since:
3.1

isTerminated

public boolean isTerminated()
Returns true if this session has been terminated.

Returns:
true if the session is terminated, false if not

notifyListener

protected void notifyListener(Message msg)
                       throws DiameterException,
                              java.io.IOException
Deliver specified message to session listener. Does nothing if a session listener has not been set. Sessions which override rcvRequest() or rcvAnswer() must use this method to optionally forward the message to the session lisener.

Parameters:
msg - the message to be delivered
Throws:
DiameterException
java.io.IOException

rcvAnswer

protected void rcvAnswer(Answer ans)
                  throws DiameterException,
                         java.io.IOException
Called when an answer message has been received for this session. Session implementations should override this method to provide application specific handling of answer messages. The default behavior is to ignore the answer.

Parameters:
ans - the answer message that has been received
Throws:
java.io.IOException - if an error occured while processing the answer
DiameterException

rcvMessage

public void rcvMessage(Message msg)
                throws DiameterException,
                       java.io.IOException
Called when a new Request or Answer has been received http://news.com.com/2061-10802_3-6160230.html?tag=nefd.aoffor this session. The default behavior is to call rcvRequest() for a request or rcvAnswer() for an answer message. Session implementations should not override this method directly but override rcvRequest() or rcvAnswer() instead.

Parameters:
msg - the message that has been received
Throws:
java.io.IOException - if an error occured while processing the message
DiameterException

rcvRequest

protected void rcvRequest(Request req)
                   throws DiameterException,
                          java.io.IOException
Called when a new request message has been received for this session. Session implementations should override this method to provide application specific handling of requests. The default behavior is to send the error answer UNABLE_TO_COMPLY.

Parameters:
req - the request that has been received
Throws:
java.io.IOException - if an error occurred while processing the request
DiameterException

removeAttribute

public void removeAttribute(java.lang.String name)
Removes the session attribute with the specified name.

Parameters:
name - the attribute name

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Sets the new value of a session attribute, replacing any previous value.

Parameters:
name - the attribute name
value - the new attribute value

setListener

public void setListener(SessionListener listener)
Sets the SessionListener for this session. The listener will be invoked for all messages received by the session.

Parameters:
listener - the new SessionListener

sndMessage

public void sndMessage(Message msg)
                throws java.io.IOException
Called by the container when a message is about to be sent but before it has been committed. This gives the Session a chance to update any state that may change when a message has been sent out.

Parameters:
msg - the message being sent
Throws:
java.io.IOException - if an I/O error occurred while sending the message

terminate

public void terminate()
Terminates the session.


toString

public java.lang.String toString()

Documentation is available at
http://e-docs.bea.com/wlcp/wlss40/
Copyright 2008 Oracle Corp.