com.ibm.retail.AEF.server
Class AEFBase

java.lang.Object
  |
  +--com.ibm.retail.AEF.server.AEFBase

public class AEFBase
extends java.lang.Object

AEFBase is the main object used to create an AEF enabled real terminal or virtual terminal environment.

It is a singleton object that creates the appropriate SessionServer and AEFSessionFactory objects based on the configuration settings. Applications typically use AEFBase to access the AEF SessionServer object through the getSessionServer method. The SessionServer provides a number of accessor to obtain instances of AEFSession objects. The session instances encapsulate the data and function of an active real or virtual POS terminal.



Sample usage:

    try
    {
       SessionServer server = AEFBase.getInstance().getSessionServer();
       if (server != null)
       {
          // connected to server, now get any available AEF terminal session
          AEFSession session = server.getAvailableSession();
          if (session != null)
          {
             // got a session... perform actions or listen to events 
 
 
          }
          else
          {
             // couldn't get a session -- all sessions in use
             System.err.println("Unable to obtain AEFSession.  "); 
          }
       }
       else
       {
          // couldn't connect -- URL is incorrect or server is down
          System.err.println("Unable to connect to AEF SessionServer.  "); 
       }
    }
    catch (AEFException ae)
    {
       System.err.println("An AEF exception occurred: " + ae.getMessage()); 
    }
    catch (RemoteException re)
    {
       System.err.println("A remote exception occurred: " + re.getMessage()); 
    }
 
 


Nested Class Summary
 class AEFBase.AEFMulticastThread
          AEFMulticastThread is a thread which can handle listening to the multicast socket for beaconing factories, as well as beacon on behalf of a factory.
 class AEFBase.ServerEntry
          This class is used to hold information about a SessionServer.
 
Field Summary
protected  com.ibm.retail.si.util.AEFBundle configBundle
           
protected  boolean createAgent
           
protected  boolean createDeviceServer
           
protected  boolean createFactory
           
protected  boolean createMemoryDebug
           
protected  boolean createRMI
           
protected  boolean createServer
           
protected  com.ibm.retail.AEF.util.DebugMemory debugMemory
           
protected  java.lang.String defaultHost
           
protected  com.ibm.retail.AEF.io.DeviceServer deviceServer
           
protected  java.lang.Object deviceServerLock
           
protected  int deviceServerPort
           
protected  com.ibm.retail.AEF.factory.AEFSessionFactory factory
           
protected  boolean factoryBeacon
           
protected  int factoryBeaconInterval
           
protected  java.lang.String factoryName
           
protected  boolean factoryRemote
           
protected  java.lang.String generalrmiPort
           
protected  java.net.InetAddress group
           
protected  com.ibm.retail.AEF.server.HealthServer healthServer
           
protected static java.lang.Object initlock
           
protected static java.lang.String initThread
           
protected static com.ibm.retail.AEF.server.AEFBase instance
          Singleton instance of AEFBase
protected  boolean listenForFactories
           
protected  java.lang.String localhost
           
protected  com.ibm.retail.AEF.util.LoggerControl loggerControl
           
protected  boolean loggerRemote
           
protected static boolean mgmtEnabled
           
protected  java.lang.String multicastAddress
           
protected  int multicastPort
           
protected  boolean multicastSocketOK
           
protected  java.lang.String os4690rmiPort
           
protected  java.lang.String realTerminalNumber
           
protected  java.lang.String rmiCheckInterval
           
protected  java.lang.String rmiLeaseValue
           
protected  int rmiPort
           
protected  java.lang.String rmiPortStr
           
protected  java.lang.String rmiTimeout
           
protected  java.util.HashSet serverEntryList
           
protected  java.lang.String serverID
           
protected  java.util.HashMap serverIDToEntryMap
           
protected  java.lang.String serverName
           
protected  boolean serverRemote
           
protected  com.ibm.retail.si.util.AEFBundle sessionBundle
           
protected  com.ibm.retail.AEF.server.SessionServer sessionServer
           
protected  java.net.MulticastSocket socket
           
protected  boolean tssFlag
           
protected  java.lang.Object userObj
           
protected  java.lang.String waitForServerURI
           
protected  java.lang.Object waitForServerURILock
           
 
Constructor Summary
protected AEFBase()
          Construct AEFBase object
 
Method Summary
(package private) static java.lang.String copyright()
           
protected  void createDebugMemoryMBean(com.ibm.retail.si.mgmt.MgmtAgent agent)
          Create the DebugMemoryMBean object and register it with the MBeanServer
 com.ibm.retail.AEF.io.DeviceServer createDeviceServer(int port)
          Create the DeviceServer for remote device support.
protected  void createFactory()
          Create the AEFSessionFactory object and register with RMI.
