com.martealert
Class martealertTable

java.lang.Object
  extended bycom.martealert.martealertTable
All Implemented Interfaces:
martealertConstants, martealertRealTimeInterface
Direct Known Subclasses:
martealertAgents, martealertFirstLevel, martealertRealTime, martealertSqlUtils, martealertTopStats

public class martealertTable
extends java.lang.Object
implements martealertConstants, martealertRealTimeInterface

Object made with a vector of vector to store result of a sql query, and another vector to store column names.


Field Summary
protected static java.lang.String _
           
static martealertHashtable ALIASVAR
           
protected  java.util.Vector columnNames
           
protected  java.util.Vector data
           
static martealertHashtable DEFAULT
           
static martealertHashtable GROUPBY
           
static martealertHashtable IDENT
           
static martealertHashtable INDEX
           
static martealertHashtable INDEXSEARCH
           
static martealertHashtable NAMEDVAR
           
static martealertHashtable RELATION
           
static martealertHashtable SELECT
           
static martealertHashtable TX
           
static martealertHashtable UNNAMEDVAR
           
static martealertHashtable VAR
           
 
Fields inherited from interface com.martealert.martealertConstants
AMBIGUOUS_FIELDS, ANALYZER, CLASSIFICATION, COMPLETION, FTS, FTSTZ, HOUR_IN_MILLIS, INTERVAL, IPADDRS, LASTJOIN, LTS, LTSTZ, MAXMSGID, MAXSEVERITY, MFTS, MLTS, MSGID, MSOURCEPORT, NALERTS, NOTNULL_FIELDS, NULL_FIELDS, NXCLASSIFICATION, ORDER_BY_ALERTS, ORDER_BY_MAXTIME, ORDER_BY_TIME, PRELUDE_TABLES, PROTOCOL, SENSOR, SEVERITY, SEVERITY_COMPLETION, SOURCE, SOURCEIP, SOURCEPORT, SOURCEUID, TARGET, TARGETIP, TARGETPORT, TARGETPORT_PROTOCOL, TARGETUID, TERMINAL, TIME, TIMETZ, TLAST, TOP, TOTALTIME
 
Fields inherited from interface com.martealert.martealertRealTimeInterface
REAL_TIME_CLASSIFICATION, REAL_TIME_COMPLETION, REAL_TIME_MSGID, REAL_TIME_SEVERITY, REAL_TIME_SOURCEIP, REAL_TIME_TARGETIP, REAL_TIME_TIME
 
Constructor Summary
martealertTable()
          Creates a new empty instance of preludeTable
martealertTable(java.sql.Connection con, java.lang.String sql)
          Creates an instance with table obtained from SQL query and connection specified in params.
martealertTable(java.util.Vector data, java.util.Vector columnNames)
          Creates an initialized instance of preludeTable
 
Method Summary
 void clear()
           
 java.util.Vector getColumn(int column)
          Get a column from this martealertTable
 java.util.Vector getColumnNames()
          Get this.columnNames Vector.
 int getColumnSize()
          Get N dimension of MxN this.data Vector of Vectors
 java.util.Vector getData()
          Get this.data Vector of Vectors.
protected  int getFTSColumn()
          Get number of FTS column.
 int[] getIgnoredColumnsPdf()
          Get column numbers of a martealertTable to be ignored for generating pdf report.
 int[] getIpColumns()
          Get IP-columns numbers in an array of int.
protected  int getLTSColumn()
          Get number of LTS column.
 int[] getMultilineColumns()
          Get array with number of columns which rows can store multiline values (sub-rows).
 int[] getPercentColumns()
           
 int[] getPortColumns()
          Get port columns numbers in an array of int.
 int[] getProtocolColumns()
          Get array with number of protocol columns, to be solved from protocol table in database.
 java.util.Vector getRow(int row)
          Get a row from this martealertTable.
 int getRowSize()
          Get M dimension of MxN this.data Vector of Vectors
 int getSeverityColumn()
           
static java.lang.String getSqlRelation(java.lang.String sqltable, martealertHashFilter filter)
           
