|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimtools.data.DataSourcePool
public class DataSourcePool
Pool of data source: holds a certain number of data sources, and can send action events to listeners in case the pool is modified.
Nested Class Summary | |
---|---|
protected static class |
DataSourcePool.BufferMarker
Those are markers we can recognize without any confusion possible for the serialized stream |
protected static class |
DataSourcePool.DataSourceCollectionMarker
|
protected class |
DataSourcePool.NotifySet
A specific set that notifies the listeners when it changes See HashSet, this implementation is not synchronized. |
protected static class |
DataSourcePool.SourceDependenciesMarker
|
Field Summary | |
---|---|
protected DataSourcePool.NotifySet |
collections
|
static DataSourcePool |
global
A global pool for all to use |
protected ListenerManager |
listeners
|
protected java.util.ArrayList |
localEmptySources
|
protected boolean |
notification
|
protected java.util.Vector |
providers
|
protected DataSourcePool.NotifySet |
sources
|
protected java.util.Hashtable |
translations
|
Constructor Summary | |
---|---|
DataSourcePool()
|
Method Summary | |
---|---|
void |
addDataSource(DataSource ds)
|
void |
addDataSourceCollection(DataSourceCollection dsc)
|
void |
addListener(DataSourcePoolListener l)
|
protected void |
addLocalEmptySource(java.lang.String source,
java.lang.String reason)
|
void |
addProvider(DataSourceProvider p)
Adds a datasource provider. |
DataSource |
bufferize(DataSource ds,
Buffer buffer)
Apply a buffer to a datasource. |
DataSourceCollection |
bufferize(DataSourceCollection dsc,
Buffer buffer)
Apply a buffer to a datasource collection. |
void |
clearLocalEmptySources()
Called before a synoptic loading. |
boolean |
contains(DataSource ds)
Utility. |
boolean |
contains(DataSourceCollection dsc)
Utility. |
void |
DataSourceCollectionDataSourceAdded(DataSourceCollection dsc,
DataSource ds)
Called when the information about the data source collection changed |
void |
DataSourceCollectionDataSourceRemoved(DataSourceCollection dsc,
DataSource ds)
Called when the information about the data source collection changed |
void |
DataSourceCollectionInfoChanged(DataSourceCollection dsc,
DataInfo newInfo)
Called when the information about the data source collection changed |
void |
DataSourceCollectionRemoved(DataSourceCollection dsc)
Called when the data source collection has been removed |
java.util.Set |
dataSourceCollections()
Data source collections |
java.util.Set |
dataSources()
Data sources |
DataSourceCollection |
getCollectionForDataSourceId(java.lang.String id)
Utility. |
DataSourceCollection |
getDataSourceCollectionWithId(java.lang.String id)
Utility. |
DataSource |
getDataSourceWithAlias(java.lang.String name)
Utility. |
DataSource |
getDataSourceWithId(java.lang.String id)
Utility. |
DataSource |
getDataSourceWithIDOrLabelOrAlias(java.lang.String name)
Utility. |
DataSource |
getDataSourceWithLabel(java.lang.String name)
Utility. |
java.lang.String[][] |
getEmptySourcesDump()
Called after a synoptic loading |
java.lang.String[] |
getEmptySourcesDumpColumnNames()
Called after a synoptic loading. |
DataSourceProvider |
getProviderFor(DataSource ds,
DataSourceCollection dsc)
|
protected DataSourceCollection |
getTranslateCollection(java.lang.String dscId)
|
boolean |
isEmpty()
|
boolean |
localEmptySourcesIsEmpty()
|
protected void |
notifyListeners(int action,
java.lang.Object o,
java.lang.Object old)
Notify the listeners a change occured |
DataSource |
provide(java.lang.String id,
java.lang.String dscId,
java.lang.Object optionalInformation,
boolean add)
Asks the providers to resolve a symbolic datasource reference. |
DataSource |
readDataSource(java.io.ObjectInputStream in)
|
boolean |
removeDataSource(DataSource ds)
|
boolean |
removeDataSourceCollection(DataSourceCollection dsc)
|
void |
removeListener(DataSourcePoolListener l)
|
boolean |
removeProvider(DataSourceProvider p)
Removes a datasource provider |
protected void |
setNotify(boolean state)
Sets the notification on or off |
protected void |
setTranslateCollection(java.lang.String dscId,
DataSource ds)
|
void |
writeDataSource(java.io.ObjectOutputStream out,
DataSource ds)
DataSource serialization helper |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final DataSourcePool global
protected ListenerManager listeners
protected java.util.Vector providers
protected DataSourcePool.NotifySet sources
protected DataSourcePool.NotifySet collections
protected java.util.Hashtable translations
protected boolean notification
protected java.util.ArrayList localEmptySources
Constructor Detail |
---|
public DataSourcePool()
Method Detail |
---|
public void addListener(DataSourcePoolListener l)
public void removeListener(DataSourcePoolListener l)
public void addProvider(DataSourceProvider p)
public DataSourceProvider getProviderFor(DataSource ds, DataSourceCollection dsc)
public boolean removeProvider(DataSourceProvider p)
public void addDataSource(DataSource ds)
public void addDataSourceCollection(DataSourceCollection dsc)
public boolean removeDataSource(DataSource ds)
public boolean removeDataSourceCollection(DataSourceCollection dsc)
public java.util.Set dataSourceCollections()
public java.util.Set dataSources()
public DataSource bufferize(DataSource ds, Buffer buffer)
ds
- The datasource to act onbuffer
- The buffer. Its data provider will be set to the datasource
public DataSourceCollection bufferize(DataSourceCollection dsc, Buffer buffer)
ds
- The datasource collection to act onbuffer
- The buffer. See DataSourceCollection.bufferize().
public boolean contains(DataSource ds)
public boolean contains(DataSourceCollection dsc)
public DataSource getDataSourceWithId(java.lang.String id) throws DuplicateIdException
DuplicateIdException
- when two or more datasource have the given Idpublic DataSource getDataSourceWithLabel(java.lang.String name) throws DuplicateIdException
DuplicateIdException
- when two or more datasource have the given aliaspublic DataSource getDataSourceWithAlias(java.lang.String name) throws DuplicateIdException
DuplicateIdException
- when two or more datasource have the given aliaspublic DataSource getDataSourceWithIDOrLabelOrAlias(java.lang.String name) throws DuplicateIdException
DuplicateIdException
- when two or more datasource have the given aliaspublic DataSourceCollection getDataSourceCollectionWithId(java.lang.String id) throws DuplicateIdException
DuplicateIdException
public DataSourceCollection getCollectionForDataSourceId(java.lang.String id) throws DuplicateIdException
DuplicateIdException
- when two or more collections contain a datasource with the
given Idpublic DataSource provide(java.lang.String id, java.lang.String dscId, java.lang.Object optionalInformation, boolean add)
id
- The symbolic id of a datasourcedscId
- The symbolic id of a datasourceCollection. May be nulloptionalInformation
- Can be set to help the providers. May be nulladd
- If set to true, the datasource will be added to the pool if it
could be found, together with its collection if it belongs to
a collection. True by default.
public void writeDataSource(java.io.ObjectOutputStream out, DataSource ds) throws java.io.IOException
java.io.IOException
protected DataSourceCollection getTranslateCollection(java.lang.String dscId)
protected void setTranslateCollection(java.lang.String dscId, DataSource ds)
public DataSource readDataSource(java.io.ObjectInputStream in) throws java.io.IOException
java.io.IOException
protected void notifyListeners(int action, java.lang.Object o, java.lang.Object old)
action
- as defined in DataSourcePoolEvento
- the target object. Must be a DataSource or
DataSourceCollectionprotected void setNotify(boolean state)
state
- the new statepublic void DataSourceCollectionInfoChanged(DataSourceCollection dsc, DataInfo newInfo)
DataSourceCollectionListener
DataSourceCollectionInfoChanged
in interface DataSourceCollectionListener
dsc
- The data source collection that changednewInfo
- The new information concerning this collectionpublic void DataSourceCollectionDataSourceAdded(DataSourceCollection dsc, DataSource ds)
DataSourceCollectionListener
DataSourceCollectionDataSourceAdded
in interface DataSourceCollectionListener
dsc
- The data source collection that changedds
- The data source that was addedpublic void DataSourceCollectionDataSourceRemoved(DataSourceCollection dsc, DataSource ds)
DataSourceCollectionListener
DataSourceCollectionDataSourceRemoved
in interface DataSourceCollectionListener
dsc
- The data source collection that changedds
- The data source that was removedpublic void DataSourceCollectionRemoved(DataSourceCollection dsc)
DataSourceCollectionListener
DataSourceCollectionRemoved
in interface DataSourceCollectionListener
dsc
- The data source collection that has been removedpublic boolean isEmpty()
public java.lang.String[][] getEmptySourcesDump()
public java.lang.String[] getEmptySourcesDumpColumnNames()
protected void addLocalEmptySource(java.lang.String source, java.lang.String reason)
public void clearLocalEmptySources()
public boolean localEmptySourcesIsEmpty()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |