simtools.data
Class EmptyDataSourcePool

java.lang.Object
  extended by simtools.data.EmptyDataSourcePool

public class EmptyDataSourcePool
extends java.lang.Object

Pool of empty data sources: holds a certain number of data sources that cannot be restored. A empty data source can be replaced with a real one as soon as a data source with same references has been created.

Author:
zxpletran007

Field Summary
protected  java.util.ArrayList dataSourcesToReplace
           
protected  java.util.ArrayList emptyCollections
           
protected  java.util.HashMap emptyDataSources
           
static EmptyDataSourcePool global
          A global pool for all empty data sources used
 
Constructor Summary
EmptyDataSourcePool()
           
 
Method Summary
 void addEmptyCollection(java.lang.String dsId)
          Called when a collection could'nt provide a given data source.
 void addEmptyDaSource(java.lang.String dsId, EmptyDataSource eds)
           
 boolean containsEmptyCollection(java.lang.String dscId)
           
 void dataSourceAdded(java.lang.String dsId, DataSource ds)
          Called when a data source has been added to data source pool.
 boolean emptyDataSourcesCanBeReplaced()
           
 java.lang.String[][] getDataSourcesToReplace()
           
 java.lang.String[] getDataSourcesToReplaceTitles()
           
 EmptyDataSource getEmptyDataSource(java.lang.String dsId)
           
 void replaceAllDataSources()
          Replace all empty data sources that can be associated to a real data source
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

global

public static final EmptyDataSourcePool global
A global pool for all empty data sources used


emptyDataSources

protected java.util.HashMap emptyDataSources

emptyCollections

protected java.util.ArrayList emptyCollections

dataSourcesToReplace

protected java.util.ArrayList dataSourcesToReplace
Constructor Detail

EmptyDataSourcePool

public EmptyDataSourcePool()
Method Detail

addEmptyCollection

public void addEmptyCollection(java.lang.String dsId)
Called when a collection could'nt provide a given data source. Add this collection to the list of empty collections

Parameters:
dsId -

containsEmptyCollection

public boolean containsEmptyCollection(java.lang.String dscId)

getEmptyDataSource

public EmptyDataSource getEmptyDataSource(java.lang.String dsId)

addEmptyDaSource

public void addEmptyDaSource(java.lang.String dsId,
                             EmptyDataSource eds)

replaceAllDataSources

public void replaceAllDataSources()
Replace all empty data sources that can be associated to a real data source


emptyDataSourcesCanBeReplaced

public boolean emptyDataSourcesCanBeReplaced()
Returns:
true if it is possible to replace some empty data sources with real ones

getDataSourcesToReplaceTitles

public java.lang.String[] getDataSourcesToReplaceTitles()

getDataSourcesToReplace

public java.lang.String[][] getDataSourcesToReplace()

dataSourceAdded

public void dataSourceAdded(java.lang.String dsId,
                            DataSource ds)
Called when a data source has been added to data source pool. if possible, create an association between a corresponding empty data source and this one.

Parameters:
dsid, - the data source id
ds, - the data source newly created