Acquisition.offlineFuncs
Class OfflineFileServer

java.lang.Object
  extended by Acquisition.offlineFuncs.OfflineFileServer
All Implemented Interfaces:
OfflineDataStore, PamSettings

public class OfflineFileServer
extends java.lang.Object
implements OfflineDataStore, PamSettings

Functionality for handling data from files offline.

Author:
Doug Gillespie

Nested Class Summary
private  class OfflineFileServer.MapMaker
           
 
Field Summary
private  AcquisitionControl acquisitionControl
           
private  javax.sound.sampled.AudioFormat audioFormat
           
private  javax.sound.sampled.AudioInputStream audioInputStream
           
private  ByteConverter byteConverter
           
private  WavFileDataMap dataMap
           
private  FileDate fileDate
           
private  FileMapMakingdialog mapDialog
           
private  OfflineFileServer.MapMaker mapMaker
           
private  OfflineFileParameters offlineFileParameters
           
private  PamRawDataBlock rawDataBlock
           
 
Constructor Summary
OfflineFileServer(AcquisitionControl acquisitionControl)
           
 
Method Summary
private  void addToMap(java.io.File file)
          Add a single sound file to the data map
private  void addToMap(java.io.File folderName, boolean includeSubFolders)
           
 void createOfflineDataMap(java.awt.Window parentFrame)
          Create a basic map of the data including first and last times and some kind of data/unit time count plus ideally some kind of start and stop time list of where there are gaps in the data.
private  WavFileDataMapPoint findFirstMapPoint(java.util.Iterator<WavFileDataMapPoint> mapIterator, long startMillis, long endMillis)
           
 java.lang.String getDataSourceName()
          Get the data source name
private  void getMapTimes()
           
 OfflineFileParameters getOfflineFileParameters()
           
 java.io.Serializable getSettingsReference()
           
 long getSettingsVersion()
           
 java.lang.String getUnitName()
           
 java.lang.String getUnitType()
           
 boolean loadData(PamDataBlock dataBlock, long dataStart, long dataEnd)
          Load data for a given datablock between two time limits.
private  boolean openSoundFile(java.io.File soundFile)
           
 boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
           
 boolean saveData(PamDataBlock dataBlock)
          Save data previously loaded from the store during offline viewing.
 void setOfflineFileParameters(OfflineFileParameters offlineFileParameters)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

acquisitionControl

private AcquisitionControl acquisitionControl

offlineFileParameters

private OfflineFileParameters offlineFileParameters

dataMap

private WavFileDataMap dataMap

fileDate

private FileDate fileDate

rawDataBlock

private PamRawDataBlock rawDataBlock

mapDialog

private FileMapMakingdialog mapDialog

mapMaker

private OfflineFileServer.MapMaker mapMaker

audioInputStream

private javax.sound.sampled.AudioInputStream audioInputStream

audioFormat

private javax.sound.sampled.AudioFormat audioFormat

byteConverter

private ByteConverter byteConverter
Constructor Detail

OfflineFileServer

public OfflineFileServer(AcquisitionControl acquisitionControl)
Parameters:
acquisitionControl -
Method Detail

createOfflineDataMap

public void createOfflineDataMap(java.awt.Window parentFrame)
Description copied from interface: OfflineDataStore
Create a basic map of the data including first and last times and some kind of data/unit time count plus ideally some kind of start and stop time list of where there are gaps in the data.

Specified by:
createOfflineDataMap in interface OfflineDataStore

addToMap

private void addToMap(java.io.File folderName,
                      boolean includeSubFolders)

addToMap

private void addToMap(java.io.File file)
Add a single sound file to the data map

Parameters:
file -

getMapTimes

private void getMapTimes()

getDataSourceName

public java.lang.String getDataSourceName()
Description copied from interface: OfflineDataStore
Get the data source name

Specified by:
getDataSourceName in interface OfflineDataStore
Returns:
data source name

loadData

public boolean loadData(PamDataBlock dataBlock,
                        long dataStart,
                        long dataEnd)
Description copied from interface: OfflineDataStore
Load data for a given datablock between two time limits.

Specified by:
loadData in interface OfflineDataStore
Parameters:
dataBlock - datablock owner of the data
dataStart - start time in milliseconds
dataEnd - end time in milliseconds
Returns:
true if load successful.

openSoundFile

private boolean openSoundFile(java.io.File soundFile)

findFirstMapPoint

private WavFileDataMapPoint findFirstMapPoint(java.util.Iterator<WavFileDataMapPoint> mapIterator,
                                              long startMillis,
                                              long endMillis)

saveData

public boolean saveData(PamDataBlock dataBlock)
Description copied from interface: OfflineDataStore
Save data previously loaded from the store during offline viewing.

Specified by:
saveData in interface OfflineDataStore
Parameters:
dataBlock - datablock owner of the data
Returns:
true if saved or save not needed. False if an error prevents saving.

getSettingsReference

public java.io.Serializable getSettingsReference()
Specified by:
getSettingsReference in interface PamSettings
Returns:
The serialisable object that will be stored

getSettingsVersion

public long getSettingsVersion()
Specified by:
getSettingsVersion in interface PamSettings
Returns:
An integer version number for the settings

getUnitName

public java.lang.String getUnitName()
Specified by:
getUnitName in interface PamSettings
Returns:
A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.

getUnitType

public java.lang.String getUnitType()
Specified by:
getUnitType in interface PamSettings
Returns:
A Name specific to the type, e.g. Glick detector

restoreSettings

public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
Specified by:
restoreSettings in interface PamSettings
Returns:
true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required

getOfflineFileParameters

public OfflineFileParameters getOfflineFileParameters()
Returns:
the offlineFileParameters

setOfflineFileParameters

public void setOfflineFileParameters(OfflineFileParameters offlineFileParameters)
Parameters:
offlineFileParameters - the offlineFileParameters to set