de.unikassel.android.sdcframework.data
Class SDCConfiguration

Package class diagram package SDCConfiguration
java.lang.Object
  extended by de.unikassel.android.sdcframework.data.SDCConfiguration
All Implemented Interfaces:
SerializableData

public final class SDCConfiguration
extends Object
implements SerializableData

This class is the serializable representation of the default configuration for the SDC framework.

For each available sensor it is necessary to configure a sensor configuration entry in the corresponding XML configuration file, which is located in the asset folder of the project.

An example for a valid SDC framework configuration file:

<sdcconfig>
<!-- the time providers configuration section -->
<providers>
<provider>ptbtime1.ptb.de<provider>
</providers>

<!-- the sensor configuration section -->
<sensors>
<sensor id="Accelerometer" enabled="true" frequency="10000" prio="Level4"/>
<sensor id="Bluetooth" enabled="true" frequency="60000" prio="Level3"/>
<sensor id="Wifi" enabled="true" frequency="60000" prio="Level2"/>
<sensor id="GPS" enabled="true" frequency="120000" prio="Level1"/>
<sensor id="GSM" enabled="true" frequency="60000" prio="Level0"/>
</sensors>

<!-- flag to indicate if sample broadcasting is enabled or not -->
<broadcastSamples>true</broadcastSamples>

<!-- flag to indicate if location information is added to each sample -->
<addSampleLocation>true</addSampleLocation>

<!-- flag to indicate if samples shall be stored for transmission -->
<storeSamples>true</storeSamples>

<!-- flag to indicate if samples shall be transfered to a remote server from time to time -->
<transferSamples>true</transferSamples>

<!-- flag to indicate if location information shall be stored in each sample -->
<addSampleLocation>true</addSampleLocation>

<!-- the database configuration section -->
<dbConfig>
<!-- the maximum database size in bytes -->
<maxSize>10485760</maxSize>

<!-- the database full strategy chain configuration ( valid values are: wait_delete_notify or wait_notify_stopservice ) -->
<dbFullStrategy>wait_delete_notify</dbFullStrategy>

<!-- the wait time used by the wait strategy ( in milliseconds ) -->
<waitStrategyMillis>10000</waitStrategyMillis>

<!-- the record count to delete used by the sample deletion strategy -->
<delStrategyRecordCount>1000</delStrategyRecordCount>

<!-- the flag indicating if sample deletion is done for lower priorities first by the sample deletion strategy ( if true the oldest samples with the lowest priority will be selected first for deletion, otherwise just the oldest samples ) -->
<delStrategyUsePrio>true</delStrategyUsePrio>
</dbConfig>

<!-- the transmission configuration section -->
<transferConfig>
<!-- the minimum count of samples for a single transmission -->
<minSampleCount>100</minSampleCount>

<!-- the maximum count of samples for a single transmission -->
<maxSampleCount>100</maxSampleCount>

<!-- the minimum transmission frequency in seconds -->
<minTransferFrequency>3600</minTransferFrequency>

<!-- the archive type to use for file transmission -->
<archiveType>zip</archiveType>

<protocolConfig>
<!-- the URL to transfer files to -->
<url>http://localhost</url>

<!-- the user name for remote authentication -->
<authName>Karli</authName>

<!-- the user password for remote authentication -->
<authPassword>unknown</authPassword>

<!-- the transfer strategy to use ( e.g. just any available wlan connection )-->
<transferStrategy>wlan</transferStrategy>
</protocolConfig>
</transferConfig>
</sdcconfig>

See Also:
SensorConfigurationEntry, DatabaseConfigurationEntry, SDCConfigurationManager

Field Summary
private  Long broadcastFrequency
          The broadcast frequency in milliseconds.
private  DatabaseConfigurationEntry databaseConfiguration
          The database configuration
private  Boolean isAddingSampleLocation
          The flag to configure that each sample gets a location fix added
private  Boolean isBroadcastingSamples
          The flag for the service sample broadcast behavior
private  Boolean isSamplingEnabled
          The flag for the sampling enabled state
private  Boolean isStoringSamples
          The flag for the service persistent storage behavior
private  Boolean isTransmittingSamples
          The flag for the service transmission behavior
private  TransmissionProtocolConfigurationEntry logTransferConfiguration
          The log file transfer configuration
private  List<SensorConfigurationEntry> sensorConfigurations
          The list of available sensors in the SDC service
private  TimeProviderConfigurationEntries timeProviderConfiguration
          The time provider entries
