com.orderlysoftware.orderlycalls.examples
Class ExampleService

java.lang.Object
  extended by com.orderlysoftware.orderlycalls.base.Service
      extended by com.orderlysoftware.orderlycalls.examples.ExampleService

public class ExampleService
extends Service

Very basic Service implementation to help you write your own services. This service supports a 'username' and 'password', entered as attributes in OrderlyCalls.xml, and a validate() method to help authenticate users.

Author:
Matt King, M.A. Oxon.

Field Summary
 
Fields inherited from class com.orderlysoftware.orderlycalls.base.Service
log, settings
 
Constructor Summary
ExampleService(Settings settings)
          Must define this method in order to work with superclass.
 
Method Summary
 boolean authenticate(java.lang.String testUsername, java.lang.String testPassword)
          Compares an input username and password to those from the congiguration file.
static Service getInstance(Settings settings)
          Must define this method in order to work with superclass.
static Service getInstance(Settings settings, boolean reuse)
          Must define this as follows in order to work with superclass.
static ExampleService getInstance(java.lang.String name)
          Most services should also define this method as follows.
 void init()
          Gets the username and password attributes from the XML configuration file.
 boolean isRunning()
          Is the service runnig or not?
 void shutdown()
          Clears the stored username and password, so the service cannot be used to log in.
 
Methods inherited from class com.orderlysoftware.orderlycalls.base.Service
getExecutorService, getInstance, getInstanceByName, getLogName, getName, getSettings, setExecutorService, shutdownAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExampleService

public ExampleService(Settings settings)
Must define this method in order to work with superclass.

Method Detail

isRunning

public boolean isRunning()
Is the service runnig or not?

Specified by:
isRunning in class Service
Returns:
true if running, false otherwise.

authenticate

public boolean authenticate(java.lang.String testUsername,
                            java.lang.String testPassword)
Compares an input username and password to those from the congiguration file.

Parameters:
testUsername -
testPassword -
Returns:
true if these match the configuration file entries, false otherwise.

getInstance

public static Service getInstance(Settings settings)
Must define this method in order to work with superclass. If using class-specific settings class (recommended), then this method should read public static ExampleService getInstance(ExampleSettings settings) { return getInstance(settings, true); } otherwise you must use public static Service getInstance(Settings settings) { return getInstance(settings, true); }


getInstance

public static Service getInstance(Settings settings,
                                  boolean reuse)
Must define this as follows in order to work with superclass. If using class-specific settings class (recommended), then this method should read public static ExampleService getInstance(ExampleSettings settings) { return (ExampleService)getInstance(ExampleSrvice.class, settings, true); } otherwise you must use public static Service getInstance(Settings settings, boolean reuse) { return getInstance(ExampleService.class, settings, reuse); }


getInstance

public static ExampleService getInstance(java.lang.String name)
Most services should also define this method as follows.


init

public void init()
Gets the username and password attributes from the XML configuration file.

Specified by:
init in class Service

shutdown

public void shutdown()
Clears the stored username and password, so the service cannot be used to log in.

Specified by:
shutdown in class Service