static martealertTable getTableVector(java.sql.Connection con, java.lang.String sql)
          Method to get tuples and columns according to sql query.
 java.lang.Object getValue(int row, int column)
          Get value from data Vector of Vectors in Object generic format.
 java.lang.Object getValue(int row, int column, java.lang.Object defaultIfNull)
          Get value from this data Vector of Vectors in Object generic format if value is not null.
 java.lang.Object getValue(int row, int column, java.lang.Object ob, java.lang.Object defaultIfobFound)
          Get value in position (row,column) of a table.
 void printTable()
          Print a Prelude generic table Vector in standard output
 void reload(java.sql.Connection con, martealertHashFilter filter)
          reload a martealertTable object in time interval [FTS, LTS]
 void setColumnNames(java.util.Vector columnNames)
          Set initial values to columnNames vector.
 void setDataVector(java.util.Vector data)
          Sets initial values to vectors.
 void setDataVector(java.util.Vector data, java.util.Vector columnNames)
          Sets initial values to data and columnNames vectors.
 void setValue(int row, int column, java.lang.Object ob)
          Set ob Object into this.data Vector of Vectors at (row, column) position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

protected java.util.Vector data

columnNames

protected java.util.Vector columnNames

_

protected static final java.lang.String _
See Also:
Constant Field Values

GROUPBY

public static martealertHashtable GROUPBY

DEFAULT

public static martealertHashtable DEFAULT

IDENT

public static martealertHashtable IDENT

VAR

public static martealertHashtable VAR

NAMEDVAR

public static martealertHashtable NAMEDVAR

UNNAMEDVAR

public static martealertHashtable UNNAMEDVAR

ALIASVAR

public static martealertHashtable ALIASVAR

TX

public static martealertHashtable TX

RELATION

public static martealertHashtable RELATION

SELECT

public static martealertHashtable SELECT

INDEXSEARCH

public static martealertHashtable INDEXSEARCH

INDEX

public static martealertHashtable INDEX
Constructor Detail

martealertTable

public martealertTable()
Creates a new empty instance of preludeTable


martealertTable

public martealertTable(java.sql.Connection con,
                       java.lang.String sql)
                throws java.sql.SQLException
Creates an instance with table obtained from SQL query and connection specified in params.

Parameters:
con - Connection variable to access PostgreSQL database.
sql - String with SQL query to fill martealertTable object.
Throws:
java.sql.SQLException - SQL syntax error executing query to define an object.

martealertTable

public martealertTable(java.util.Vector data,
                       java.util.Vector columnNames)
Creates an initialized instance of preludeTable

Parameters:
data - Vector of Vectors to store data.
columnNames - Vector with column names.
Method Detail

reload

public void reload(java.sql.Connection con,
                   martealertHashFilter filter)
            throws java.sql.SQLException
reload a martealertTable object in time interval [FTS, LTS]

Parameters:
con - Connection variable to access PostgreSQL database
filter - String to be added at the end of SQL query.
Throws:
java.sql.SQLException - SQL syntax error executing query.

clear

public void clear()

setDataVector

public void setDataVector(java.util.Vector data,
                          java.util.Vector columnNames)
Sets initial values to data and columnNames vectors.

Parameters:
data - Vector of vector to store database table query.
columnNames - Vector with column names

setColumnNames

public void setColumnNames(java.util.Vector columnNames)
Set initial values to columnNames vector.

Parameters:
columnNames - Vector with column names.

getValue

public java.lang.Object getValue(int row,
                                 int column)
                          throws java.lang.ArrayIndexOutOfBoundsException
Get value from data Vector of Vectors in Object generic format.

Parameters:
row - integer with row index of data vector.
column - integer with column indes of data vector.
Returns:
generic Object with bidimensional vector value.
Throws:
java.lang.ArrayIndexOutOfBoundsException - index exceeded of this martealertTable

getValue

public java.lang.Object getValue(int row,
                                 int column,
                                 java.lang.Object defaultIfNull)
Get value from this data Vector of Vectors in Object generic format if value is not null. Otherwise is returned defaultIfNull object.

Parameters:
row - row index.
column - column index.
defaultIfNull - Object returned if value in (row, column) position is null.
Returns:
Object with value in (row, column) pos. or default object if it's null.
Throws:
java.lang.ArrayIndexOutOfBoundsException - index exceeded of this martealertTable

getValue

