Overview | Package | Class | Use | Tree | Help
| HEADER
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ru.biosoft.access
Class AbstractDataCollection

    ru.biosoft.access.DataElementSupport
      |
      +--ru.biosoft.access.AbstractDataCollection

Direct Known Subclasses:
  DataCollectionUnion, DerivedDataCollection, EntryCollection, SqlDataCollection, VectorDataCollection, VisiblePlugin

public abstract class AbstractDataCollection
extends DataElementSupport
implements DataCollection

This abstract class provides default implementations for most of the methods in the `DataCollection` interface. It takes care of the management of listeners and provides some conveniences for generating DataCollectionEvents and dispatching them to the listeners.

To create a concrete DataCollection as a sublcass of AbstractDataCollection you need only provide implementations for the following methods:
DataCollection.iterator()
if concrete DataColection mutable, then next methods should be implemented
#doPut(DataElement)
#doRemove(DataElement)

Constructor Summary
`AbstractDataCollection(DataCollection parent, Properties properties)` Constructor to be used by CollectionFactory to creata DataCollection.

Method Summary
`void` | `addDataCollectionListener(DataCollectionListener listener)` Adds listener to this data collection.
`void` | `close()` Close the data collection and release all used resources.
`boolean` | `contains(DataElement element)` Check if this data collection contains the specified data element.
`boolean` | `contains(String name)` Returns `true` if this data collection contains the element with specified name.
`DataElement` | `get(String name)` Gets data element with specified name.
`String` | `getCompleteName()` Gets complete name of data collection.
`Class` | `getDataElementType()` Gets the type of DataElements stored in the data collection.
`String` | `getDescription()` Utility method that returns data collection description.
`DataCollectionInfo` | `getInfo()` Gets data collection info.
`List` | `getNameList()` Gets list of all names in data collection.
`int` | `getSize()` Gets size of data collection.
`boolean` | `isMutable()` Returns false.
`boolean` | `isNotificationEnabled()`
`boolean` | `isPropagationEnabled()`
`void` | `propagateElementChanged(DataCollection source, DataCollectionEvent primaryEvent)`
`void` | `propagateElementWillChange(DataCollection source, DataCollectionEvent primaryEvent)`
`DataElement` | `put(DataElement element)` Adds the specified data element to the collection.
`void` | `release(String name)` Release the DataElement specified by its name from the cache.
`void` | `remove(String name)` Removes the specified data element from the collection, if present.
`void` | `removeDataCollectionListener(DataCollectionListener listener)` Removes listener from this data collection.
`void` | `setNotificationEnabled(boolean isEnabled)`
`void` | `setPropagationEnabled(boolean propagationEnabled)`
`String` | `toString()` Returns a String representation of the data collection.

Methods inherited from class ru.biosoft.access.DataElementSupport
`getName, getOrigin, registerConstructorWithBadEqual`

Constructor Detail

### AbstractDataCollection

    public AbstractDataCollection(DataCollection parent, Properties properties)

  Constructor to be used by CollectionFactory to creata DataCollection. Makes info for this data collection.
  Required properties
  - DataCollection.NAME_PROPERTY
  Optional properties
  - ru.biosoft.access.DataCollection#PATH_PROPERTY
  - DataCollection.NODE_IMAGE
  - DataCollection.CHILDREN_NODE_IMAGE
  - DataCollection.NODE_VISIBLE
  - DataCollection.CHILDREN_NODE_VISIBLE
  Parameters:
    parent - Parent data collection.
    properties - Properties for creating data collection (may be changed).
  todo low makeInfo(Properties) should be moved to collection that only appears in repository.

Method Detail

### addDataCollectionListener

    public void addDataCollectionListener(DataCollectionListener listener)

  Adds listener to this data collection.
  Parameters:
    listener - Listener of this data collection.

### close

    public void close()
                throws java.lang.Exception

  Close the data collection and release all used resources. Default implementation provides following actions:
  - closing DataCollectionInfo that provides closing of QuerySystem
  pending close all child DataCollections (registered in cache), clear the cache, release reference to this data collection in parent cache

### contains

    public boolean contains(DataElement element)

  Check if this data collection contains the specified data element.
  Parameters:
    element - tested data element.
  Returns: true if this data collection contains the data element which name equals to specified data element, otherwise return false.
  See Also:
    contains(java.lang.String)
  todo Check type of data element.

