Skip to content

Commit

Permalink
Refactor logger dependencies on java API
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasponce authored and jshaughn committed Sep 28, 2015
1 parent 38c2090 commit 5397141
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 80 deletions.
18 changes: 0 additions & 18 deletions hawkular-alerts-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,6 @@
<dependencies>

<!-- Wildfly dependencies -->
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-annotations</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import static org.hawkular.alerts.api.model.trigger.Mode.FIRING;

import org.hawkular.alerts.api.log.MsgLogger;
import org.hawkular.alerts.api.model.data.AvailabilityType;
import org.hawkular.alerts.api.model.trigger.Mode;

Expand All @@ -32,7 +31,6 @@
* @author Lucas Ponce
*/
public class AvailabilityCondition extends Condition {
private static final MsgLogger msgLog = MsgLogger.LOGGER;

public enum Operator {
DOWN, NOT_UP, UP
Expand Down Expand Up @@ -102,8 +100,7 @@ public boolean match(AvailabilityType value) {
case NOT_UP:
return value != AvailabilityType.UP;
default:
msgLog.warnUnknowOperatorOnCondition(operator.name(), this.getClass().getName());
return false;
throw new IllegalStateException("Unknown operator: " + operator.name());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import static org.hawkular.alerts.api.model.trigger.Mode.FIRING;

import org.hawkular.alerts.api.log.MsgLogger;
import org.hawkular.alerts.api.model.trigger.Mode;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand All @@ -32,7 +31,6 @@
* @author Lucas Ponce
*/
public class CompareCondition extends Condition {
private static final MsgLogger msgLog = MsgLogger.LOGGER;

public enum Operator {
LT, GT, LTE, GTE
Expand Down Expand Up @@ -132,8 +130,7 @@ public boolean match(double dataValue, double data2Value) {
case GTE:
return dataValue >= threshold;
default:
msgLog.warnUnknowOperatorOnCondition(operator.name(), this.getClass().getName());
return false;
throw new IllegalStateException("Unknown operator: " + operator.name());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.hawkular.alerts.api.model.condition;

import org.hawkular.alerts.api.log.MsgLogger;
import org.hawkular.alerts.api.model.trigger.Mode;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand All @@ -29,7 +28,6 @@
* @author Lucas Ponce
*/
public class StringCondition extends Condition {
private static final MsgLogger msgLog = MsgLogger.LOGGER;

public enum Operator {
EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, MATCH
Expand Down Expand Up @@ -136,8 +134,7 @@ public boolean match(String value) {
case MATCH:
return value.matches(ignoreCase ? ("(?i)" + pattern) : pattern);
default:
msgLog.warnUnknowOperatorOnCondition(operator.name(), this.getClass().getName());
return false;
throw new IllegalStateException("Unknown operator: " + operator.name());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.hawkular.alerts.api.model.condition;

import org.hawkular.alerts.api.log.MsgLogger;
import org.hawkular.alerts.api.model.trigger.Mode;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand All @@ -29,7 +28,6 @@
* @author Lucas Ponce
*/
public class ThresholdCondition extends Condition {
private static final MsgLogger msgLog = MsgLogger.LOGGER;

public enum Operator {
LT, GT, LTE, GTE
Expand Down Expand Up @@ -116,8 +114,7 @@ public boolean match(double value) {
case GTE:
return value >= threshold;
default:
msgLog.warnUnknowOperatorOnCondition(operator.name(), this.getClass().getName());
return false;
throw new IllegalStateException("Unknown operator: " + operator.name());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.hawkular.alerts.api.model.condition;

import org.hawkular.alerts.api.log.MsgLogger;
import org.hawkular.alerts.api.model.trigger.Mode;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand All @@ -28,7 +27,6 @@
* @author Lucas Ponce
*/
public class ThresholdRangeCondition extends Condition {
private static final MsgLogger msgLog = MsgLogger.LOGGER;

public enum Operator {
INCLUSIVE("[", "]"), EXCLUSIVE("(", ")");
Expand Down Expand Up @@ -175,8 +173,7 @@ public boolean match(double value) {
aboveLow = value > thresholdLow;
break;
default:
msgLog.warnUnknowOperatorOnCondition(operatorLow.name(), this.getClass().getName());
return false;
throw new IllegalStateException("Unknown operatorLow: " + operatorLow.name());
}

if (!aboveLow) {
Expand All @@ -191,8 +188,7 @@ public boolean match(double value) {
belowHigh = value < thresholdHigh;
break;
default:
msgLog.warnUnknowOperatorOnCondition(operatorHigh.name(), this.getClass().getName());
return false;
throw new IllegalStateException("Unknown operatorHigh: " + operatorLow.name());
}

return (belowHigh == inRange);
Expand Down

0 comments on commit 5397141

Please sign in to comment.