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

## ru.biosoft.access
Class FileEntryCollection

    java.lang.Object
      ru.biosoft.access.DataElementSupport
          ru.biosoft.access.AbstractDataCollection
              ru.biosoft.access.EntryCollection
                  ru.biosoft.access.FileEntryCollection

All Implemented Interfaces:
  DataCollection, DataElement

public class FileEntryCollection
extends EntryCollection

Implements simple access procedures to databases in EMBL-like format.

To do:
  it is necessary to implement JobControl for index building

Field Summary
`protected java.lang.String` | `end` End tag of Entry.
`protected java.io.RandomAccessFile` | `file` The data collection file.
`protected IndexTable` | `idxTable` Indexes for entry searching by identificator (primary key).
`static int` | `MAX_ENTRY_STR_LENGTH` If size of entry more than this constant then Entry store its data in file.
`protected java.util.List` | `nameList` Unmodefiable list of names.
`static java.lang.String` | `USE_INDEX_FILE` Property to indicate whether index file should be used (by default it is true).

Fields inherited from class ru.biosoft.access.EntryCollection
`ENTRY_DELIMITERS_PROPERTY, ENTRY_END_PROPERTY, ENTRY_ID_PROPERTY, ENTRY_START_PROPERTY`

Fields inherited from class ru.biosoft.access.AbstractDataCollection
`cat, info, notificationEnabled, path, propagationEnabled, v_cache`

Fields inherited from interface ru.biosoft.access.DataCollection
`CHILDREN_NODE_IMAGE, CHILDREN_NODE_VISIBLE, CLASS_PROPERTY, CLASSPATH_JAR_PROPERTY, COMPARATOR_OBJECT, CONFIG_FILE_PROPERTY, CONFIG_PATH_PROPERTY, DATA_ELEMENT_CLASS_PROPERTY, DEFAULT_CONFIG_FILE, DEFAULT_CONFIG_SUFFIX, DEFAULT_FILTER_CONFIG_SUFFIX, DEFAULT_FORMAT_CONFIG_SUFFIX, DEFAULT_NODE_CONFIG_SUFFIX, DEFAULT_REPOSITORY, DESCRIPTION_PROPERTY, DISPLAY_NAME_PROPERTY, FILE_PATH_PROPERTY, FILE_PROPERTY, FILTER_PROPERTY, ID_FORMAT, IS_ROOT, JOB_CONTROL_PROPERTY, LATE_CHILDREN_INITIALIZATION, MUTABLE, NAME_PROPERTY, NEXT_CONFIG, NODE_IMAGE, NODE_VISIBLE, PRIMARY_COLLECTION, REMOVE_CHILDREN, TRANSFORMER_CLASS`

Constructor Summary
`FileEntryCollection(DataCollection parent, java.util.Properties properties)` Loads the data collection and its indexes (currently only for id).

Method Summary
`void` | `close()` Closes data collection, releases all resources.
`boolean` | `contains(java.lang.String name)` Check is file entry collection contains data element with specified name.
`protected DataElement` | `doGet(java.lang.String name)` Read entry with specified name from file.
`protected void` | `doPut(DataElement element, boolean isNew)` Write entry into the file.
`protected void` | `doRemove(java.lang.String name)` Remove entry from the data collection.
`java.util.List` | `getNameList()` Gets list of all names in data collection.
`int` | `getSize()` Return size of data collection.
`boolean` | `isMutable()` Determine is this collection mutable (writable).
`java.util.Iterator` | `iterator()` Return iterator for data collection.

Methods inherited from class ru.biosoft.access.EntryCollection
`getDataElementType`

Methods inherited from class ru.biosoft.access.AbstractDataCollection
`addDataCollectionListener, cachePut, checkMutable, contains, doAddPostNotify, doAddPreNotify, doRemovePostNotify, doRemovePreNotify, finalize, fireElementAdded, fireElementChanged, fireElementRemoved, fireElementWillAdd, fireElementWillChange, fireElementWillRemove, get, getCompleteName, getDescription, getInfo, initLog, isNotificationEnabled, isPropagationEnabled, makeInfo, propagateElementChanged, propagateElementWillChange, put, registerRoot, release, remove, removeDataCollectionListener, setNotificationEnabled, setPropagationEnabled, toString`

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

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface ru.biosoft.access.DataElement
`getName, getOrigin`

Field Detail

