com.atomikos.icatch.system
Class Configuration

java.lang.Object
  extended by com.atomikos.icatch.system.Configuration

public final class Configuration
extends Object

Configuration is a facade for the icatch transaction management facilities. Allows the application server code to find the transaction manager, even if the actual implementation varies over time.


Method Summary
static void addConsole(Console console)
          Add a console for the configuration.
static void addLogAdministrator(LogAdministrator admin)
          Add a log administrator.
static void addResource(RecoverableResource resource)
          Add a resource to the transaction manager domain.
static void addShutdownHook(Thread hook)
          Adds a shutdown hook to the configuration.
static void addTSListener(TSListener l)
          Add a transaction service listener.
static CompositeTransactionManager getCompositeTransactionManager()
          Get the composite transaction manager.
static Console getConsole()
          Get the console for the configuration.
static ExportingTransactionManager getExportingTransactionManager()
          Get the exporting transaction manager.
static ImportingTransactionManager getImportingTransactionManager()
          Get the importing transaction manager.
static Enumeration getLogAdministrators()
          Get all registered logadministrators.
static RecoverableResource getResource(String name)
          Get the resource with the given name.
static Enumeration getResources()
          Get all resources added so far, in the order that they were added.
static TransactionService getTransactionService()
          Retrieves the transaction service being used.
static String getVersion()
           
static void installCompositeTransactionManager(CompositeTransactionManager compositeTransactionManager)
          Installs a composite transaction manager as a Singleton.
static void installExportingTransactionManager(ExportingTransactionManager exportingTransactionManager)
          Installs an exporting transaction manager as a Singleton.
static void installImportingTransactionManager(ImportingTransactionManager importingTransactionManager)
          Installs an importing transaction manager as a Singleton.
static void installLogControl(LogControl control)
          Installs the log control interface to use.
static void installRecoveryService(RecoveryService service)
          Installs a recovery service as a Singleton.
static void installTransactionService(TransactionService service)
          Installs the transaction service in use.
static boolean isDebugLoggingEnabled()
          Tests if DEBUG logging is enabled.
static boolean isInfoLoggingEnabled()
          Tests if INFO logging is enabled.
static void logDebug(String msg)
          Write a debug message to the log.
static void logDebug(String msg, Throwable error)
          Write a debug msg and error to the log.
static void logInfo(String msg)
          Write a log entry for the INFO level.
static void logInfo(String msg, Throwable error)
          Write an info message and error to the log.
static void logWarning(String msg)
          Write a message to the installed console.
static void logWarning(String msg, Throwable error)
          Write a message and associated exception to the console.
static void removeConsoles()
          Remove all consoles added so far.
static void removeLogAdministrator(LogAdministrator admin)
          Remove a log administrator.
static RecoverableResource removeResource(String name)
          Removes a resource from the config.
static void removeShutdownHooks()
          Removes all shutdown hooks from the system.
static void removeTSListener(TSListener l)
          Remove a transaction service listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getVersion

public static String getVersion()

installTransactionService

public static void installTransactionService(TransactionService service)
Installs the transaction service in use.

Parameters:
service - The service.

addShutdownHook

public static void addShutdownHook(Thread hook)
Adds a shutdown hook to the configuration. Shutdown hooks are managed here, since regular shutdown of the transaction core should remove hooks (cf case 21519).

Parameters:
hook -

removeShutdownHooks

public static void removeShutdownHooks()
Removes all shutdown hooks from the system. This method should be called on shutdown of the core.


getTransactionService

public static TransactionService getTransactionService()
Retrieves the transaction service being used.

Returns:
TransactionService The transaction service.

addTSListener

public static void addTSListener(TSListener l)
Add a transaction service listener.

Parameters:
l - The listener.

removeTSListener

public static void removeTSListener(TSListener l)
Remove a transaction service listener.

Parameters:
l - The listener.

installCompositeTransactionManager

public static void installCompositeTransactionManager(CompositeTransactionManager compositeTransactionManager)
Installs a composite transaction manager as a Singleton.

Parameters:
compositeTransactionManager - The instance to install.

installRecoveryService

