Skip navigation links

Oracle Communications Converged Application Server Java API Reference
5.0

E18767-01


com.bea.wcp.diameter
Class Application

java.lang.Object
  extended by com.bea.wcp.diameter.Application

Direct Known Subclasses:
ClientApplication, RelayApplication, Simulator

public abstract class Application
extends java.lang.Object

Base class for all Diameter applications. A Diameter application must extend this class to return the application identifier as well as provide optional handling for messages received without an associated session. The application class is also used as the factory for creating new Diameter session objects.


Constructor Summary
Application()
           

 

Method Summary
 Request createRequest(Command cmd)
          Creates a new Request for this application but with no associated session.
protected  java.lang.String createSessionId()
          Called by Session constructor when creating new session ids.
 java.lang.String getDestinationHost()
          Returns the defautl destination host for requests.
 java.lang.String getDestinationRealm()
          Returns the default destination realm for requests.
abstract  ApplicationId getId()
          Returns the ApplicationId for the application.
 java.lang.String getName()
          Returns the name of the application.
 Node getNode()
          Returns the Diameter Node hosting the application.
 java.lang.String getOriginHost()
          Returns the configured host name for the Diameter entity hosting this application.
 java.lang.String getOriginRealm()
          Returns the configured realm name for the Diameter entity hosting this application.
 java.lang.String getParameter(java.lang.String name)
          Returns the value of the initialization parameter with the specified name.
 java.lang.String getParameter(java.lang.String name, java.lang.String def)
          Returns the value of the initialization parameter with the specified name, or a default value if not found.
protected  void init()
          Called by the container to initialize the application.
 void log(java.lang.String msg)
          Writes the specified message to the application log.
 void log(java.lang.String msg, java.lang.Throwable e)
          Writes the specified message and exception to the application log.
protected  void rcvAnswer(Answer ans)
          Called by the container when a new Answer has been received for this application.
 void rcvMessage(Message msg)
          Called by the container when a new Message has been received for this application.
protected  void rcvRequest(Request req)
          Called by the container when a new Request has been received for this application.
 void setDestinationHost(java.lang.String host)
          Sets the default destination host for requests.
 void setDestinationRealm(java.lang.String realm)
          Sets the default destination realm for requests.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

Application

public Application()

Method Detail

init

protected void init()
             throws DiameterException
Called by the container to initialize the application. Applications override this method to perform application specific initialization.
Throws:
DiameterException - if the initialization failed

getName

public final java.lang.String getName()
Returns the name of the application. Each application instance must have a unique name determined by the configuration.

getId

public abstract ApplicationId getId()
Returns the ApplicationId for the application.
Returns:
the application's ApplicationId

getParameter

public final java.lang.String getParameter(java.lang.String name)
Returns the value of the initialization parameter with the specified name.
Parameters:
name - the parameter name
Returns:
the value of the parameter, or null if not found

getParameter

public final java.lang.String getParameter(java.lang.String name,
                                           java.lang.String def)
Returns the value of the initialization parameter with the specified name, or a default value if not found.
Parameters:
name - the parameter name
def - the default value of the parameter if not found
Returns:
the value of the parameter, or default if not found

getNode

public final Node getNode()
Returns the Diameter Node hosting the application.

rcvMessage

public void rcvMessage(Message msg)
                throws DiameterException,
                       java.io.IOException
Called by the container when a new Message has been received for this application. The default behavior is to call @{link #rcvRequest()} for a Request and @{link #rcvAnswer()} for an Answer message.
Parameters:
msg - the Message that has been received
Throws:
DiameterException - if an error occurred while processing the message
java.io.IOException - if an I/O error occurred

rcvRequest

protected void rcvRequest(Request req)
                   throws DiameterException,
                          java.io.IOException
Called by the container when a new Request has been received for this application. The default behavior is to respond with the Answer UNKNOWN_SESSION_ID for requests with a Session-Id AVP or otherwise the Answer UNABLE_TO_COMPLY. Requests are first delivered to a matching Session object if found, so overriding this method is only necessary if the application does not use sessions or is a server application which will be creating new Session objects for received requests.
Parameters:
req - the Request that was received
Throws:
DiameterException - if an error occurred while processing the message
java.io.IOException - if an I/O error occurred

rcvAnswer

protected void rcvAnswer(Answer ans)
                  throws DiameterException,
                         java.io.IOException
Called by the container when a new Answer has been received for this application. The default behavior is to ignore the answer. Overriding this method is only necessary if the application is sending requests with no associated session, as otherwise the answer will be delivered to the associated Session object directly.
Parameters:
ans - the Answer that was received
Throws:
DiameterException - if an error occurred while processing the answer
java.io.IOException - if an I/O error occurred

createRequest

public Request createRequest(Command cmd)
Creates a new Request for this application but with no associated session. Use #Session.createRequest() instead on an existing session if the request should have an associated session.
Parameters:
cmd - the Command for the request
Returns:
the new Request

createSessionId

protected java.lang.String createSessionId()
Called by Session constructor when creating new session ids. Applications can optionally override this class for encoding additional application specified information in session ids.
Returns:
the new id for the session

getOriginRealm

public java.lang.String getOriginRealm()
Returns the configured realm name for the Diameter entity hosting this application.
Returns:
the origin realm for this application

getOriginHost

public java.lang.String getOriginHost()
Returns the configured host name for the Diameter entity hosting this application.
Returns:
the origin host for this application

setDestinationRealm

public void setDestinationRealm(java.lang.String realm)
Sets the default destination realm for requests.
Parameters:
realm - the new default destination realm

setDestinationHost

public void setDestinationHost(java.lang.String host)
Sets the default destination host for requests.
Parameters:
host - the new default destination host

getDestinationRealm

public java.lang.String getDestinationRealm()
Returns the default destination realm for requests.
Returns:
the default destination realm, or null if none

getDestinationHost

public java.lang.String getDestinationHost()
Returns the defautl destination host for requests.
Returns:
the default destination host, or null if none

log

public void log(java.lang.String msg)
Writes the specified message to the application log.
Parameters:
msg - the message to be logged

log

public void log(java.lang.String msg,
                java.lang.Throwable e)
Writes the specified message and exception to the application log.
Parameters:
msg - the message to be logged
e - the exception to be logged

Skip navigation links

Oracle Communications Converged Application Server Java API Reference
5.0

E18767-01


Copyright © 2005, 2010, Oracle and/or its affiliates. All rights reserved.