### contains

    public boolean contains(String name)

  Returns `true` if this data collection contains the element with specified name.
  Parameters:
    name - name of element whose presence in this data collection is to be tested.
  Returns: `true` if this data collection contains the element with specified name.
  See Also:
    contains(ru.biosoft.access.DataElement)

### get

    public DataElement get(String name)
                     throws java.lang.Exception

  Gets data element with specified name. This implementation supports cache and for actual access use doGet(java.lang.String).
  Parameters:
    name - Name of the data element (cannot be null).
  Returns: DataElement or null if data element not found in the data collection.
  Throws:
    java.lang.Exception - If error raised in doGet(java.lang.String)
  See Also:
    doGet(java.lang.String), v_cache
  todo Check type of data element.

### getCompleteName

    public String getCompleteName()

  Gets complete name of data collection.
  Returns: full name of DataCollection in the tree hierarchy.

### getDataElementType

    public Class getDataElementType()

  Gets the type of DataElements stored in the data collection. The DataElement type should be specified using {&link DATA_ELEMENT_CLASS_PROPERTY} or should be specified in derived collections.
  Returns: Type of DataElements stored in the data collection.

### getDescription

    public String getDescription()

  Utility method that returns data collection description.

### getInfo

    public DataCollectionInfo getInfo()

  Gets data collection info.
  Returns: Data collection info.
  See Also:
    DataCollectionInfo

### getNameList

    public List getNameList()

  Gets list of all names in data collection.
  Returns: Names of all elements in the data collection.

### getSize

    public int getSize()

  Gets size of data collection. This method must be overrided for perfomance improving.
  Returns: Number of data element in this data collection.

### isMutable

    public boolean isMutable()

  Returns false. Override this method for return correct value.
  Returns: Always return false.

### isNotificationEnabled

    public boolean isNotificationEnabled()

### isPropagationEnabled

    public boolean isPropagationEnabled()

### propagateElementChanged

    public void propagateElementChanged(DataCollection source, DataCollectionEvent primaryEvent)

  todo comment

### propagateElementWillChange

    public void propagateElementWillChange(DataCollection source, DataCollectionEvent primaryEvent)

  todo comment

### put

    public DataElement put(DataElement element)
                     throws java.lang.Exception

  Adds the specified data element to the collection. Notifies all listeners if the data element was added or changed. `#doPut(DataElement)` method is used to put the data element. If the data collection previously contained the specified element, the old value is replaced.
  Note that this implementation slow enough!!!
  Parameters:
    element - Data element that will be putted in the data collection (Cannt be null).
  Returns: previous version of the data element, or null if there was no one.
  Throws:
    java.util.UnsupportedOperationException - if the data collection is unmutable.
    java.lang.Exception - If error occured.
  See Also:
    #doPut(DataElement), isMutable()
  todo should check DataElement type

### release

    public void release(String name)

  Release the DataElement specified by its name from the cache.
  pending whether this operation should be called by close operation.

### remove

    public void remove(String name)
                 throws java.lang.Exception,
                        java.lang.UnsupportedOperationException

  Removes the specified data element from the collection, if present. Notifies all listeners if the data element was removed. `#doRemove(ru.biosoft.access.DataElement)` method is used to remove the data element.
  Parameters:
    name
  Throws:
    UnsupportedOperationException - If the data collection is unmutable.
    Exception - If any error.
  See Also:
    #doRemove(ru.biosoft.access.DataElement), isMutable()

### removeDataCollectionListener

    public void removeDataCollectionListener(DataCollectionListener listener)

  Removes listener from this data collection.
  Parameters:
    listener - Listener of this data collection.

### setNotificationEnabled

    public void setNotificationEnabled(boolean isEnabled)

### setPropagationEnabled

    public void setPropagationEnabled(boolean propagationEnabled)

### toString

    public String toString()

  Returns a String representation of the data collection.
  Returns: String representation of the data collection.

Association Links

to Class java.util.HashMap

  Cache for already accessed data elements.

to Class org.apache.log4j.Category

  Log category

to Class java.lang.String

  todo Document

to Class ru.biosoft.access.DataCollectionInfo

  Data collection info for this data collection.

to Class javax.swing.event.EventListenerList

  List of listeners.

Overview | Package | Class | Use | Tree | Help
| FOOTER
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

BOTTOM