public class DatapoolFactory extends java.lang.Object implements IDatapoolFactory, IDatapoolFactory
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
DatapoolFactory.IteratorClassName |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_ITERATOR_CLASS |
| Modifier | Constructor and Description |
|---|---|
protected |
DatapoolFactory()
The constructor is intentionally protected so that only once instance
of the DatapoolFactory can be constructed.
|
| Modifier and Type | Method and Description |
|---|---|
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()
Constructs and returns an empty IDataPool
|
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)
Load the datapool from the specified file.
|
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)
Persists the specified instance of a datapool.
|
void |
saveAs(IDatapool datapool,
java.io.File dpFile)
Persists the specified instance of a datapool to the
specified file.
|
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)
Removes a reference to an instance of a datapool.
|
void |
updateSharedDatapoolCache(com.rational.test.ft.datapool.impl.Datapool dp) |
public static final java.lang.String DEFAULT_ITERATOR_CLASS
protected DatapoolFactory()
get
method for access to the singleton.public static DatapoolFactory get()
public IDatapool load(java.io.File dpFile, boolean sharedInstance)
IDatapoolFactorysharedInstance 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.load in interface IDatapoolFactorydpFile - The datapool file name.sharedInstance - Available for sharing instances of
the datapool, which can save significantly
on datapool loading overhead.IDatapoolFactory.unload(IDatapool)public void unload(IDatapool datapool)
IDatapoolFactoryunload in interface IDatapoolFactorydatapool - The datapool instance being unloaded.IDatapoolFactory.load(java.io.File,boolean)public java.lang.String getLoadFileName(IDatapool datapool)
null if the supplied datapool was not loaded from a file.public void setLoadFileName(IDatapool datapool, java.lang.String fileName)
public IDatapoolIterator open(IDatapool datapool, java.lang.String iteratorClassName)
IDatapoolFactoryopen in interface IDatapoolFactorydatapool - The datapool instance being iterated over.IDatapoolFactory.close(IDatapoolIterator)public IDatapoolIterator open(IDatapool datapool, java.lang.String iteratorClassName, boolean shareDatapoolIterator)
public void close(IDatapoolIterator iterator)
IDatapoolFactoryclose in interface IDatapoolFactoryiterator - The iterator being freed.IDatapoolFactory.open(IDatapool,String)public boolean iteratorExists(IDatapool datapool)
public IDatapool constructDatapool()
IDatapoolFactorypublic IDatapool loadForEdit(java.io.File dpFile, boolean sharedInstance)
IDatapoolFactorysharedInstance 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.dpFile - The datapool file name.sharedInstance - Available for sharing instances of
the datapool, which can save significantly
on datapool loading overhead.IDatapoolFactory.unload(IDatapool)public void save(IDatapool datapool)
IDatapoolFactorysaveAs method
should be used to save the file.datapool - The datapool instance being saved.#load(java.io.File,boolean),
IDatapoolFactory.unload(IDatapool),
IDatapoolFactory.saveAs(IDatapool,java.io.File)public void saveAs(IDatapool datapool, java.io.File dpFile)
IDatapoolFactorydatapool - The datapool instance being saved.dpFile - The file to which the datapool is to be saved.#load(java.io.File,boolean),
IDatapoolFactory.unload(IDatapool),
IDatapoolFactory.save(IDatapool)public void updateSharedDatapoolCache(com.rational.test.ft.datapool.impl.Datapool dp)
public void unload(IDatapool datapool)
IDatapoolFactorydatapool - The datapool instance being unloaded.#load(java.io.File,boolean)public DatapoolFactory.IteratorClassName[] getIteratorClassNames()
public IDatapoolRecord getNewValuesRecord(IDatapool datapool)
public IDatapoolVariable addVariable(IDatapool datapool, java.lang.String variableName, java.lang.Object initialValue)
public IDatapoolVariable addVariable(IDatapool datapool, java.lang.String variableName, java.lang.Object initialValue, java.lang.String[] enumLiterals)
public boolean isDatapoolInCache(java.lang.String datapoolFileName)