tyrex.resource
Class ResourceConfig

java.lang.Object
  extended bytyrex.resource.ResourceConfig

public abstract class ResourceConfig
extends java.lang.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  java.lang.Object _factory
          The configured resource manager factory.
protected  java.lang.String _jar
          The JAR file name.
protected  PoolLimits _limits
          The connection pool limits.
protected  java.lang.String _name
          The resource name.
protected  java.lang.String _paths
          Additional class paths for dependent files.
protected  boolean _twoPhase
          True if two-phase commit is supported.
 
Constructor Summary
ResourceConfig()
           
 
Method Summary
abstract  java.lang.Object createFactory()
          Called to create a new factory object for the purpose of configuring it.
abstract  Resource createResource(TransactionDomain txDomain)
          Called to create a new resource from this resource configuration.
 java.lang.Object getFactory()
          Called to return the factory object.
 java.lang.String getJAR()
          Returns the JAR file name.
 PoolLimits getLimits()
          Returns the connection pool limits.
 java.lang.String getName()
          Returns the name for this resource manager.
 java.lang.String getPaths()
          Returns the additional path names.
 boolean getTwoPhase()
          Returns the two-phase commit support flag.
protected  java.net.URL getURL(java.lang.String urlString)
          Return the url for the url string.
 void setFactory(java.lang.Object factory)
          Called to set the factory object after it has been configured.
 void setJAR(java.lang.String jar)
          Sets the JAR file name.
 void setLimits(PoolLimits limits)
          Sets the connection pool limist.
 void setName(java.lang.String name)
          Sets the name for this resource manager.
 void setPaths(java.lang.String paths)
          Sets additional path names.
 void setTwoPhase(boolean twoPhase)
          Sets the two-phase commit support flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_name

protected java.lang.String _name
The resource name.


_jar

protected java.lang.String _jar
The JAR file name.


_paths

protected java.lang.String _paths
Additional class paths for dependent files.


_limits

protected PoolLimits _limits
The connection pool limits.


_twoPhase

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


_factory

protected java.lang.Object _factory
The configured resource manager factory.

Constructor Detail

ResourceConfig

public ResourceConfig()
Method Detail

setName

public void setName(java.lang.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

getName

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

Returns:
The resource manager name

setJAR

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

Parameters:
jar - The JAR file name

getJAR

public java.lang.String getJAR()
Returns the JAR file name.

Returns:
The JAR file name

setPaths

public void setPaths(java.lang.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

getPaths

public java.lang.String getPaths()
Returns the additional path names.

Returns:
The additional path names

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

getLimits

public PoolLimits getLimits()
Returns the connection pool limits.

Returns:
The connection pool limits

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

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

setFactory

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

Parameters:
factory - The factory object

getFactory

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

Returns:
The factory object

createFactory

public abstract java.lang.Object createFactory()
                                        throws ResourceException
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)
                                 throws ResourceException
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

getURL

protected final java.net.URL getURL(java.lang.String urlString)
                             throws java.io.IOException
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:
java.io.IOException - if the url is malformed or an io problem occurred.


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.