public java.lang.Object getValue(int row,
                                 int column,
                                 java.lang.Object ob,
                                 java.lang.Object defaultIfobFound)
Get value in position (row,column) of a table. If value returned equals to Object ob, defaultIfobFound is returned

Parameters:
row - int row index.
column - int column index.
ob - Object specified to return defaultIfobFound in case ob is found.
defaultIfobFound - Object returned if ob is found.
Returns:
Object (row,column) from this.

getRow

public java.util.Vector getRow(int row)
                        throws java.lang.ArrayIndexOutOfBoundsException
Get a row from this martealertTable.

Parameters:
row - row index wanted.
Returns:
row Vector according to index specified.
Throws:
java.lang.ArrayIndexOutOfBoundsException - index exceeded of this martealertTable

getColumn

public java.util.Vector getColumn(int column)
                           throws java.lang.ArrayIndexOutOfBoundsException
Get a column from this martealertTable

Parameters:
column - column index wanted.
Returns:
Vector according to index specified.
Throws:
java.lang.ArrayIndexOutOfBoundsException - index exceeded of this martealertTable

getRowSize

public int getRowSize()
Get M dimension of MxN this.data Vector of Vectors

Returns:
integer with row size.

getColumnSize

public int getColumnSize()
Get N dimension of MxN this.data Vector of Vectors

Returns:
integer with column size.

setValue

public void setValue(int row,
                     int column,
                     java.lang.Object ob)
Set ob Object into this.data Vector of Vectors at (row, column) position

Parameters:
row - row index.
column - column index.
ob - Object to be set.

setDataVector

public void setDataVector(java.util.Vector data)
Sets initial values to vectors.

Parameters:
data - Vector of vector to store database table query.

getData

public java.util.Vector getData()
Get this.data Vector of Vectors.

Returns:
Vector of Vectors data of this martealertTable.

getColumnNames

public java.util.Vector getColumnNames()
Get this.columnNames Vector.

Returns:
Vector columnNames of this martealertTable.

getIgnoredColumnsPdf

public int[] getIgnoredColumnsPdf()
Get column numbers of a martealertTable to be ignored for generating pdf report.

Returns:
int array with column numbers that won't appear in pdf report.

printTable

public void printTable()
Print a Prelude generic table Vector in standard output


getTableVector

public static martealertTable getTableVector(java.sql.Connection con,
                                             java.lang.String sql)
                                      throws java.sql.SQLException
Method to get tuples and columns according to sql query.

Parameters:
con - Connection ip_address:port to connect to database.
sql - SQL command to execute over connection con.
Returns:
PreludeTable given by sql param query
Throws:
java.sql.SQLException - SQL syntax error in statement.executeQuery(String sql);

getIpColumns

public int[] getIpColumns()
Get IP-columns numbers in an array of int.

Returns:
Array of int with column number to be ip-resolved.

getMultilineColumns

public int[] getMultilineColumns()
Get array with number of columns which rows can store multiline values (sub-rows). It's quite useful for front-end to represent correctly martealertFirstLevel.

Returns:
Number of columns with multiline columns or null if any is found.

getFTSColumn

protected int getFTSColumn()
Get number of FTS column.

Returns:
Get number of FTS column or -1 if it isn't found.

getLTSColumn

protected int getLTSColumn()
Get number of LTS column.

Returns:
Get number of LTS column or -1 if it isn't found.

getProtocolColumns

public int[] getProtocolColumns()
Get array with number of protocol columns, to be solved from protocol table in database.

Returns:
Number of columns which store a protocol or null if any is found.

getPortColumns

public int[] getPortColumns()
Get port columns numbers in an array of int.

Returns:
Array of int with column number to be port (and therefore service) resolved.

getPercentColumns

public int[] getPercentColumns()

getSeverityColumn

public int getSeverityColumn()

getSqlRelation

public static java.lang.String getSqlRelation(java.lang.String sqltable,
                                              martealertHashFilter filter)


e-REdING. Biblioteca de la Escuela Superior de Ingenieros de Sevilla.


DISEÑO DE UNA PLATAFORMA DE GESTIÓN Y MONITORIZACIÓN DE EVENTOS DE SEGURIDAD

: Galera Ruiz, Alejandro David
: Ingeniería Telecomunicación
Contenido del proyecto: