org.openmuc.mux.dbprovider.slotsdb
Class FileObjectList

java.lang.Object
  extended by org.openmuc.mux.dbprovider.slotsdb.FileObjectList

public class FileObjectList
extends java.lang.Object

Class representing a folder in a SlotsDatabase.

./rootnode/20110129/Label1/1298734198000.opm
/1298734598000.opm
/Label2/
/20110130/Label1/
/Label2/

Usually there is only 1 File in a Folder/FileObjectList
But there might be more then 1 file in terms of reconfiguration.


Constructor Summary
FileObjectList(java.lang.String foldername)
          Creates a FileObjectList
and creates a FileObject for every File
 
Method Summary
 void closeAllFiles()
          Closes all files in this List.
 void flush()
          Flushes all FileObjects in this list.
 FileObject get(int position)
          Returns the File Object at any position in list.
 java.util.List<FileObject> getAllFileObjects()
          Returns all FileObjects in this List.
 FileObject getCurrentFileObject()
          Returns the last created FileObject
 FileObject getFileObjectForTimestamp(long timestamp)
          Returns a FileObject in this List for a certain Timestamp.
 java.util.List<FileObject> getFileObjectsFromTo(long start, long end)
          Returns all FileObjects which contain Data from start to end timestamps
 java.util.List<FileObject> getFileObjectsStartingAt(long timestamp)
          Returns All FileObject in this List, which contain Data starting at given timestamp.
 java.util.List<FileObject> getFileObjectsUntil(long timestamp)
          Returns all FileObjects which contain Data before ending at given timestamp.
 long getFirstTS()
          Returns first recorded timestamp of oldest FileObject in this list.
 void reLoadFolder()
          Reloads the List
 void reLoadFolder(java.lang.String foldername)
          Reloads the List
 int size()
          Returns the size (Number of Files in this Folder/FileObjectList)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileObjectList

public FileObjectList(java.lang.String foldername)
               throws java.io.IOException
Creates a FileObjectList
and creates a FileObject for every File

Parameters:
foldername -
Throws:
java.io.IOException
Method Detail

reLoadFolder

public void reLoadFolder(java.lang.String foldername)
                  throws java.io.IOException
Reloads the List

Parameters:
foldername - containing Files
Throws:
java.io.IOException

reLoadFolder

public void reLoadFolder()
                  throws java.io.IOException
Reloads the List

Throws:
java.io.IOException

getCurrentFileObject

public FileObject getCurrentFileObject()
Returns the last created FileObject


get

public FileObject get(int position)
Returns the File Object at any position in list.

Parameters:
position -

size

public int size()
Returns the size (Number of Files in this Folder/FileObjectList)


closeAllFiles

public void closeAllFiles()
                   throws java.io.IOException
Closes all files in this List. This will also cause DataOutputStreams to be flushed.

Throws:
java.io.IOException

getFileObjectForTimestamp

public FileObject getFileObjectForTimestamp(long timestamp)
Returns a FileObject in this List for a certain Timestamp. If there is no FileObject containing this Value, null will be returned.

Parameters:
timestamp -

getFileObjectsStartingAt

public java.util.List<FileObject> getFileObjectsStartingAt(long timestamp)
Returns All FileObject in this List, which contain Data starting at given timestamp.

Parameters:
timestamp -

getAllFileObjects

public java.util.List<FileObject> getAllFileObjects()
Returns all FileObjects in this List.


getFileObjectsUntil

public java.util.List<FileObject> getFileObjectsUntil(long timestamp)
Returns all FileObjects which contain Data before ending at given timestamp.

Parameters:
timestamp -

getFileObjectsFromTo

public java.util.List<FileObject> getFileObjectsFromTo(long start,
                                                       long end)
Returns all FileObjects which contain Data from start to end timestamps

Parameters:
start -
end -

getFirstTS

public long getFirstTS()
Returns first recorded timestamp of oldest FileObject in this list. If List is empty, this timestamp will be set to 00:00:00 o'clock


flush

public void flush()
           throws java.io.IOException
Flushes all FileObjects in this list.

Throws:
java.io.IOException