protected  void createInventoryMBean(com.ibm.retail.si.mgmt.MgmtAgent agent)
          Create the SoftwareInventoryMBean object and register it with the MBeanServer
protected  void createJMXGeneralAgent()
          Create the JMX GeneralAgent but only if it's not already running
protected  void createLoggerControl()
          Create the LoggerControl object and register with RMI.
protected  void createMBeans(com.ibm.retail.si.mgmt.MgmtAgent agent)
          Create the MBeans
protected  void createMemoryDebug()
          Create the MemoryDebug object and register with RMI.
protected  void createRegistry()
          Create the RMI registry.
protected  void createSessionServer()
          Create the SessionServer object and register with RMI.
 com.ibm.retail.AEF.factory.AEFSessionFactory getAEFSessionFactory()
          Get local AEFSessionFactory.
protected  void getConfig(java.util.HashMap overrides)
          Get configuration from properties file and write to log as INFO.
 java.lang.String getDefaultHostname()
          Determine the host name used for this instance of AEFBase.
 java.net.InetSocketAddress getHealthServerAddress()
          Get the socket address of the health server.
static com.ibm.retail.AEF.server.AEFBase getInstance()
          Get the AEFBase singleton instance.
static com.ibm.retail.AEF.server.AEFBase getInstance(java.util.HashMap overrides)
          Get the AEFBase singleton instance with the overridden properties.
 com.ibm.retail.AEF.util.LoggerControl getLoggerControl()
          Get LoggerControl object for this JVM
protected  boolean getPlatformSpecificBoolean(java.lang.String prop, boolean initValue)
          Utility method to retrieve a boolean value from the configBundle and handle any platform-specifc values.
 java.lang.String getRealTerminalNumber()
          Get the real terminal number (for non-virtual terminals).
protected  com.ibm.retail.AEF.server.SessionServer getRemoteServer()
          Get a remote SessionServer using RMI lookup.
protected  com.ibm.retail.AEF.server.SessionServer getRemoteServer(java.lang.String serverID)
          Get a specific remote SessionServer using RMI lookup.
 com.ibm.retail.AEF.server.SessionServer getRemoteServerFromURI(java.lang.String remoteServerURL)
          Get a remote SessionServer given its URI.
 com.ibm.retail.AEF.server.SessionServer getSessionServer()
          Get a SessionServer.
 com.ibm.retail.AEF.server.SessionServer getSessionServer(java.lang.String serverID)
          Get the SessionServer with the specified id.
static com.ibm.retail.AEF.server.AEFBase initialize()
          Initialize the AEFBase.
static com.ibm.retail.AEF.server.AEFBase initialize(java.util.HashMap overrides)
          Initialize the AEFBase with the overriden properties
protected  void initImpl(java.util.HashMap overrides)
          Perform initialization of the AEFBase singleton.
static boolean isManagementEnabled()
          Return indicator of whether System Management is enabled (which implies that a JMX General Agent has been created).
 boolean isVirtualEnvironment()
          Indicates if this a virtual (CSS) environment.
protected  void queryEnvironment()
          Use POS services to determine if this is a POS real terminal (4690).
protected  void queryHostname()
          Log the IP settings.
protected  void sendServerRequest(java.lang.String serverID)
          Send the request for session servers
 void setPropertyOverrides(java.lang.String filename, java.util.HashMap overrides)
          Set configuration property overrides.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected static com.ibm.retail.AEF.server.AEFBase instance
Singleton instance of AEFBase


configBundle

protected com.ibm.retail.si.util.AEFBundle configBundle

sessionBundle

protected com.ibm.retail.si.util.AEFBundle sessionBundle

createServer

protected boolean createServer

createDeviceServer

protected boolean createDeviceServer

createFactory

protected boolean createFactory

createMemoryDebug

protected boolean createMemoryDebug

createRMI

protected boolean createRMI

createAgent

protected boolean createAgent

mgmtEnabled

protected static boolean mgmtEnabled

rmiTimeout

protected java.lang.String rmiTimeout

rmiLeaseValue

protected java.lang.String rmiLeaseValue

rmiCheckInterval

protected java.lang.String rmiCheckInterval

serverID

protected java.lang.String serverID

realTerminalNumber

protected java.lang.String realTerminalNumber

rmiPort

protected int rmiPort

sessionServer

protected com.ibm.retail.AEF.server.SessionServer sessionServer

factory

protected com.ibm.retail.AEF.factory.AEFSessionFactory factory

loggerControl

protected com.ibm.retail.AEF.util.LoggerControl loggerControl

debugMemory

protected com.ibm.retail.AEF.util.DebugMemory debugMemory

userObj

protected java.lang.Object userObj

tssFlag

protected boolean tssFlag

serverRemote

protected boolean serverRemote

factoryRemote

