2 * Copyright (C) 2015 - EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, version 2.1 only,
6 * as published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 package org
.lttng
.ust
.agent
.session
;
21 * Event filtering rule present in a tracing session.
23 * It typically comes from a "lttng enable-event" command, and contains a
24 * domain, event name, log level and filter string.
26 * @author Alexandre Montplaisir
28 public class EventRule
{
30 private final String eventName
;
31 private final LogLevelSelector logLevelSelector
;
32 private final String filterString
;
38 * The name of the tracepoint
39 * @param logLevelSelector
40 * The log level of the event rule
42 * The filtering string. May be null if there is no extra filter.
44 public EventRule(String eventName
, LogLevelSelector logLevelSelector
, String filterString
) {
45 this.eventName
= eventName
;
46 this.logLevelSelector
= logLevelSelector
;
47 this.filterString
= filterString
;
51 * Get the event name of this rule.
53 * @return The event name
55 public String
getEventName() {
60 * Get the log level filter configuration of the rule.
62 * @return The log level selector
64 public LogLevelSelector
getLogLevelSelector() {
65 return logLevelSelector
;
69 * Get the filter string associated with this rule.
71 * @return The filter string, may be null for no filter string.
73 public String
getFilterString() {
77 // ------------------------------------------------------------------------
78 // Methods from Object
79 // ------------------------------------------------------------------------
82 public int hashCode() {
85 result
= prime
* result
+ ((eventName
== null) ?
0 : eventName
.hashCode());
86 result
= prime
* result
+ ((filterString
== null) ?
0 : filterString
.hashCode());
87 result
= prime
* result
+ ((logLevelSelector
== null) ?
0 : logLevelSelector
.hashCode());
92 public boolean equals(Object obj
) {
99 if (getClass() != obj
.getClass()) {
102 EventRule other
= (EventRule
) obj
;
104 if (eventName
== null) {
105 if (other
.eventName
!= null) {
108 } else if (!eventName
.equals(other
.eventName
)) {
113 if (filterString
== null) {
114 if (other
.filterString
!= null) {
117 } else if (!filterString
.equals(other
.filterString
)) {
122 if (logLevelSelector
== null) {
123 if (other
.logLevelSelector
!= null) {
126 } else if (!logLevelSelector
.equals(other
.logLevelSelector
)) {