org.jdiameter.api
Class StackManager

java.lang.Object
  extended by org.jdiameter.api.StackManager

public final class StackManager
extends java.lang.Object

The basic service for managing a set of Diameter stacks.

As part of its initialization, the DriverManager class will attempt to load the stacks classes referenced in the "diameter.drivers" system property. This allows a user to customize the Diameter Drivers used by their applications. For example in your ~/.hotjava/properties file you might specify:

 diameter.drivers=foo.bah.Stack:wombat.diameter.Stack
 
A program can also explicitly load Diameter stacks at any time. For example, the my.diameter.Stack is loaded with the following statement:
 Class.forName("my.diameter.Stack");
 

When the method getSession is called, the StackManager will attempt to locate a suitable stack from amongst those loaded at initialization and those loaded explicitly using the same classloader as the current applet or application.

Version:
1.5.1 Final

Method Summary
static void deregisterStack(Stack stack)
          Drops a driver from the DiameterManager's list.
static java.io.PrintWriter getLogWriter()
          Retrieves the log writer.
static Stack getStack(java.lang.String className)
          Attempts to locate a stack.
static java.util.Enumeration<Stack> getStacks()
          Retrieves an Enumeration with all of the currently loaded Diameter stacks to which the current caller has access.
static void println(java.lang.String message)
           
static void registerStack(Stack stack)
          Registers the given stack with the ScoketManager.
static void setLogWriter(java.io.PrintWriter out)
          Sets the logging/tracing PrintWriter object that is used by the StackManager and all drivers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLogWriter

public static java.io.PrintWriter getLogWriter()
Retrieves the log writer. The getLogWriter and setLogWriter methods should be used instead of the get/setlogStream methods, which are deprecated.

Returns:
a java.io.PrintWriter object
See Also:
setLogWriter(java.io.PrintWriter)

setLogWriter

public static void setLogWriter(java.io.PrintWriter out)
Sets the logging/tracing PrintWriter object that is used by the StackManager and all drivers.

There is a minor versioning problem created by the introduction of the method setLogWriter. The method setLogWriter cannot create a PrintStream object that will be returned by getLogStream

Parameters:
out - the new logging/tracing PrintStream object; null to disable logging and tracing
Throws:
java.lang.SecurityException - if a security manager exists and its checkPermission method denies setting the log writer

getStack

public static Stack getStack(java.lang.String className)
                      throws InternalException
Attempts to locate a stack. The StackManager attempts to select an appropriate stack from the set of registered Diameter stacks.

Parameters:
className - class name of stack
Returns:
stack instance
Throws:
InternalException - if a manager has internal error

registerStack

public static void registerStack(Stack stack)
                          throws InternalException
Registers the given stack with the ScoketManager. A newly-loaded stack class should call the method registerStack to make itself known to the StackManager.

Parameters:
stack - the new Diameter Stack that is to be registered with the StackManager
Throws:
InternalException - if a manager has internal error

deregisterStack

public static void deregisterStack(Stack stack)
                            throws InternalException
Drops a driver from the DiameterManager's list. Applets can only deregister stacks from their own classloaders.

Parameters:
stack - the Diameter stack to drop
Throws:
InternalException - if a manager has internal error

getStacks

public static java.util.Enumeration<Stack> getStacks()
Retrieves an Enumeration with all of the currently loaded Diameter stacks to which the current caller has access.

Note: The classname of a stack can be found using d.getClass().getName()

Returns:
the list of Diameter stacks loaded by the caller's class loader

println

public static void println(java.lang.String message)


Copyright © 2009. All Rights Reserved.