private  TransmissionConfigurationEntry transmissionConfiguration
          The transmission service configuration
private  WeeklySchedule weeklySchedule
          The weekly time schedule for the service.
 
Constructor Summary
SDCConfiguration()
          Constructor
 
Method Summary
 Long getBroadcastFrequency()
          Getter for the broadcast frequency
 DatabaseConfigurationEntry getDatabaseConfiguration()
          Getter for the database configuration
 List<SensorConfigurationEntry> getListSensorConfigurations()
          Getter for the sensorConfigurations
 TransmissionProtocolConfigurationEntry getLogTransferConfiguration()
          Getter for the logTransferConfiguration
 TimeProviderConfigurationEntries getTimeProviderConfigEntries()
          Getter for the NTP time provider entries
 TransmissionConfigurationEntry getTransmissionConfiguration()
          Getter for the transmissionConfiguration
 WeeklySchedule getWeeklySchedule()
          Getter for the weekly schedule.
 Boolean isAddingSampleLocation()
          Getter for the flag to configure location fix per sample
 Boolean isBroadcastingSamples()
          Getter for the flag for sample broadcasts behavior
 Boolean isSamplingEnabled()
          Getter for the isSamplingEnabled flag
 Boolean isStoringSamples()
          Getter for the flag for persistent storage behavior
 Boolean isTransmittingSamples()
          Getter for the isTransmittingSamples
 void setBroadcastFrequency(Long broadcastFrequency)
          Setter for the broadcast frequency
 void setBroadcastingSamples(Boolean isBroadcastingSamples)
          Setter for flag for sample broadcasts behavior
 void setDatabaseConfiguration(DatabaseConfigurationEntry databaseConfiguration)
          Setter for the database configuration
 void setIsAddingSampleLocation(Boolean isAddingSampleLocation)
          Setter for the flag to configure location fix per sample
 void setIsSamplingEnabled(Boolean isSamplingEnabled)
          Setter for the isSamplingEnabled flag
 void setListSensorConfigurations(List<SensorConfigurationEntry> sensorConfigurations)
          Setter for the sensorConfigurations
 void setLogTransferConfiguration(TransmissionProtocolConfigurationEntry logTransferConfiguration)
          Setter for the logTransferConfiguration
 void setStoringSamples(Boolean isStoringSamples)
          Setter for the flag for persistent storage behavior
 void setTimeProviderConfigEntries(TimeProviderConfigurationEntries timeProviders)
          Setter for the NTP time provider entries
 void setTransmissionConfiguration(TransmissionConfigurationEntry transmissionConfiguration)
          Setter for the transmissionConfiguration
 void setTransmittingSamples(Boolean isTransmittingSamples)
          Setter for the isTransmittingSamples
 void setWeeklySchedule(WeeklySchedule weeklySchedule)
          Setter for the weekly schedule.
 String toXML()
          Serialization from the type to it's XML representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timeProviderConfiguration

private TimeProviderConfigurationEntries timeProviderConfiguration
The time provider entries


sensorConfigurations

private List<SensorConfigurationEntry> sensorConfigurations
The list of available sensors in the SDC service


isBroadcastingSamples

private Boolean isBroadcastingSamples
The flag for the service sample broadcast behavior


broadcastFrequency

private Long broadcastFrequency
The broadcast frequency in milliseconds.


isSamplingEnabled

private Boolean isSamplingEnabled
The flag for the sampling enabled state


isAddingSampleLocation

private Boolean isAddingSampleLocation
The flag to configure that each sample gets a location fix added


isStoringSamples

private Boolean isStoringSamples
The flag for the service persistent storage behavior


isTransmittingSamples

private Boolean isTransmittingSamples
The flag for the service transmission behavior


databaseConfiguration

private DatabaseConfigurationEntry databaseConfiguration
The database configuration


transmissionConfiguration

private TransmissionConfigurationEntry transmissionConfiguration
The transmission service configuration


logTransferConfiguration

private TransmissionProtocolConfigurationEntry logTransferConfiguration
The log file transfer configuration


weeklySchedule

private WeeklySchedule weeklySchedule
The weekly time schedule for the service.

Constructor Detail

SDCConfiguration

public SDCConfiguration()
Constructor

Method Detail

getListSensorConfigurations

public final List<SensorConfigurationEntry> getListSensorConfigurations()
Getter for the sensorConfigurations

Returns:
the sensorConfigurations

setListSensorConfigurations

public final void setListSensorConfigurations(List<SensorConfigurationEntry> sensorConfigurations)
Setter for the sensorConfigurations

