com.atomikos.icatch.config.imp
Class AbstractUserTransactionService

java.lang.Object
  extended by com.atomikos.icatch.config.imp.AbstractUserTransactionService
All Implemented Interfaces:
UserTransactionService
Direct Known Subclasses:
AbstractJtaUserTransactionService

public abstract class AbstractUserTransactionService
extends Object
implements UserTransactionService

The user's (client program) view of the transaction manager's configuration, a compact facade with all the information the client program needs. This base class should be overridden for each module (CORBA, trmi,...).


Constructor Summary
AbstractUserTransactionService()
           
 
Method Summary
protected static String findOrCreateFolder(String path)
          Utility method to find or create a given folder
 CompositeTransactionManager getCompositeTransactionManager()
          Get the composite transaction manager for the config.
protected static String getDefaultName()
          Utility method to get a default TM name.
 ExportingTransactionManager getExportingTransactionManager()
          Get the ExportingTransactionManager instance
protected static String getHostAddress()
          Utility method to get the local host address.
 ImportingTransactionManager getImportingTransactionManager()
          Get the ImportingTransactionManager instance.
 Enumeration getLogAdministrators()
          Get the log administrators.
 Enumeration getResources()
          Get the resources registered.
static String getTrimmedProperty(String name, Properties p)
          Utility method to get and trim properties.
 void init(Properties properties)
           
 void init(TSInitInfo info)
          Initializes the intra-VM transaction manager.
 void registerLogAdministrator(LogAdministrator admin)
          Register a LogAdministrator instance for administration.
 void registerResource(RecoverableResource res)
          Register a new resource for recovery.
 void registerTSListener(TSListener listener)
          Registers a listener with the transaction service.
 void removeLogAdministrator(LogAdministrator admin)
          Removes the given log administrator.
 void removeResource(RecoverableResource res)
          Removes the given resource.
 void removeTSListener(TSListener listener)
          Removes a listener from the transaction service.
 void shutdown(boolean force)
          Shuts down the TM.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atomikos.icatch.config.UserTransactionService
createTSInitInfo, getTransactionManager, getTSMetaData, getUserTransaction
 

Constructor Detail

AbstractUserTransactionService

public AbstractUserTransactionService()
Method Detail

getTrimmedProperty

public static String getTrimmedProperty(String name,
                                        Properties p)
Utility method to get and trim properties.

Parameters:
name - The name of the property to get.
p - The properties to look in.
Returns:
String The property without leading or trailing spaces, or null if not found.

getDefaultName

protected static String getDefaultName()
Utility method to get a default TM name.

Returns:
A default TM name based on the local IP.

getHostAddress

protected static String getHostAddress()
Utility method to get the local host address.

Returns:

findOrCreateFolder

protected static String findOrCreateFolder(String path)
Utility method to find or create a given folder

Parameters:
path - The folder path.
Returns:
String The resulting file path, or a default if the given path is not valid as a folder.

shutdown

public void shutdown(boolean force)
              throws IllegalStateException
Description copied from interface: UserTransactionService
Shuts down the TM. It is highly recommended that this method be called before the VM exits, in order to ensure proper log closing. After this method completes, all resources will have been removed from the configuration, as well as all logadministrators. To re-initialize, everything should be registered again.

Specified by:
shutdown in interface UserTransactionService
Parameters:
force - If true, then shutdown will succeed even if some transactions are still active. If false, then the calling thread will block until any active transactions are terminated. A heuristic transaction is also considered to be active.
Throws:
IllegalStateException
See Also:
UserTransactionService

init

public void init(TSInitInfo info)
          throws SysException
Description copied from interface: UserTransactionService
Initializes the intra-VM transaction manager.

Specified by:
init in interface UserTransactionService
Parameters:
info - The TSInitInfo with details for initialization.
Throws:
SysException
See Also:
UserTransactionService

getCompositeTransactionManager

public CompositeTransactionManager getCompositeTransactionManager()
Description copied from interface: UserTransactionService
Get the composite transaction manager for the config.

Specified by:
getCompositeTransactionManager in interface UserTransactionService
Returns:
CompositeTransactionManager The composite transaction manager.
See Also:
UserTransactionService

getImportingTransactionManager

public ImportingTransactionManager getImportingTransactionManager()
Description copied from interface: UserTransactionService
Get the ImportingTransactionManager instance.

Specified by:
getImportingTransactionManager in interface UserTransactionService
Returns:
ImportingTransactionManager The instance.
See Also:
UserTransactionService

getExportingTransactionManager

public ExportingTransactionManager getExportingTransactionManager()
Description copied from interface: UserTransactionService
Get the ExportingTransactionManager instance

Specified by:
getExportingTransactionManager in interface UserTransactionService
Returns:
ExportingTransactionManager The instance.
See Also:
UserTransactionService

registerResource

public void registerResource(RecoverableResource res)
Description copied from interface: UserTransactionService
Register a new resource for recovery.

Specified by:
registerResource in interface UserTransactionService
Parameters:
res - The resource to be added.

registerLogAdministrator

public void registerLogAdministrator(LogAdministrator admin)
Description copied from interface: UserTransactionService
Register a LogAdministrator instance for administration. This allows inspection of active transactions and manual intervention. Care should be taken if multiple instances are registered: the responsibility of taking conflicting manual decisions is entirely with the user!

Specified by:
registerLogAdministrator in interface UserTransactionService
Parameters:
admin - The instance.

getResources

public Enumeration getResources()
Description copied from interface: UserTransactionService
Get the resources registered.

Specified by:
getResources in interface UserTransactionService
Returns:
Enumeration The resources, or empty if none.

getLogAdministrators

public Enumeration getLogAdministrators()
Description copied from interface: UserTransactionService
Get the log administrators.

Specified by:
getLogAdministrators in interface UserTransactionService
Returns:
Enumeration The registered administrators.

removeResource

public void removeResource(RecoverableResource res)
Description copied from interface: UserTransactionService
Removes the given resource. This method should be used with extreme care, because removing resources can endanger recovery!

Specified by:
removeResource in interface UserTransactionService

removeLogAdministrator

public void removeLogAdministrator(LogAdministrator admin)
Description copied from interface: UserTransactionService
Removes the given log administrator. Does nothing if the instance is not found.

Specified by:
removeLogAdministrator in interface UserTransactionService

registerTSListener

public void registerTSListener(TSListener listener)
Description copied from interface: UserTransactionService
Registers a listener with the transaction service.

Specified by:
registerTSListener in interface UserTransactionService

removeTSListener

public void removeTSListener(TSListener listener)
Description copied from interface: UserTransactionService
Removes a listener from the transaction service. After this method is called, the listener in question will no longer receive callback notifications from the transaction service. This method does nothing if the listener is not found.

Specified by:
removeTSListener in interface UserTransactionService

init

public void init(Properties properties)
          throws SysException
Specified by:
init in interface UserTransactionService
Throws:
SysException


Copyright © 2011. All Rights Reserved.