|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.josql.filters.AbstractJoSQLFilter org.josql.filters.JoSQLLogRecordFilter
public class JoSQLLogRecordFilter
A Filter
that uses a JoSQL statement to provide the filtering.
The value returned by the isLoggable(LogRecord)
method is determined by executing the
WHERE clause of a JoSQL statement on each LogRecord
passed in.
Since this uses a sub-set of the JoSQL functionality certain restrictions apply:
SELECT * FROMjava.tuil.logging.LogRecord
WHERE name $LIKE '%.html' AND millis >toDateMillis
('12-04-2004') AND sequenceNumber BETWEEN (10000 AND 20000) AND message $LIKE '%internal%' AND loggerName = 'internal_logger' AND level.name IN ('SEVERE', 'WARNING')
If you are using a custom log record then you can always just extend this class and override
the getExpectedClass()
method to return your specific sub-class.
Field Summary | |
---|---|
protected Class |
expected
|
Fields inherited from class org.josql.filters.AbstractJoSQLFilter |
---|
badQuery, exp, q |
Constructor Summary | |
---|---|
JoSQLLogRecordFilter(Query q)
Init this filter with the query already built and parsed. |
|
JoSQLLogRecordFilter(String q)
Init this filter with the query. |
Method Summary | |
---|---|
boolean |
accept(Object o)
|
Class |
getExpectedClass()
Always returns LogRecord . |
boolean |
isLoggable(LogRecord l)
Apply the WHERE clause of the statement to the LogRecord passed in. |
Methods inherited from class org.josql.filters.AbstractJoSQLFilter |
---|
clearException, getException, getQuery, setQuery, setQuery |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Class expected
Constructor Detail |
---|
public JoSQLLogRecordFilter(String q) throws QueryParseException
q
- The query.
QueryParseException
- If there is an issue with the parsing of the query,
or if the FROM class is not LogRecord
.public JoSQLLogRecordFilter(Query q) throws IllegalStateException, QueryParseException
q
- The query.
IllegalStateException
- If the Query object has not been parsed.
QueryParseException
- If the FROM class is not LogRecord
.Method Detail |
---|
public boolean accept(Object o)
accept
in class AbstractJoSQLFilter
public boolean isLoggable(LogRecord l)
LogRecord
passed in.
If an exception is thrown by the execution of the WHERE clause the Query
is marked as "dirty" and the where clause is no longer executed on the passed in
files (since it is likely that the WHERE clause will fail for all LogRecord objects).
You can get access to exception by using: AbstractJoSQLFilter.getException()
.
isLoggable
in interface Filter
l
- The log record to evaluate the WHERE on.
true
if the WHERE clause evaluates to true
.public Class getExpectedClass()
LogRecord
.
getExpectedClass
in class AbstractJoSQLFilter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |