Class AggregationEngine

java.lang.Object
  |
  +--AggregationEngine

public class AggregationEngine
extends java.lang.Object

Purpose: Aggregate the alerts which belong to same type
Description:
This program aggregate the alerts for each graph in the inputTable which has the structure (preparingID, preparedID, graphID), and output the simplified graph and the alert id mapping relationship to the aggregatedTable and mappingTable respectively. No change is made to input table. Time constraint is used to do the aggregation. A number less than 0 will do the fully reduction.
Note: Modification for union/in/exists
Input Table : GraphEdges/GraphEdgesFocus/GraphEdgesDecomposed
Output Table: SimplifiedGraphEdges/SimplifiedFocus/SimplifiedDecomposed
Other output Table: IDMappingA/IDMappingF/IDMappingD


Constructor Summary
AggregationEngine(java.sql.Connection conn, java.lang.String interval, java.lang.String inputTable, java.lang.String aggregatedTable, java.lang.String mappingTable)
           
 
Method Summary
 void aggregate()
           
 void aggregateOneGraph(int graphID)
          Aggregation.
 void aggregation()
          Aggregation: Browse the inputTable and do aggregation for each graph in it.
 void createWorkingTables()
          Create two tables: aggregatedTable (aggregated prepare-for relationship) and mappingTable (orignal alert ID versus aggregated alert ID).
 void dropWorkingTables()
          Drop the working tables
 void initMapping(int graphID)
          Initialize the mappingTable, set all "0" to the initial aggregated alert ID for a paticular graph
 void insertSimplifyGraph()
          write final result to the aggregatedTable using the relationship between inputTable and mappingTable (original alert ID is used as bridge); Now the prepare-for relationship in the aggregatedTable is in aggregated ID.
 long timeDiff(java.sql.Timestamp ds1, java.sql.Timestamp ds2)
          input two timestamps and return the time difference between these two timestamps; The second timestamp is later than the first one.
 void updateMapping(int alertID)
          update mappingTable, set aggregated alert ID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregationEngine

public AggregationEngine(java.sql.Connection conn,
                         java.lang.String interval,
                         java.lang.String inputTable,
                         java.lang.String aggregatedTable,
                         java.lang.String mappingTable)
Parameters:
conn - Connection with the database
interval - the time interval used in aggregation
inputTable - the table contains the original prepare-for relationship
aggregateTable - the table contains the aggregated prepare-for relationship
mappingTable - the table contains the mapping relationship between original alert id and aggregated alert id
Method Detail

aggregate

public void aggregate()

dropWorkingTables

public void dropWorkingTables()
Drop the working tables

createWorkingTables

public void createWorkingTables()
Create two tables: aggregatedTable (aggregated prepare-for relationship) and mappingTable (orignal alert ID versus aggregated alert ID).

initMapping

public void initMapping(int graphID)
Initialize the mappingTable, set all "0" to the initial aggregated alert ID for a paticular graph
Parameters:
graphID - the graph that will be processed

updateMapping

public void updateMapping(int alertID)
update mappingTable, set aggregated alert ID
Parameters:
alertID - original hyper alert ID

insertSimplifyGraph

public void insertSimplifyGraph()
write final result to the aggregatedTable using the relationship between inputTable and mappingTable (original alert ID is used as bridge); Now the prepare-for relationship in the aggregatedTable is in aggregated ID.

timeDiff

public long timeDiff(java.sql.Timestamp ds1,
                     java.sql.Timestamp ds2)
input two timestamps and return the time difference between these two timestamps; The second timestamp is later than the first one.
Parameters:
ds1 - timestamp for the previous alert
ds2 - timestamp for the later alert
Returns:
a long integer which indicates the time difference

aggregateOneGraph

public void aggregateOneGraph(int graphID)
Aggregation.
Parameters:
graphID - the graph that is going to be aggregated.

aggregation

public void aggregation()
Aggregation: Browse the inputTable and do aggregation for each graph in it.