public static void installRecoveryService(RecoveryService service)
Installs a recovery service as a Singleton.

Parameters:
service - The recovery service.

installLogControl

public static void installLogControl(LogControl control)
Installs the log control interface to use.

Parameters:
control -

installImportingTransactionManager

public static void installImportingTransactionManager(ImportingTransactionManager importingTransactionManager)
Installs an importing transaction manager as a Singleton.

Parameters:
importingTransactionManager - The instance to install.

installExportingTransactionManager

public static void installExportingTransactionManager(ExportingTransactionManager exportingTransactionManager)
Installs an exporting transaction manager as a Singleton.

Parameters:
exportingTransactionManager - The instance to install.

getCompositeTransactionManager

public static CompositeTransactionManager getCompositeTransactionManager()
Get the composite transaction manager.

Returns:
CompositeTransactionManager The instance, or null if none.

getImportingTransactionManager

public static ImportingTransactionManager getImportingTransactionManager()
Get the importing transaction manager.

Returns:
ImportingTransactionManager The instance, or null if none.

getExportingTransactionManager

public static ExportingTransactionManager getExportingTransactionManager()
Get the exporting transaction manager.

Returns:
ExportingTransactionManager The instance, or null if none.

addResource

public static void addResource(RecoverableResource resource)
                        throws IllegalStateException
Add a resource to the transaction manager domain. Should be called for all resources that have to be recovered, BEFORE initializing the transaction manager! The purpose of registering resources is mainly to be able the recovery the ResourceTransaction context for each prepared ResourceTransction. This is needed for those ResourceTransaction instances that do not encapsulate the full state themselves, as in the XAResource case.

Parameters:
resource - The resource to add.
Throws:
IllegalStateException - If the name of the resource is already in use.

addLogAdministrator

public static void addLogAdministrator(LogAdministrator admin)
Add a log administrator.

Parameters:
admin -

removeLogAdministrator

public static void removeLogAdministrator(LogAdministrator admin)
Remove a log administrator.

Parameters:
admin -

getLogAdministrators

public static Enumeration getLogAdministrators()
Get all registered logadministrators.

Returns:
Enumeration The logadministrators.

removeResource

public static RecoverableResource removeResource(String name)
Removes a resource from the config.

Parameters:
name - The resource's name.
Returns:
RecoverableResource The removed object.

getResource

public static RecoverableResource getResource(String name)
Get the resource with the given name.

Parameters:
name - The name to find.
Returns:
RecoverableResource The resource.

getResources

public static Enumeration getResources()
Get all resources added so far, in the order that they were added.

Returns:
Enumeration The resources.

addConsole

public static void addConsole(Console console)
Add a console for the configuration. More than one console can be set; if so then all of them will receive the output.

Parameters:
console - The console to add.

getConsole

public static Console getConsole()
Get the console for the configuration. If more than one console was installed, then the returned console will cascade to all of them.

Returns:
Console The console for the configuration.

removeConsoles

public static void removeConsoles()
Remove all consoles added so far. Needed for restart within same VM.


logWarning

public static void logWarning(String msg)
Write a message to the installed console.

Parameters:
msg - The message to write.

logWarning

public static void logWarning(String msg,
                              Throwable error)
Write a message and associated exception to the console.

Parameters:
msg -
error -

logInfo

public static void logInfo(String msg)
Write a log entry for the INFO level.

Parameters:
msg -

logInfo

public static void logInfo(String msg,
                           Throwable error)
Write an info message and error to the log.

Parameters:
msg -
error -

logDebug

public static void logDebug(String msg)
Write a debug message to the log.

Parameters:
msg -

logDebug

public static void logDebug(String msg,
                            Throwable error)
Write a debug msg and error to the log.

Parameters:
msg -
error -

isDebugLoggingEnabled

public static boolean isDebugLoggingEnabled()
Tests if DEBUG logging is enabled. Call this before you construct DEBUG strings!

Returns:

isInfoLoggingEnabled

public static boolean isInfoLoggingEnabled()
Tests if INFO logging is enabled. Call this before you construct INFO strings!

Returns:


Copyright © 2011. All Rights Reserved.