protected boolean factoryRemote

loggerRemote

protected boolean loggerRemote

localhost

protected java.lang.String localhost

deviceServer

protected com.ibm.retail.AEF.io.DeviceServer deviceServer

healthServer

protected com.ibm.retail.AEF.server.HealthServer healthServer

deviceServerPort

protected int deviceServerPort

deviceServerLock

protected java.lang.Object deviceServerLock

factoryBeacon

protected boolean factoryBeacon

listenForFactories

protected boolean listenForFactories

factoryName

protected java.lang.String factoryName

serverName

protected java.lang.String serverName

initThread

protected static java.lang.String initThread

initlock

protected static java.lang.Object initlock

defaultHost

protected java.lang.String defaultHost

rmiPortStr

protected java.lang.String rmiPortStr

os4690rmiPort

protected java.lang.String os4690rmiPort

generalrmiPort

protected java.lang.String generalrmiPort

factoryBeaconInterval

protected int factoryBeaconInterval

multicastPort

protected int multicastPort

multicastAddress

protected java.lang.String multicastAddress

serverIDToEntryMap

protected java.util.HashMap serverIDToEntryMap

serverEntryList

protected java.util.HashSet serverEntryList

waitForServerURI

protected java.lang.String waitForServerURI

waitForServerURILock

protected java.lang.Object waitForServerURILock

socket

protected java.net.MulticastSocket socket

group

protected java.net.InetAddress group

multicastSocketOK

protected boolean multicastSocketOK
Constructor Detail

AEFBase

protected AEFBase()
Construct AEFBase object

Method Detail

copyright

static java.lang.String copyright()

getInstance

public static com.ibm.retail.AEF.server.AEFBase getInstance()
                                                     throws AEFException
Get the AEFBase singleton instance.

Returns:
instance of the AEFBase object
Throws:
AEFException - Among the possible AEFException error codes are:
AEFConst.RMI_NAMING_FAILURE

getInstance

public static com.ibm.retail.AEF.server.AEFBase getInstance(java.util.HashMap overrides)
                                                     throws AEFException
Get the AEFBase singleton instance with the overridden properties.

Returns:
instance of the AEFBase object
Throws:
AEFException - Among the possible AEFException error codes are:
AEFConst.RMI_NAMING_FAILURE

initialize

public static com.ibm.retail.AEF.server.AEFBase initialize()
                                                    throws AEFException
Initialize the AEFBase.

Returns:
instance of the AEFBase object
Throws:
AEFException - Among the possible AEFException error codes are:
AEFConst.RMI_NAMING_FAILURE

initialize

public static com.ibm.retail.AEF.server.AEFBase initialize(java.util.HashMap overrides)
                                                    throws AEFException
Initialize the AEFBase with the overriden properties

Returns:
instance of the AEFBase object
Throws:
AEFException - Among the possible AEFException error codes are:
AEFConst.RMI_NAMING_FAILURE

setPropertyOverrides

public void setPropertyOverrides(java.lang.String filename,
                                 java.util.HashMap overrides)
Set configuration property overrides.

Applications can use this method to pass property values to override configuration property values contained in the AEF property files. This provides a runtime method of changing config.properties and session.properties.


getAEFSessionFactory

public com.ibm.retail.AEF.factory.AEFSessionFactory getAEFSessionFactory()
Get local AEFSessionFactory.

Applications should access session through the SessionServer interface.

Returns:
AEFSessionFactory - null if no local factory exists

createDeviceServer

public com.ibm.retail.AEF.io.DeviceServer createDeviceServer(int port)
                                                      throws AEFException
Create the DeviceServer for remote device support. If device server already exists, no action is performed.

Parameters:
port - device server port (use -1 to take DeviceServer default)
Returns:
DeviceServer
Throws:
AEFException - Among the possible AEFException error codes are:
AEFConst.ERROR_CREATING_DEVICE_SERVER

getSessionServer

public com.ibm.retail.AEF.server.SessionServer getSessionServer()
                                                         throws AEFException
Get a SessionServer.

Returns:
SessionServer
Throws:
AEFException - Among the possible AEFException error codes are:
AEFConst.REMOTE_SESSION_SERVER_ERROR, AEFConst.NONE
AEFConst.NETWORK_FAILURE, AEFConst.NONE

getSessionServer

public com.ibm.retail.AEF.server.SessionServer getSessionServer(java.lang.String serverID)
                                                         throws AEFException
Get the SessionServer with the specified id.

Parameters:
serverID - The id of the server to return.
Returns:
SessionServer
Throws:
AEFException - AEFException error codes are:
AEFConst.REMOTE_SESSION_SERVER_ERROR, AEFConst.NONE
AEFConst.NETWORK_FAILURE, AEFConst.NONE

getRemoteServer

