com.orderlysoftware.orderlycalls
Class OrderlyCalls

java.lang.Object
  extended by com.orderlysoftware.orderlycalls.OrderlyCalls

public class OrderlyCalls
extends java.lang.Object

This is the primary class for the OrderlyCalls application server.

OrderlyCalls takes a named-service approach to providing telephony Services. OrderlyCalls is configured with an extensible XML file (default is "./OrderlyCalls.xml") which allows you to define your own Services, and configure them with any initial parameters necessary.

You can run multiple services of the same class by giving them each a different name.

OrderlyCalls may be run in several ways, depending on your requirements:
  1. From the Command Line.
    OrderlyCalls may be used as a stand-alone application server by starting it from from the commandline. You can use the pre-built AGIServer and ManagerConnection services, and/or provide your own Service implementations.

    Example:
    > java com.orderlysoftware.orderlycalls.OrderlyCalls ./OrderlyCalls.xml

  2. From within your own applications.
    OrderlyCalls may also be used within your own applications. You may initialise its component services using XML, or by building your own setttings map.

    Example:

     boolean doneInit=false;
     
     public void useOrderlyCalls() {
            //We only want to initialize once.
            OrderlyCalls.init("./OrderlyCalls.xml");
     
      //Get a service
            ManagerClient managerClient=(ManagerClient)OrderlyCalls.getService("myManagerClient");
     
            ... do something with the service ...
     
            OrderlyCalls.shutdown();
     }
     
  3. From within J2EE Servlet Containers (e.g. Tomcat).
    You can associate OrderlyCalls services with a particular context by using OrderlyCallsWebDeployer to initiate the services.

    You can then access OrderlyCalls services from within ANY context simply by calling OrderlyCalls.getService(name).

    Please see the accompanying documentation on configuring Tomcat for use with OrderlyCalls.

Author:
Matt King, M.A. Oxon.

Constructor Summary
OrderlyCalls()
           
 
Method Summary
 void addService(Service service)
          Adds a service (with a named Settings object) to the framework.
static OrderlyCallsImpl getInstance()
          Gets the internal OrderlyCallsImpl object used to manage services.
static java.lang.String[] getLogo()
           
static java.lang.Object getService(java.lang.Class serviceClass)
          Gets services by service class.
static Service getService(java.lang.String name)
          Gets a named Service.
static java.util.HashMap getServicesMap()
          Gets the mapping between names and services.
static Settings getSettings(java.lang.String name)
          Gets a named Settings object.
static java.util.HashMap getSettingsMap()
          Gets the mapping between names and service Settings objects.
static void init(java.io.File f)
          Initialise from config file.
static void init(java.util.HashMap definitionsBySettings)
          Initialises OrderlyCalls programmatically.
static void init(java.io.InputStream is)
          Initialise from stream.
static void init(java.lang.String path)
          Initialise from config file.
static boolean isReuse()
           
static void main(java.lang.String[] args)
          Starts OrderlyCalls from the command line
 void removeService(Service service)
          Removes a service (with a named Settings object) from the framework.
static void setInstance(OrderlyCallsImpl newInstance)
          Sets the underlying instance.
static void setLogLevel(java.util.logging.Level level)
          Sets the logging level.
static void setLogLevel(java.lang.String levelStr)
          Sets the logging level.
static void setReuse(boolean reuse)
           
static void shutdown()
          Shuts down all services.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderlyCalls

public OrderlyCalls()
Method Detail

getLogo

public static java.lang.String[] getLogo()
Returns:
Returns the logo.

isReuse

public static boolean isReuse()
Returns:
Whether or not to reuses services.

setReuse

public static void setReuse(boolean reuse)
Parameters:
reuse - The reuse to set.

getInstance

public static OrderlyCallsImpl getInstance()
Gets the internal OrderlyCallsImpl object used to manage services.

The getService() methods in OrderlyCalls are defined statically for easy coding as most uses of OrderlyCalls will only require a single instance of OrderlyCallsImpl to handle the services.

Returns:
The internal OrderlyCallsImpl object that manages the services

init

public static void init(java.lang.String path)
Initialise from config file.

Parameters:
path - The path to the configuration XML file.

init

public static void init(java.io.File f)
Initialise from config file.

Parameters:
f - The file to read.

init

public static void init(java.io.InputStream is)
Initialise from stream.

Parameters:
is - An InputStream containing XML.

setLogLevel

public static void setLogLevel(java.util.logging.Level level)
Sets the logging level.

Parameters:
level - The level to be used by all OrderlyCalls classes.

setLogLevel

public static void setLogLevel(java.lang.String levelStr)
Sets the logging level.

Parameters:
levelStr - One of "SEVERE","WARNING","INFO","FINE","FINER","ALL"

init

public static void init(java.util.HashMap definitionsBySettings)
Initialises OrderlyCalls programmatically.

Parameters:
definitionsBySettings - A HashMap containing Settings objects as keys, and Definition objects as values.

shutdown

public static void shutdown()
Shuts down all services.


main

public static void main(java.lang.String[] args)
Starts OrderlyCalls from the command line

Usage: java com.orderlysoftware.orderlycalls.OrderlyCalls path/to/OrderlyCalls.xml

Parameters:
args - With no arguments, looks for config file in the current directory.

getServicesMap

public static java.util.HashMap getServicesMap()
Gets the mapping between names and services.

Returns:
A HashMap with names as keys (Strings), and Services as values.

getSettingsMap

public static java.util.HashMap getSettingsMap()
Gets the mapping between names and service Settings objects.

Returns:
A HashMap with names as keys, and Settings objects as values.

getService

public static Service getService(java.lang.String name)
Gets a named Service.

Parameters:
name - The name of the Service.
Returns:
The Service. If this is the first call to getService(), the Service is created and initialised Subsequent calls return the same Service object.

getService

public static java.lang.Object getService(java.lang.Class serviceClass)
Gets services by service class.

Parameters:
serviceClass - The class of service to find.
Returns:
A Collection of services of this class, or null if none can be found, or a single Service object if only one can be found.

getSettings

public static Settings getSettings(java.lang.String name)
Gets a named Settings object.

Parameters:
name - The name of the Service
Returns:
The Settings object that contains the XML settings used to start this Service.

setInstance

public static void setInstance(OrderlyCallsImpl newInstance)
Sets the underlying instance.

Parameters:
newInstance - the instance to set.

addService

public void addService(Service service)
Adds a service (with a named Settings object) to the framework.

Parameters:
service - The service to add.

removeService

public void removeService(Service service)
Removes a service (with a named Settings object) from the framework.

Parameters:
service - The service to remove.