com.genesyslab.ail
Class AilLoader

java.lang.Object
  extended by com.genesyslab.ail.AilLoader

public class AilLoader
extends java.lang.Object

Main entry point into the Agent Interaction Layer. Create the AilLoader interface to:

Use the getAilFactory() static method to get an AilFactory instance that your application can use to access the Interaction SDK features.


Nested Class Summary
static class AilLoader.ApplicationType
          Constants for types of application.
 
Field Summary
 com.genesyslab.ail.component.deployer.DeployerComponent mDeployer
           
 com.genesyslab.ail.core.AilModule mModule
           
 
Constructor Summary
AilLoader(java.lang.String primary_host, int primary_port, java.lang.String backup_host, int backup_port, java.lang.String user_name, java.lang.String password, java.lang.String application_name, AilLoader.ApplicationType application_type, int period, int timeout)
          Instanciates this loader for the Agent Interaction Layer.
 
Method Summary
 void debug()
          Sets the trace level at startup to DEBUG.
 void disasterSwitchover()
           
 void enableOutboundChainApi()
          Enables the OutboundChain API.
static AilFactory getAilFactory()
          Instantiates and returns the AilFactory.
static AilLoader getAilLoader()
           
static com.genesyslab.ail.core.AilModule getAilModule()
           
static ServiceException getInitException()
          Returns the ServiceException that occurred when initializing the AIL.
 com.genesyslab.ail.component.framework.SynchronizerComponent getSynchronizerComponent()
           
 void killFactory()
          Kills the current factory.
 void noLog4jSettings()
          Tells the Agent Interaction Layer not to handle settings in Log4j.
 void noLogFile()
          Tells the Agent Interaction Layer not to output traces in a file.
 void noShutdownHook()
          Tells the Agent Interaction Layer not to set a shutdown hook.
 void noTrace()
          Tells the Agent Interaction Layer not to output any trace in the console.
 void record()
           
 void setDefaultLogFileName(java.lang.String file_name)
          Sets the default log file name.
 void setDefaultLogFilePath(java.lang.String file_path)
          Sets the default log file location.
 void setForcedOptions(java.util.Map forcedOptions)
          Forces options and overrides any options set in the Configuration Layer.
 void setInitListener(InitListener listener)
          Sets a listener for initialization events.
 void setLicenseFile(java.lang.String license_file)
          Sets license file when given as application parameter rather than option of config.
 void setMockComponents(java.util.HashMap map)
           
 void setStartupConnectionAttempts(int attempts)
          Sets the maximum number of attepts for the connection to the config server.
 void setStartupTimeout(int startupTimeout)
          Sets the timeout for startup.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mDeployer

public com.genesyslab.ail.component.deployer.DeployerComponent mDeployer

mModule

public com.genesyslab.ail.core.AilModule mModule
Constructor Detail

AilLoader

public AilLoader(java.lang.String primary_host,
                 int primary_port,
                 java.lang.String backup_host,
                 int backup_port,
                 java.lang.String user_name,
                 java.lang.String password,
                 java.lang.String application_name,
                 AilLoader.ApplicationType application_type,
                 int period,
                 int timeout)
Instanciates this loader for the Agent Interaction Layer.

Parameters:
primary_host - the name of the host where the primary Configuration Server runs. Not taken into account if the primary_port is lower than or equal to 0.
primary_port - the port on which the primary Configuration Server runs. Not taken into account if the primary_host is null.
backup_host - the name of the host of the backup Configuration Server. Not taken into account if the backup_port is lower than or equal to 0.
backup_port - the port of the backup Configuration Server. Not taken into account if the backup_host is null.
user_name - a user name for the Configuration Layer. This parameter is not taken into account if application_type is SERVER.
password - the password of this user. This parameter is not taken into account if application_type is SERVER.
application_name - the name of the application in the Configuration Layer.
application_type - the type of the application in the Configuration Layer.
period - the heartbeat period (in seconds) for checking the connections to the servers. This ping allows keeping the connections alive. The default value is 300 (five minutes); it should be greater than the timeout.
timeout - the timeout (in seconds) for the requests to the servers. When a request to a server doesn't get an answer by this delay, it will throw a timeout exception. The default value is 30 (seconds); it should be lower than the period.
Method Detail