protected com.ibm.retail.AEF.server.SessionServer getRemoteServer(java.lang.String serverID)
                                                           throws AEFException
Get a specific remote SessionServer using RMI lookup.

Parameters:
serverID - The id of the requested server.
Returns:
SessionServer
Throws:
AEFException - AEFException error codes are:
AEFConst.REMOTE_SESSION_SERVER_ERROR, AEFConst.NONE

getRemoteServer

protected com.ibm.retail.AEF.server.SessionServer getRemoteServer()
                                                           throws AEFException
Get a remote SessionServer using RMI lookup.

Returns:
SessionServer
Throws:
AEFException - AEFException error codes are:
AEFConst.REMOTE_SESSION_SERVER_ERROR, AEFConst.NONE

getRemoteServerFromURI

public com.ibm.retail.AEF.server.SessionServer getRemoteServerFromURI(java.lang.String remoteServerURL)
Get a remote SessionServer given its URI.

Parameters:
remoteServerURL -
Returns:
SessionServer

isVirtualEnvironment

public boolean isVirtualEnvironment()
Indicates if this a virtual (CSS) environment.

Returns:
true if virtual environment (CSS)

getRealTerminalNumber

public java.lang.String getRealTerminalNumber()
Get the real terminal number (for non-virtual terminals).

Returns:
string representation of the terminal number (e.g. "021")

getLoggerControl

public com.ibm.retail.AEF.util.LoggerControl getLoggerControl()
Get LoggerControl object for this JVM

Returns:
LoggerControl

initImpl

protected void initImpl(java.util.HashMap overrides)
                 throws AEFException
Perform initialization of the AEFBase singleton.

Throws:
com.ibm.retail.AEF.util.AEFException
AEFException

getConfig

protected void getConfig(java.util.HashMap overrides)
Get configuration from properties file and write to log as INFO.

Parameters:
overrides - contains in proerty value overrides from application

getPlatformSpecificBoolean

protected boolean getPlatformSpecificBoolean(java.lang.String prop,
                                             boolean initValue)
Utility method to retrieve a boolean value from the configBundle and handle any platform-specifc values. This method supports the "4690terminal", "4690css", and "general" platforms.


createRegistry

protected void createRegistry()
                       throws AEFException
Create the RMI registry.

AEFException

createJMXGeneralAgent

protected void createJMXGeneralAgent()
                              throws AEFException
Create the JMX GeneralAgent but only if it's not already running

AEFException

createMBeans

protected void createMBeans(com.ibm.retail.si.mgmt.MgmtAgent agent)
Create the MBeans


createInventoryMBean

protected void createInventoryMBean(com.ibm.retail.si.mgmt.MgmtAgent agent)
Create the SoftwareInventoryMBean object and register it with the MBeanServer


createDebugMemoryMBean

protected void createDebugMemoryMBean(com.ibm.retail.si.mgmt.MgmtAgent agent)
Create the DebugMemoryMBean object and register it with the MBeanServer


createSessionServer

protected void createSessionServer()
                            throws AEFException
Create the SessionServer object and register with RMI.

Throws:
AEFException - Among the possible AEFException error codes are:
AEFConst.RMI_NAMING_FAILURE

createLoggerControl

protected void createLoggerControl()
                            throws AEFException
Create the LoggerControl object and register with RMI.

Throws:
AEFException - Among the possible AEFException error codes are:
AEFConst.RMI_NAMING_FAILURE

createFactory

protected void createFactory()
                      throws AEFException
Create the AEFSessionFactory object and register with RMI.

Throws:
AEFException - Among the possible AEFException error codes are:
AEFConst.RMI_NAMING_FAILURE

createMemoryDebug

protected void createMemoryDebug()
                          throws AEFException
Create the MemoryDebug object and register with RMI.

Throws:
com.ibm.retail.AEF.util.AEFException
AEFException

queryEnvironment

protected void queryEnvironment()
Use POS services to determine if this is a POS real terminal (4690).


queryHostname

protected void queryHostname()
Log the IP settings.


getDefaultHostname

public java.lang.String getDefaultHostname()
Determine the host name used for this instance of AEFBase.

Returns:
default host name

getHealthServerAddress

public java.net.InetSocketAddress getHealthServerAddress()
Get the socket address of the health server.

Returns:
socket address of health server

sendServerRequest

protected void sendServerRequest(java.lang.String serverID)
Send the request for session servers

Parameters:
serverID - The id of the requested server, or null.

isManagementEnabled

public static boolean isManagementEnabled()
Return indicator of whether System Management is enabled (which implies that a JMX General Agent has been created). Various AEF components check this flag to determine whether to create MBeans.

Returns:
flag indicating whether system management is enabled.


Copyright © 2004 IBM. All Rights Reserved.
Generated: July 19 2004