Parameters:
sensorConfigurations - the sensorConfigurations to set

getTimeProviderConfigEntries

public TimeProviderConfigurationEntries getTimeProviderConfigEntries()
Getter for the NTP time provider entries

Returns:
the NTP time provider entries

setTimeProviderConfigEntries

public void setTimeProviderConfigEntries(TimeProviderConfigurationEntries timeProviders)
Setter for the NTP time provider entries

Parameters:
timeProviders - the NTP time provider entries to set

setBroadcastingSamples

public final void setBroadcastingSamples(Boolean isBroadcastingSamples)
Setter for flag for sample broadcasts behavior

Parameters:
isBroadcastingSamples - the flag for sample broadcasts behavior to set

isBroadcastingSamples

public final Boolean isBroadcastingSamples()
Getter for the flag for sample broadcasts behavior

Returns:
true if samples shall be broadcasted, false otherwise

getBroadcastFrequency

public Long getBroadcastFrequency()
Getter for the broadcast frequency

Returns:
the broadcast frequency

setBroadcastFrequency

public void setBroadcastFrequency(Long broadcastFrequency)
Setter for the broadcast frequency

Parameters:
broadcastFrequency - the broadcast frequency to set

setIsSamplingEnabled

public void setIsSamplingEnabled(Boolean isSamplingEnabled)
Setter for the isSamplingEnabled flag

Parameters:
isSamplingEnabled - the isSamplingEnabled flag to set

isSamplingEnabled

public Boolean isSamplingEnabled()
Getter for the isSamplingEnabled flag

Returns:
the isSamplingEnabled flag

isAddingSampleLocation

public Boolean isAddingSampleLocation()
Getter for the flag to configure location fix per sample

Returns:
the flag to configure location fix per sample

setIsAddingSampleLocation

public final void setIsAddingSampleLocation(Boolean isAddingSampleLocation)
Setter for the flag to configure location fix per sample

Parameters:
isAddingSampleLocation - the flag to configure location fix per sample

setStoringSamples

public final void setStoringSamples(Boolean isStoringSamples)
Setter for the flag for persistent storage behavior

Parameters:
isStoringSamples - the flag for persistent storage behavior to set

isStoringSamples

public final Boolean isStoringSamples()
Getter for the flag for persistent storage behavior

Returns:
true if samples will be stored persistent for transmission service

setTransmittingSamples

public final void setTransmittingSamples(Boolean isTransmittingSamples)
Setter for the isTransmittingSamples

Parameters:
isTransmittingSamples - the isTransmittingSamples to set

isTransmittingSamples

public final Boolean isTransmittingSamples()
Getter for the isTransmittingSamples

Returns:
the isTransmittingSamples

getDatabaseConfiguration

public final DatabaseConfigurationEntry getDatabaseConfiguration()
Getter for the database configuration

Returns:
the database configuration

setDatabaseConfiguration

public final void setDatabaseConfiguration(DatabaseConfigurationEntry databaseConfiguration)
Setter for the database configuration

Parameters:
databaseConfiguration - the database configuration to set

getTransmissionConfiguration

public final TransmissionConfigurationEntry getTransmissionConfiguration()
Getter for the transmissionConfiguration

Returns:
the transmissionConfiguration

getLogTransferConfiguration

public TransmissionProtocolConfigurationEntry getLogTransferConfiguration()
Getter for the logTransferConfiguration

Returns:
the logTransferConfiguration

setLogTransferConfiguration

public void setLogTransferConfiguration(TransmissionProtocolConfigurationEntry logTransferConfiguration)
Setter for the logTransferConfiguration

Parameters:
logTransferConfiguration - the logTransferConfiguration to set

setTransmissionConfiguration

public final void setTransmissionConfiguration(TransmissionConfigurationEntry transmissionConfiguration)
Setter for the transmissionConfiguration

Parameters:
transmissionConfiguration - the transmissionConfiguration to set

setWeeklySchedule

public void setWeeklySchedule(WeeklySchedule weeklySchedule)
Setter for the weekly schedule.

Parameters:
weeklySchedule - the weekly schedule to set

getWeeklySchedule

public WeeklySchedule getWeeklySchedule()
Getter for the weekly schedule.

Returns:
the weekly schedule

toXML

public final String toXML()
                   throws Exception
Description copied from interface: SerializableData
Serialization from the type to it's XML representation

Specified by:
toXML in interface SerializableData
Returns:
the XML representation of the type if successful, null otherwise
Throws:
Exception - if the schema for the object is not valid