tyrex.resource
Class Resources

java.lang.Object
  extended bytyrex.resource.Resources

public final class Resources
extends java.lang.Object

Represents a collection of installed resources. Resources are obtained from this collection by the name with which they were installed.

The method addConfiguration is called to install a new resource configuration. The method setTransactionDomain is called to set the transaction domain. The transaction domain is required to create a Resource object from a ResourceConfig object.

The deployment process uses the methods addConfiguration and listConfigurations to add and list resource configurations.

The application server uses the methods listResources() and getResource to obtain resources and make the client connection factory available to the application.

Version:
$Revision: 1.9 $
Author:
Assaf Arkin

Constructor Summary
Resources()
          Default constructor.
 
Method Summary
 void addConfiguration(ResourceConfig config)
          Adds a resource configuration.
 Resource getResource(java.lang.String name)
          Returns the named resource.
 boolean hasResource(java.lang.String name)
          Returns true if a resource by this name is installed.
 java.util.Iterator listConfigurations()
          Returns all the resource configurations.
 java.util.Iterator listResources()
          Returns an iterator of all the installed resources.
 void removeResource(java.lang.String name)
          Removes a resource.
 void setTransactionDomain(TransactionDomain txDomain)
          Sets the transaction domain for this resource list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resources

public Resources()
Default constructor.

Method Detail

setTransactionDomain

public void setTransactionDomain(TransactionDomain txDomain)
Sets the transaction domain for this resource list. This method must be called before calling getResource(java.lang.String).

Parameters:
txDomain - The transaction domain

addConfiguration

public void addConfiguration(ResourceConfig config)
                      throws ResourceException
Adds a resource configuration. Once added, the resource can be obtained with a subsequent call to getResource(java.lang.String).

Parameters:
config - The resource configuration
Throws:
ResourceException - A resource with this name already installed

listConfigurations

public java.util.Iterator listConfigurations()
Returns all the resource configurations. Returns an iterator of ResourceConfig objects that specify the configuration of each resource.

Returns:
All the resource configurations

hasResource

public boolean hasResource(java.lang.String name)
Returns true if a resource by this name is installed.

Parameters:
name - The resource name
Returns:
True if the resource is installed

listResources

public java.util.Iterator listResources()
Returns an iterator of all the installed resources. Each element is a string providing the resource name. The name can be used to obtain the Resource object.

Returns:
An iterator of all installed resource names

getResource

public Resource getResource(java.lang.String name)
                     throws ResourceException
Returns the named resource. The resource must have been installed with a previous call to addConfiguration and the transaction domain must have been set up for this method to succeed. It is possible that this method will not be able to create the specified resource.

Parameters:
name - The resource name
Returns:
The resource, null if no such resource installed
Throws:
ResourceException - An error occured while attempting to create this resource

removeResource

public void removeResource(java.lang.String name)
Removes a resource. After return from this method, the resource is no longer available and its client connection factory is no longer useable.

This method automatically calls Resource.destroy().

Parameters:
name - The resource name


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.