IBM Rational Functional Tester
Version 8.1.1000
IBM Rational Functional Tester API Reference

Project Version 2.3

com.rational.test.ft.datapool
Class DatapoolFactory

java.lang.Object   extended by com.rational.test.ft.datapool.DatapoolFactory
All Implemented Interfaces:
IDatapoolFactory

public class DatapoolFactory
extends java.lang.Object
implements IDatapoolFactory, IDatapoolFactory

The DatapoolFactory is a singleton object so that IDatapool and IDatapoolIterator instances can be shared. Being a singleton object means that only gets constructed and everyone uses the same factory instance to construct the shared objects. Test scripts by default use managed datapools that share the datapool and iterator instance across multiple scripts.

Refer to the datapool package documentation for a discussion on how to iterate over datapool contents manually.

Since:
RFT2.0

Nested Class Summary
static class DatapoolFactory.IteratorClassName
           
 
Field Summary
static java.lang.String DEFAULT_ITERATOR_CLASS
           
 
Constructor Summary
protected DatapoolFactory()
          The constructor is intentionally protected so that only once instance of the DatapoolFactory can be constructed.
 
Method Summary
 IDatapoolVariable addVariable(IDatapool datapool, java.lang.String variableName, java.lang.Object initialValue)
           
 IDatapoolVariable addVariable(IDatapool datapool, java.lang.String variableName, java.lang.Object initialValue, java.lang.String[] enumLiterals)
           
 void close(IDatapoolIterator iterator)
          Return the iterator to the factory so that it can be properly destroyed.
 IDatapool constructDatapool()
           
static DatapoolFactory get()
          The DatapoolFactory is a singleton object and only one should get constructed.
 DatapoolFactory.IteratorClassName[] getIteratorClassNames()
          Return the default iterator classes for display in the UI.
 java.lang.String getLoadFileName(IDatapool datapool)
          Returns the file name for the datapool as it was loaded or null if the supplied datapool was not loaded from a file.
 IDatapoolRecord getNewValuesRecord(IDatapool datapool)
           
 boolean isDatapoolInCache(java.lang.String datapoolFileName)
           
 boolean iteratorExists(IDatapool datapool)
           
 IDatapool load(java.io.File dpFile, boolean sharedInstance)
          Load the datapool from the specified file.
 IDatapool loadForEdit(java.io.File dpFile, boolean sharedInstance)
           
 IDatapoolIterator open(IDatapool datapool, java.lang.String iteratorClassName)
          Return an iterator instance of the supplied iterator class.
 IDatapoolIterator open(IDatapool datapool, java.lang.String iteratorClassName, boolean shareDatapoolIterator)
          Construct a datapool iterator based on the supplied datapool and iterator class name.
 void save(IDatapool datapool)
           
 void saveAs(IDatapool datapool, java.io.File dpFile)
           
 void setLoadFileName(IDatapool datapool, java.lang.String fileName)
          Update the file name for the datapool should be stored to by default.
 void unload(IDatapool datapool)
          Removes a reference to an instance of a datapool.
 void unload(IDatapool datapool)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ITERATOR_CLASS

public static final java.lang.String DEFAULT_ITERATOR_CLASS
See Also:
Constant Field Values
Constructor Detail

DatapoolFactory

protected DatapoolFactory()
The constructor is intentionally protected so that only once instance of the DatapoolFactory can be constructed. Refer to the get method for access to the singleton.

Method Detail

get

public static DatapoolFactory get()
The DatapoolFactory is a singleton object and only one should get constructed. This method returns the one and only DatapoolFactory instance for the process.

Returns:
Returns the one and only DatapoolFactory instance for the process.

load

public IDatapool load(java.io.File dpFile,                       boolean sharedInstance)
Description copied from interface: IDatapoolFactory
Load the datapool from the specified file. If a sharedInstance is requested then the cache of other datapools that have been opened is checked for an existing copy of the datapool. Note that modifying a shared instance of the datapool may effect other uses of the datapool and should only be done in a confined execution environment.

Specified by:
load in interface IDatapoolFactory
Parameters:
dpFile - The datapool file name.
sharedInstance - Available for sharing instances of the datapool, which can save significantly on datapool loading overhead.
See Also:
IDatapoolFactory.unload(IDatapool)

unload

public void unload(IDatapool datapool)
Description copied from interface: IDatapoolFactory
Removes a reference to an instance of a datapool. If the datapool is shared the reference count is reduced. Once all references to a datapool have been unloaded the datapool instance may be made available to garbage collection.

Specified by:
unload in interface IDatapoolFactory
Parameters:
datapool - The datapool instance being unloaded.
See Also:
IDatapoolFactory.load(java.io.File,boolean)

getLoadFileName

public java.lang.String getLoadFileName(IDatapool datapool)
Returns the file name for the datapool as it was loaded or null if the supplied datapool was not loaded from a file.


setLoadFileName

public void setLoadFileName(IDatapool datapool,                             java.lang.String fileName)
Update the file name for the datapool should be stored to by default. Updating this value allows the datapool to be stored without explicitly specifying the target file name.


open

public IDatapoolIterator open(IDatapool datapool,                               java.lang.String iteratorClassName)
Description copied from interface: IDatapoolFactory
Return an iterator instance of the supplied iterator class. Depending on attributes associated with the iterator class it may be shared. The attributes of an iterator are negotiated between the factory implementation and the iterator base class.

Specified by:
open in interface IDatapoolFactory
Parameters:
datapool - The datapool instance being iterated over.
See Also:
IDatapoolFactory.close(IDatapoolIterator)

open

public IDatapoolIterator open(IDatapool datapool,                               java.lang.String iteratorClassName,                               boolean shareDatapoolIterator)
Construct a datapool iterator based on the supplied datapool and iterator class name. If a shared instance of the datapool is requested the the datapool will be queried for an associated iterator and it will be returned.


close

public void close(IDatapoolIterator iterator)
Description copied from interface: IDatapoolFactory
Return the iterator to the factory so that it can be properly destroyed. Note that if shared the iterator will not be destructed until all uses have been accounted for.

Specified by:
close in interface IDatapoolFactory
Parameters:
iterator - The iterator being freed.
See Also:
IDatapoolFactory.open(IDatapool,String)

iteratorExists

public boolean iteratorExists(IDatapool datapool)

constructDatapool

public IDatapool constructDatapool()

loadForEdit

public IDatapool loadForEdit(java.io.File dpFile,                              boolean sharedInstance)

save

public void save(IDatapool datapool)

saveAs

public void saveAs(IDatapool datapool,                    java.io.File dpFile)

unload

public void unload(IDatapool datapool)

getIteratorClassNames

public DatapoolFactory.IteratorClassName[] getIteratorClassNames()
Return the default iterator classes for display in the UI.

Since:
RFT2.0

getNewValuesRecord

public IDatapoolRecord getNewValuesRecord(IDatapool datapool)
Since:
RFT2.0

addVariable

public IDatapoolVariable addVariable(IDatapool datapool,                                      java.lang.String variableName,                                      java.lang.Object initialValue)
Since:
RFT2.0

addVariable

public IDatapoolVariable addVariable(IDatapool datapool,                                      java.lang.String variableName,                                      java.lang.Object initialValue,                                      java.lang.String[] enumLiterals)
Since:
RFT2.0

isDatapoolInCache

public boolean isDatapoolInCache(java.lang.String datapoolFileName)