tyrex.resource

Class Resources

public final class Resources extends 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 Resources 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
voidaddConfiguration(ResourceConfig config)
Adds a resource configuration.
ResourcegetResource(String name)
Returns the named resource.
booleanhasResource(String name)
Returns true if a resource by this name is installed.
IteratorlistConfigurations()
Returns all the resource configurations.
IteratorlistResources()
Returns an iterator of all the installed resources.
voidremoveResource(String name)
Removes a resource.
voidsetTransactionDomain(TransactionDomain txDomain)
Sets the transaction domain for this resource list.

Constructor Detail

Resources

public Resources()
Default constructor.

Method Detail

addConfiguration

public void addConfiguration(ResourceConfig config)
Adds a resource configuration. Once added, the resource can be obtained with a subsequent call to Resources.

Parameters: config The resource configuration

Throws: ResourceException A resource with this name already installed

getResource

public Resource getResource(String name)
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

hasResource

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

Parameters: name The resource name

Returns: True if the resource is installed

listConfigurations

public 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

listResources

public 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

removeResource

public void removeResource(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.

Parameters: name The resource name

setTransactionDomain

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

Parameters: txDomain The transaction domain

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.