### USE_INDEX_FILE

    public static final java.lang.String USE_INDEX_FILE

  Property to indicate whether index file should be used (by default it is true).

  See Also:
    Constant Field Values

### MAX_ENTRY_STR_LENGTH

    public static final int MAX_ENTRY_STR_LENGTH

  If size of entry more than this constant then Entry store its data in file.

  See Also:
    Constant Field Values

### file

    protected java.io.RandomAccessFile file

  The data collection file.

### idxTable

    protected IndexTable idxTable

  Indexes for entry searching by identificator (primary key).

  See Also:
    `IndexTable`

### nameList

    protected java.util.List nameList

  Unmodefiable list of names.

### end

    protected java.lang.String end

  End tag of Entry. (e.g // - for EMBL).

Constructor Detail

### FileEntryCollection

    public FileEntryCollection(DataCollection parent,
                               java.util.Properties properties)
                        throws java.lang.Exception

  Loads the data collection and its indexes (currently only for id). Used by `CollectionFactory`

Parameters:
  `parent` - Parent data collection.
  `properties` - Properties for creating FileEntryCollection
Throws:
  `java.lang.Exception`
See Also:
  `CollectionFactory`
To do:
  "see Format of config file"

Method Detail

### doGet

    protected DataElement doGet(java.lang.String name)
                         throws java.lang.Exception

  Read entry with specified name from file. Use index file for navigation through data file.

  Overrides:
    `doGet` in class `AbstractDataCollection`
  Parameters:
    `name` - Name (PK) of the data element that should be extract from data collection.
  Returns:
    DataElement with specified name.
  Throws:
    `java.lang.Exception`
  See Also:
    `AbstractDataCollection.get(String)`

### doPut

    protected void doPut(DataElement element,
                         boolean isNew)
                  throws java.lang.Exception

  Write entry into the file.

  Overrides:
    `doPut` in class `AbstractDataCollection`
  Parameters:
    `element` - Element that should be added into collection.
  Throws:
    `java.lang.Exception` - If data element cann't be added.
  See Also:
    `AbstractDataCollection.put(DataElement)`, `IndexTable.put(java.io.RandomAccessFile,String)`

### doRemove

    protected void doRemove(java.lang.String name)
                     throws java.lang.Exception

  Remove entry from the data collection. Current implementation not remove entry from the file, but only add 'deleted' after entry.

  Overrides:
    `doRemove` in class `AbstractDataCollection`
  Throws:
    `java.io.IOException` - If data element cann't be removed.
    `java.lang.Exception`
  See Also:
    `AbstractDataCollection.remove(String)`, `IndexTable.removeIndex(String)`

### getSize

    public int getSize()

  Return size of data collection.

  Specified by:
    `getSize` in interface `DataCollection`
  Overrides:
    `getSize` in class `AbstractDataCollection`
  Returns:
    Size of data collection.

### isMutable

    public boolean isMutable()

  Determine is this collection mutable (writable).

  Specified by:
    `isMutable` in interface `DataCollection`
  Overrides:
    `isMutable` in class `AbstractDataCollection`
  Returns:
    Always return TRUE.

### contains

    public boolean contains(java.lang.String name)

  Check is file entry collection contains data element with specified name.

  Specified by:
    `contains` in interface `DataCollection`
  Overrides:
    `contains` in class `AbstractDataCollection`
  Parameters:
    `name` - Name of data element.
  Returns:
    `true` - if contains, `false` otherwise.
  See Also:
    `AbstractDataCollection.contains(ru.biosoft.access.DataElement)`

### iterator

    public java.util.Iterator iterator()

  Return iterator for data collection. Method remove() supported only for mutable collections. After remove(),put(),get() iterator will be invalid.

  Returns:
    Iterator

### getNameList

    public java.util.List getNameList()

  Description copied from class: `AbstractDataCollection`
  Gets list of all names in data collection.

  Specified by:
    `getNameList` in interface `DataCollection`
  Overrides:
    `getNameList` in class `AbstractDataCollection`
  Returns:
    Names of all elements in the data collection.

### close

    public void close()
               throws java.lang.Exception

  Closes data collection, releases all resources. Close data file and index file. This method invalidates DataCollection instance.

  Specified by:
    `close` in interface `DataCollection`
  Overrides:
    `close` in class `AbstractDataCollection`
  Throws:
    `java.io.IOException` - When io error occured.
    `java.lang.Exception`

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

Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.