tyrex.resource

Class ResourceConfig

public abstract class ResourceConfig extends Object

Base class for a resource configuration. Different resource implementations extend this class with additional methods for configuring and creating a resource.

Version: $Revision: 1.6 $

Author: Assaf Arkin

Field Summary
protected Object_factory
The configured resource manager factory.
protected String_jar
The JAR file name.
protected PoolLimits_limits
The connection pool limits.
protected String_name
The resource name.
protected String_paths
Additional class paths for dependent files.
protected boolean_twoPhase
True if two-phase commit is supported.
Method Summary
abstract ObjectcreateFactory()
Called to create a new factory object for the purpose of configuring it.
abstract ResourcecreateResource(TransactionDomain txDomain)
Called to create a new resource from this resource configuration.
ObjectgetFactory()
Called to return the factory object.
StringgetJAR()
Returns the JAR file name.
PoolLimitsgetLimits()
Returns the connection pool limits.
StringgetName()
Returns the name for this resource manager.
StringgetPaths()
Returns the additional path names.
booleangetTwoPhase()
Returns the two-phase commit support flag.
protected URLgetURL(String urlString)
Return the url for the url string.
voidsetFactory(Object factory)
Called to set the factory object after it has been configured.
voidsetJAR(String jar)
Sets the JAR file name.
voidsetLimits(PoolLimits limits)
Sets the connection pool limist.
voidsetName(String name)
Sets the name for this resource manager.
voidsetPaths(String paths)
Sets additional path names.
voidsetTwoPhase(boolean twoPhase)
Sets the two-phase commit support flag.

Field Detail

_factory

protected Object _factory
The configured resource manager factory.

_jar

protected String _jar
The JAR file name.

_limits

protected PoolLimits _limits
The connection pool limits.

_name

protected String _name
The resource name.

_paths

protected String _paths
Additional class paths for dependent files.

_twoPhase

protected boolean _twoPhase
True if two-phase commit is supported.

Method Detail

createFactory

public abstract Object createFactory()
Called to create a new factory object for the purpose of configuring it. This method will return a factory object that will be configured from the resource configuration file, before being added to this object with a subsequent call to setFactory.

Returns: The factory object (never null)

Throws: ResourceException An error occured while attempting to create a new factory

createResource

public abstract Resource createResource(TransactionDomain txDomain)
Called to create a new resource from this resource configuration.

Parameters: txDomain The transaction domain in which the resource will be used

Returns: The resource

Throws: ResourceException An error occured while attempting to create the resource

getFactory

public Object getFactory()
Called to return the factory object.

Returns: The factory object

getJAR

public String getJAR()
Returns the JAR file name.

Returns: The JAR file name

getLimits

public PoolLimits getLimits()
Returns the connection pool limits.

Returns: The connection pool limits

getName

public String getName()
Returns the name for this resource manager.

Returns: The resource manager name

getPaths

public String getPaths()
Returns the additional path names.

Returns: The additional path names

getTwoPhase

public boolean getTwoPhase()
Returns the two-phase commit support flag. If this value is true, connections support two-phase commit.

Returns: True if connections support two-phase commit

getURL

protected final URL getURL(String urlString)
Return the url for the url string.

This code contains a workaround for a bug in java.net.URLClassLoader involving relative paths to directories.

Parameters: urlString the url string (required)

Returns: the url for the url string

Throws: IOException if the url is malformed or an io problem occurred.

setFactory

public void setFactory(Object factory)
Called to set the factory object after it has been configured.

Parameters: factory The factory object

setJAR

public void setJAR(String jar)
Sets the JAR file name. The JAR file name must accessible relative to the current directory.

Parameters: jar The JAR file name

setLimits

public void setLimits(PoolLimits limits)
Sets the connection pool limist. This is an optimal element that is used to configure the connection pool,

Parameters: limits The connection pool limits

setName

public void setName(String name)
Sets the name for this resource manager. The name is used for logging and by visual tools. It must be short and unique.

Parameters: name The resource manager name

setPaths

public void setPaths(String paths)
Sets additional path names. This is a colon separated list of paths that point to directories and JARs containing dependent files and resources used by the resource manager.

Parameters: paths Additional path names

setTwoPhase

public void setTwoPhase(boolean twoPhase)
Sets the two-phase commit support flag. If this value is true, connections support two-phase commit.

This flag is valid only if connections support the XA interface for distributed transaction demarcation. The default is always true.

Parameters: twoPhase True if connections support two-phase commit

Original code is Copyright (c) 1999-2001, Intalio, Inc. All Rights Reserved. Contributions by MetaBoss team are Copyright (c) 2003-2005, Softaris Pty. Ltd. All Rights Reserved.