yass.database
Class PacketGeneratedEvent

java.lang.Object
  extended by yass.database.Event
      extended by yass.database.PacketGeneratedEvent

public class PacketGeneratedEvent
extends Event

A packet generation event which occurs in the simulator to be stored for later analysis


Field Summary
private static java.sql.PreparedStatement insertionPreparedStatement
          A database prepared statement with which to insert packet generation events into the database
private static org.apache.log4j.Logger log
          The logger
private  Packet packet
          The packet which was generated
 
Fields inherited from class yass.database.Event
INSERT_ATTEMPT_MAX
 
Constructor Summary
PacketGeneratedEvent(Packet packet)
          Creates a new instance of PacketGeneratedEvent
 
Method Summary
private static java.sql.PreparedStatement createInsertionPreparedStatement(Database database)
          Creates a database prepared statement with which to insert packet generation events into the database
static java.lang.String getInsertSql(DatabaseType type)
          Obtains SQL code to insert an instance of this event type into the relevant table
 Packet getPacket()
          Obtains the packet which was generated
static java.lang.String[] getPurgeSimulationSql(DatabaseType type)
           
static java.lang.String[] getRemoveRowSql(DatabaseType type)
          Obtains SQL code to remove instances of this event type from the relevant table
static java.lang.String[] getTableBuildSql(DatabaseType type)
          Obtains SQL code to build the database table used to store events of this type
static java.lang.String[] getTableDropSql(DatabaseType type)
          Obtains SQL code to drop the database table used to store events of this type
static java.lang.String getTableName()
          Obtains the name of the database table used to store events of this type
protected  void performInsert(Database database, double timestamp)
          Inserts the packet generation event into the supplied database with the specified timestamp
 
Methods inherited from class yass.database.Event
insertIntoDatabase, setDoubleColumn, setDoubleColumnSanitiseMissing, setIntegerColumn, setIntegerColumnSanitiseMissing, setShortColumn, setShortColumnSanitiseMissing, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

insertionPreparedStatement

private static java.sql.PreparedStatement insertionPreparedStatement
A database prepared statement with which to insert packet generation events into the database


log

private static org.apache.log4j.Logger log
The logger


packet

private Packet packet
The packet which was generated

Constructor Detail

PacketGeneratedEvent

public PacketGeneratedEvent(Packet packet)
Creates a new instance of PacketGeneratedEvent

Parameters:
packet - the packet which was generated
Method Detail

performInsert

protected void performInsert(Database database,
                             double timestamp)
                      throws java.sql.SQLException
Inserts the packet generation event into the supplied database with the specified timestamp

Specified by:
performInsert in class Event
Parameters:
database - the simulation event database
timestamp - the time at which the event occured
Throws:
java.sql.SQLException - if the event cannot be inserted into the database

createInsertionPreparedStatement

private static java.sql.PreparedStatement createInsertionPreparedStatement(Database database)
                                                                    throws java.sql.SQLException
Creates a database prepared statement with which to insert packet generation events into the database

Parameters:
database - the simulation event database
Returns:
the prepared statement
Throws:
java.sql.SQLException

getPacket

public Packet getPacket()
Obtains the packet which was generated

Returns:
the packet which was generated

getTableName

public static java.lang.String getTableName()
Obtains the name of the database table used to store events of this type

Returns:
the name of the database table used to store events of this type

getTableBuildSql

public static java.lang.String[] getTableBuildSql(DatabaseType type)
Obtains SQL code to build the database table used to store events of this type

Parameters:
type - the database type
Returns:
SQL code to build the database table used to store events of this type

getInsertSql

public static java.lang.String getInsertSql(DatabaseType type)
Obtains SQL code to insert an instance of this event type into the relevant table

Parameters:
type - the database type
Returns:
SQL code to insert an instance of this event type into the relevant table

getTableDropSql

public static java.lang.String[] getTableDropSql(DatabaseType type)
Obtains SQL code to drop the database table used to store events of this type

Parameters:
type - the database type
Returns:
SQL code to drop the database table used to store events of this type

getRemoveRowSql

public static java.lang.String[] getRemoveRowSql(DatabaseType type)
Obtains SQL code to remove instances of this event type from the relevant table

Parameters:
type - the database type
Returns:
SQL code to remove instances of this event type from the relevant table

getPurgeSimulationSql

public static java.lang.String[] getPurgeSimulationSql(DatabaseType type)