getSynchronizerComponent

public com.genesyslab.ail.component.framework.SynchronizerComponent getSynchronizerComponent()

getAilLoader

public static AilLoader getAilLoader()

getAilModule

public static com.genesyslab.ail.core.AilModule getAilModule()

noLog4jSettings

public void noLog4jSettings()
Tells the Agent Interaction Layer not to handle settings in Log4j. The application enclosing AIL will take the responsibility of Log4j settings.


noTrace

public void noTrace()
Tells the Agent Interaction Layer not to output any trace in the console. This way, the stdout flow can be used by the enclosing application.


noLogFile

public void noLogFile()
Tells the Agent Interaction Layer not to output traces in a file.


noShutdownHook

public void noShutdownHook()
Tells the Agent Interaction Layer not to set a shutdown hook. This is useful if the enclosing application wants to set its own shutdown hook. For more info on shutdown hooks, see Runtime.addShutdownHook()


setDefaultLogFilePath

public void setDefaultLogFilePath(java.lang.String file_path)
Sets the default log file location. This location is for the bootstrap log file only, real location is set in the Configuration Layer, in the options of the application. There will anyway be no log file if you call noLogFile().

Parameters:
file_path - the fully-qualified path to the log file ; it can be either absolute or relative
See Also:
setDefaultLogFileName(java.lang.String)

setDefaultLogFileName

public void setDefaultLogFileName(java.lang.String file_name)
Sets the default log file name. This file name is for the bootstrap log file only, real file name is set in the Configuration Layer, in the options of the application. Anyway, there will be no log file if you call noLogFile().

Parameters:
file_name - the name of the log file
See Also:
setDefaultLogFilePath(java.lang.String)

debug

public void debug()
Sets the trace level at startup to DEBUG. The default value at startup is INFO. The value configured in the Configuration Layer will be taken into account only when the connection to the Configuration Layer is established.


record

public void record()

setStartupConnectionAttempts

public void setStartupConnectionAttempts(int attempts)
Sets the maximum number of attepts for the connection to the config server. The default value is 3. If this value is set to 1, Ail will try only once and exit immediately if this attempt fails (bad connection parameters or config server absent).


setStartupTimeout

public void setStartupTimeout(int startupTimeout)
Sets the timeout for startup. The default value is (period + timeout)*3..


setLicenseFile

public void setLicenseFile(java.lang.String license_file)
Sets license file when given as application parameter rather than option of config. Must be done before getAilFactory() which tries to get the licenses.

Parameters:
license_file - The license file (one or several filepath|port@host separated by semicolon)

enableOutboundChainApi

public void enableOutboundChainApi()
Enables the OutboundChain API.


setForcedOptions

public void setForcedOptions(java.util.Map forcedOptions)
Forces options and overrides any options set in the Configuration Layer. Must be called before getAilFactory(), otherwise it is ignored.


setInitListener

public void setInitListener(InitListener listener)
Sets a listener for initialization events.


getAilFactory

public static AilFactory getAilFactory()
Instantiates and returns the AilFactory. If the AIlFactory was not initialized, returns null. In case of error while initializing the connection to the config server, returns null. In that case, you can have more information with getInitException().

Returns:
the AilFactory or null in case of error.

killFactory

public void killFactory()
Kills the current factory. For a successful cleanup of the current factory, you need to remove any reference that were given, directly or not, by this factory. This includes the removal of any reference to the factory itself. Calling this method allows you to call another time getAilFactory() in the same JVM.


getInitException

public static ServiceException getInitException()
Returns the ServiceException that occurred when initializing the AIL. If no exception occurred when you called getAilFactory(), returns null.

Returns:
the ServiceException that occurred when initializing the AIL, if any.

setMockComponents

public void setMockComponents(java.util.HashMap map)

disasterSwitchover

public void disasterSwitchover()