From 85d636f70eba41a5d923ab4400a5a8176bba132f Mon Sep 17 00:00:00 2001 From: benas Date: Sun, 8 Dec 2013 23:45:38 +0100 Subject: [PATCH] rename base package from net.benas to io.github.benas --- easyrules-core/pom.xml | 2 +- .../github/easyrules/api/JmxManagedRule.java | 39 ++++++++++++ .../github}/easyrules/api/Rule.java | 26 +++++++- .../github}/easyrules/api/RulesEngine.java | 2 +- .../easyrules/core/BasicJmxManagedRule.java | 4 +- .../github}/easyrules/core/BasicRule.java | 6 +- .../github}/easyrules/core/CompositeRule.java | 6 +- .../easyrules/core/DefaultRulesEngine.java | 12 ++-- .../easyrules/util/EasyRulesConstants.java | 4 +- .../benas/easyrules/api/JmxManagedRule.java | 15 ----- .../core/RulePriorityComparisonTest.java | 2 +- easyrules-samples/pom.xml | 8 +-- .../samples/helloworld/HelloWorldRule.java | 60 +++++++++++++++++++ .../helloworld/HelloWorldSampleLauncher.java | 6 +- .../easyrules/samples/order/Customer.java | 2 +- .../easyrules/samples/order/Order.java | 2 +- .../samples/order/OrderSampleLauncher.java | 8 +-- .../order/SuspectOrderJmxManagedRule.java | 53 ++++++++++++++++ .../samples/order/SuspectOrderRule.java | 4 +- .../samples/helloworld/HelloWorldRule.java | 36 ----------- .../order/SuspectOrderJmxManagedRule.java | 29 --------- pom.xml | 2 +- 22 files changed, 213 insertions(+), 115 deletions(-) create mode 100644 easyrules-core/src/main/java/io/github/easyrules/api/JmxManagedRule.java rename easyrules-core/src/main/java/{net/benas => io/github}/easyrules/api/Rule.java (51%) rename easyrules-core/src/main/java/{net/benas => io/github}/easyrules/api/RulesEngine.java (98%) rename easyrules-core/src/main/java/{net/benas => io/github}/easyrules/core/BasicJmxManagedRule.java (95%) rename easyrules-core/src/main/java/{net/benas => io/github}/easyrules/core/BasicRule.java (96%) rename easyrules-core/src/main/java/{net/benas => io/github}/easyrules/core/CompositeRule.java (96%) rename easyrules-core/src/main/java/{net/benas => io/github}/easyrules/core/DefaultRulesEngine.java (93%) rename easyrules-core/src/main/java/{net/benas => io/github}/easyrules/util/EasyRulesConstants.java (96%) delete mode 100644 easyrules-core/src/main/java/net/benas/easyrules/api/JmxManagedRule.java rename easyrules-core/src/test/java/{net/benas => io/github}/easyrules/core/RulePriorityComparisonTest.java (98%) create mode 100644 easyrules-samples/src/main/java/io/github/easyrules/samples/helloworld/HelloWorldRule.java rename easyrules-samples/src/main/java/{net/benas => io/github}/easyrules/samples/helloworld/HelloWorldSampleLauncher.java (93%) rename easyrules-samples/src/main/java/{net/benas => io/github}/easyrules/samples/order/Customer.java (97%) rename easyrules-samples/src/main/java/{net/benas => io/github}/easyrules/samples/order/Order.java (97%) rename easyrules-samples/src/main/java/{net/benas => io/github}/easyrules/samples/order/OrderSampleLauncher.java (94%) create mode 100644 easyrules-samples/src/main/java/io/github/easyrules/samples/order/SuspectOrderJmxManagedRule.java rename easyrules-samples/src/main/java/{net/benas => io/github}/easyrules/samples/order/SuspectOrderRule.java (96%) delete mode 100644 easyrules-samples/src/main/java/net/benas/easyrules/samples/helloworld/HelloWorldRule.java delete mode 100644 easyrules-samples/src/main/java/net/benas/easyrules/samples/order/SuspectOrderJmxManagedRule.java diff --git a/easyrules-core/pom.xml b/easyrules-core/pom.xml index 34b85cb..b63fb9b 100644 --- a/easyrules-core/pom.xml +++ b/easyrules-core/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - net.benas + io.github.benas easyrules 1.1.0 diff --git a/easyrules-core/src/main/java/io/github/easyrules/api/JmxManagedRule.java b/easyrules-core/src/main/java/io/github/easyrules/api/JmxManagedRule.java new file mode 100644 index 0000000..e2aa520 --- /dev/null +++ b/easyrules-core/src/main/java/io/github/easyrules/api/JmxManagedRule.java @@ -0,0 +1,39 @@ +/* + * The MIT License + * + * Copyright (c) 2013, benas (md.benhassine@gmail.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package io.github.easyrules.api; + +import javax.management.MXBean; + +/** + * Interface to make rules manageable via JMX.
+ * This interface can be extended with additional methods to add more specific rule properties. + * + * @author benas (md.benhassine@gmail.com) + */ + +@MXBean +public interface JmxManagedRule extends Rule { + +} diff --git a/easyrules-core/src/main/java/net/benas/easyrules/api/Rule.java b/easyrules-core/src/main/java/io/github/easyrules/api/Rule.java similarity index 51% rename from easyrules-core/src/main/java/net/benas/easyrules/api/Rule.java rename to easyrules-core/src/main/java/io/github/easyrules/api/Rule.java index f165ef7..a26ddf8 100644 --- a/easyrules-core/src/main/java/net/benas/easyrules/api/Rule.java +++ b/easyrules-core/src/main/java/io/github/easyrules/api/Rule.java @@ -1,4 +1,28 @@ -package net.benas.easyrules.api; +/* + * The MIT License + * + * Copyright (c) 2013, benas (md.benhassine@gmail.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package io.github.easyrules.api; /** * Abstraction for a rule that can be fired by the rules engine.
diff --git a/easyrules-core/src/main/java/net/benas/easyrules/api/RulesEngine.java b/easyrules-core/src/main/java/io/github/easyrules/api/RulesEngine.java similarity index 98% rename from easyrules-core/src/main/java/net/benas/easyrules/api/RulesEngine.java rename to easyrules-core/src/main/java/io/github/easyrules/api/RulesEngine.java index 9823a1a..337d93d 100644 --- a/easyrules-core/src/main/java/net/benas/easyrules/api/RulesEngine.java +++ b/easyrules-core/src/main/java/io/github/easyrules/api/RulesEngine.java @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -package net.benas.easyrules.api; +package io.github.easyrules.api; import java.util.Set; diff --git a/easyrules-core/src/main/java/net/benas/easyrules/core/BasicJmxManagedRule.java b/easyrules-core/src/main/java/io/github/easyrules/core/BasicJmxManagedRule.java similarity index 95% rename from easyrules-core/src/main/java/net/benas/easyrules/core/BasicJmxManagedRule.java rename to easyrules-core/src/main/java/io/github/easyrules/core/BasicJmxManagedRule.java index b43608a..c5d9910 100644 --- a/easyrules-core/src/main/java/net/benas/easyrules/core/BasicJmxManagedRule.java +++ b/easyrules-core/src/main/java/io/github/easyrules/core/BasicJmxManagedRule.java @@ -22,9 +22,9 @@ * THE SOFTWARE. */ -package net.benas.easyrules.core; +package io.github.easyrules.core; -import net.benas.easyrules.api.JmxManagedRule; +import io.github.easyrules.api.JmxManagedRule; /** * Basic class for JMX managed rules.
diff --git a/easyrules-core/src/main/java/net/benas/easyrules/core/BasicRule.java b/easyrules-core/src/main/java/io/github/easyrules/core/BasicRule.java similarity index 96% rename from easyrules-core/src/main/java/net/benas/easyrules/core/BasicRule.java rename to easyrules-core/src/main/java/io/github/easyrules/core/BasicRule.java index d974c6a..18edbe0 100644 --- a/easyrules-core/src/main/java/net/benas/easyrules/core/BasicRule.java +++ b/easyrules-core/src/main/java/io/github/easyrules/core/BasicRule.java @@ -22,10 +22,10 @@ * THE SOFTWARE. */ -package net.benas.easyrules.core; +package io.github.easyrules.core; -import net.benas.easyrules.api.Rule; -import net.benas.easyrules.util.EasyRulesConstants; +import io.github.easyrules.api.Rule; +import io.github.easyrules.util.EasyRulesConstants; /** * Basic rule implementation class that provide common methods.
diff --git a/easyrules-core/src/main/java/net/benas/easyrules/core/CompositeRule.java b/easyrules-core/src/main/java/io/github/easyrules/core/CompositeRule.java similarity index 96% rename from easyrules-core/src/main/java/net/benas/easyrules/core/CompositeRule.java rename to easyrules-core/src/main/java/io/github/easyrules/core/CompositeRule.java index 3892d00..4dd1a37 100644 --- a/easyrules-core/src/main/java/net/benas/easyrules/core/CompositeRule.java +++ b/easyrules-core/src/main/java/io/github/easyrules/core/CompositeRule.java @@ -22,10 +22,10 @@ * THE SOFTWARE. */ -package net.benas.easyrules.core; +package io.github.easyrules.core; -import net.benas.easyrules.api.Rule; -import net.benas.easyrules.util.EasyRulesConstants; +import io.github.easyrules.api.Rule; +import io.github.easyrules.util.EasyRulesConstants; import java.util.Set; import java.util.TreeSet; diff --git a/easyrules-core/src/main/java/net/benas/easyrules/core/DefaultRulesEngine.java b/easyrules-core/src/main/java/io/github/easyrules/core/DefaultRulesEngine.java similarity index 93% rename from easyrules-core/src/main/java/net/benas/easyrules/core/DefaultRulesEngine.java rename to easyrules-core/src/main/java/io/github/easyrules/core/DefaultRulesEngine.java index 454011e..99a3d67 100644 --- a/easyrules-core/src/main/java/net/benas/easyrules/core/DefaultRulesEngine.java +++ b/easyrules-core/src/main/java/io/github/easyrules/core/DefaultRulesEngine.java @@ -22,12 +22,12 @@ * THE SOFTWARE. */ -package net.benas.easyrules.core; +package io.github.easyrules.core; -import net.benas.easyrules.api.JmxManagedRule; -import net.benas.easyrules.api.Rule; -import net.benas.easyrules.api.RulesEngine; -import net.benas.easyrules.util.EasyRulesConstants; +import io.github.easyrules.api.JmxManagedRule; +import io.github.easyrules.api.Rule; +import io.github.easyrules.api.RulesEngine; +import io.github.easyrules.util.EasyRulesConstants; import javax.management.MBeanServer; import javax.management.ObjectName; @@ -158,7 +158,7 @@ public class DefaultRulesEngine implements RulesEngine { ObjectName name; try { - name = new ObjectName("net.benas.easyrules.jmx:type=" + JmxManagedRule.class.getSimpleName() + ",name=" + rule.getName()); + name = new ObjectName("io.github.benas.easyrules.jmx:type=" + JmxManagedRule.class.getSimpleName() + ",name=" + rule.getName()); if (!mBeanServer.isRegistered(name)) { mBeanServer.registerMBean(rule, name); logger.info("JMX MBean registered successfully as: " + name.getCanonicalName() + " for rule : " + rule.getName()); diff --git a/easyrules-core/src/main/java/net/benas/easyrules/util/EasyRulesConstants.java b/easyrules-core/src/main/java/io/github/easyrules/util/EasyRulesConstants.java similarity index 96% rename from easyrules-core/src/main/java/net/benas/easyrules/util/EasyRulesConstants.java rename to easyrules-core/src/main/java/io/github/easyrules/util/EasyRulesConstants.java index 7e30d37..d1379a7 100644 --- a/easyrules-core/src/main/java/net/benas/easyrules/util/EasyRulesConstants.java +++ b/easyrules-core/src/main/java/io/github/easyrules/util/EasyRulesConstants.java @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -package net.benas.easyrules.util; +package io.github.easyrules.util; /** * Easy Rules constants class. @@ -31,6 +31,8 @@ package net.benas.easyrules.util; */ public class EasyRulesConstants { + private EasyRulesConstants() {} + /** * EasyRules logger name; */ diff --git a/easyrules-core/src/main/java/net/benas/easyrules/api/JmxManagedRule.java b/easyrules-core/src/main/java/net/benas/easyrules/api/JmxManagedRule.java deleted file mode 100644 index 962ea1d..0000000 --- a/easyrules-core/src/main/java/net/benas/easyrules/api/JmxManagedRule.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.benas.easyrules.api; - -import javax.management.MXBean; - -/** - * Interface to make rules manageable via JMX.
- * This interface can be extended with additional methods to add more specific rule properties. - * - * @author benas (md.benhassine@gmail.com) - */ - -@MXBean -public interface JmxManagedRule extends Rule { - -} diff --git a/easyrules-core/src/test/java/net/benas/easyrules/core/RulePriorityComparisonTest.java b/easyrules-core/src/test/java/io/github/easyrules/core/RulePriorityComparisonTest.java similarity index 98% rename from easyrules-core/src/test/java/net/benas/easyrules/core/RulePriorityComparisonTest.java rename to easyrules-core/src/test/java/io/github/easyrules/core/RulePriorityComparisonTest.java index f9b28ce..ec1d8fc 100644 --- a/easyrules-core/src/test/java/net/benas/easyrules/core/RulePriorityComparisonTest.java +++ b/easyrules-core/src/test/java/io/github/easyrules/core/RulePriorityComparisonTest.java @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -package net.benas.easyrules.core; +package io.github.easyrules.core; import org.junit.Before; import org.junit.Test; diff --git a/easyrules-samples/pom.xml b/easyrules-samples/pom.xml index f76f7ca..9c2c80a 100644 --- a/easyrules-samples/pom.xml +++ b/easyrules-samples/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - net.benas + io.github.benas easyrules 1.1.0 @@ -14,7 +14,7 @@ - net.benas + io.github.benas easyrules-core 1.1.0 @@ -31,7 +31,7 @@ exec-maven-plugin 1.2.1 - net.benas.easyrules.samples.helloworld.HelloWorldSampleLauncher + io.github.easyrules.samples.helloworld.HelloWorldSampleLauncher @@ -47,7 +47,7 @@ exec-maven-plugin 1.2.1 - net.benas.easyrules.samples.order.OrderSampleLauncher + io.github.easyrules.samples.order.OrderSampleLauncher diff --git a/easyrules-samples/src/main/java/io/github/easyrules/samples/helloworld/HelloWorldRule.java b/easyrules-samples/src/main/java/io/github/easyrules/samples/helloworld/HelloWorldRule.java new file mode 100644 index 0000000..9f40597 --- /dev/null +++ b/easyrules-samples/src/main/java/io/github/easyrules/samples/helloworld/HelloWorldRule.java @@ -0,0 +1,60 @@ +/* + * The MIT License + * + * Copyright (c) 2013, benas (md.benhassine@gmail.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package io.github.easyrules.samples.helloworld; + +import io.github.easyrules.core.BasicRule; + +/** + * Hello World rule class. + * + * @author benas (md.benhassine@gmail.com) + */ +public class HelloWorldRule extends BasicRule { + + /** + * The user input + */ + private String input; + + public HelloWorldRule(String name, String description, int priority) { + super(name, description, priority); + } + + @Override + public boolean evaluateConditions() { + //The rule should be applied only if the user's response is yes (duke friend) + return input.equalsIgnoreCase("yes"); + } + + @Override + public void performActions() throws Exception { + //When rule conditions are satisfied, prints 'Hello duke's friend!' to the console + System.out.println("Hello duke's friend!"); + } + + public void setInput(String input) { + this.input = input; + } +} diff --git a/easyrules-samples/src/main/java/net/benas/easyrules/samples/helloworld/HelloWorldSampleLauncher.java b/easyrules-samples/src/main/java/io/github/easyrules/samples/helloworld/HelloWorldSampleLauncher.java similarity index 93% rename from easyrules-samples/src/main/java/net/benas/easyrules/samples/helloworld/HelloWorldSampleLauncher.java rename to easyrules-samples/src/main/java/io/github/easyrules/samples/helloworld/HelloWorldSampleLauncher.java index b22a75b..37895cc 100644 --- a/easyrules-samples/src/main/java/net/benas/easyrules/samples/helloworld/HelloWorldSampleLauncher.java +++ b/easyrules-samples/src/main/java/io/github/easyrules/samples/helloworld/HelloWorldSampleLauncher.java @@ -22,10 +22,10 @@ * THE SOFTWARE. */ -package net.benas.easyrules.samples.helloworld; +package io.github.easyrules.samples.helloworld; -import net.benas.easyrules.api.RulesEngine; -import net.benas.easyrules.core.DefaultRulesEngine; +import io.github.easyrules.api.RulesEngine; +import io.github.easyrules.core.DefaultRulesEngine; import java.util.Scanner; diff --git a/easyrules-samples/src/main/java/net/benas/easyrules/samples/order/Customer.java b/easyrules-samples/src/main/java/io/github/easyrules/samples/order/Customer.java similarity index 97% rename from easyrules-samples/src/main/java/net/benas/easyrules/samples/order/Customer.java rename to easyrules-samples/src/main/java/io/github/easyrules/samples/order/Customer.java index 90fbc9c..5bfc78c 100644 --- a/easyrules-samples/src/main/java/net/benas/easyrules/samples/order/Customer.java +++ b/easyrules-samples/src/main/java/io/github/easyrules/samples/order/Customer.java @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -package net.benas.easyrules.samples.order; +package io.github.easyrules.samples.order; /** * Customer java bean. diff --git a/easyrules-samples/src/main/java/net/benas/easyrules/samples/order/Order.java b/easyrules-samples/src/main/java/io/github/easyrules/samples/order/Order.java similarity index 97% rename from easyrules-samples/src/main/java/net/benas/easyrules/samples/order/Order.java rename to easyrules-samples/src/main/java/io/github/easyrules/samples/order/Order.java index 2cd026f..7d8ee68 100644 --- a/easyrules-samples/src/main/java/net/benas/easyrules/samples/order/Order.java +++ b/easyrules-samples/src/main/java/io/github/easyrules/samples/order/Order.java @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -package net.benas.easyrules.samples.order; +package io.github.easyrules.samples.order; /** * Order java bean. diff --git a/easyrules-samples/src/main/java/net/benas/easyrules/samples/order/OrderSampleLauncher.java b/easyrules-samples/src/main/java/io/github/easyrules/samples/order/OrderSampleLauncher.java similarity index 94% rename from easyrules-samples/src/main/java/net/benas/easyrules/samples/order/OrderSampleLauncher.java rename to easyrules-samples/src/main/java/io/github/easyrules/samples/order/OrderSampleLauncher.java index d6b45ed..0f8bfb8 100644 --- a/easyrules-samples/src/main/java/net/benas/easyrules/samples/order/OrderSampleLauncher.java +++ b/easyrules-samples/src/main/java/io/github/easyrules/samples/order/OrderSampleLauncher.java @@ -22,10 +22,10 @@ * THE SOFTWARE. */ -package net.benas.easyrules.samples.order; +package io.github.easyrules.samples.order; -import net.benas.easyrules.api.RulesEngine; -import net.benas.easyrules.core.DefaultRulesEngine; +import io.github.easyrules.api.RulesEngine; +import io.github.easyrules.core.DefaultRulesEngine; /** * Launcher class of the order sample. @@ -65,7 +65,7 @@ public class OrderSampleLauncher { rulesEngine.fireRules(); // Suspend execution for 30s to have time to update suspect order amount threshold via a JMX client. - Thread.sleep(30000); + Thread.sleep(300000); System.out.println("**************************************************************"); System.out.println("Re fire rules after updating suspect order amount threshold..."); diff --git a/easyrules-samples/src/main/java/io/github/easyrules/samples/order/SuspectOrderJmxManagedRule.java b/easyrules-samples/src/main/java/io/github/easyrules/samples/order/SuspectOrderJmxManagedRule.java new file mode 100644 index 0000000..cb1a8dc --- /dev/null +++ b/easyrules-samples/src/main/java/io/github/easyrules/samples/order/SuspectOrderJmxManagedRule.java @@ -0,0 +1,53 @@ +/* + * The MIT License + * + * Copyright (c) 2013, benas (md.benhassine@gmail.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package io.github.easyrules.samples.order; + +import io.github.easyrules.api.JmxManagedRule; + +import javax.management.MXBean; + +/** + * Interface to make suspect order rule manageable via JMX.
+ * Suspect order threshold should be changed at runtime. + * + * @author benas (md.benhassine@gmail.com) + */ + +@MXBean +public interface SuspectOrderJmxManagedRule extends JmxManagedRule { + + /** + * Get the current suspect order amount threshold + * @return current suspect order amount threshold + */ + float getSuspectOrderAmountThreshold(); + + /** + * Set the suspect order amount threshold + * @param suspectOrderAmountThreshold the new suspect order amount threshold + */ + void setSuspectOrderAmountThreshold(float suspectOrderAmountThreshold); + +} diff --git a/easyrules-samples/src/main/java/net/benas/easyrules/samples/order/SuspectOrderRule.java b/easyrules-samples/src/main/java/io/github/easyrules/samples/order/SuspectOrderRule.java similarity index 96% rename from easyrules-samples/src/main/java/net/benas/easyrules/samples/order/SuspectOrderRule.java rename to easyrules-samples/src/main/java/io/github/easyrules/samples/order/SuspectOrderRule.java index 9ebec1d..ceb0ba3 100644 --- a/easyrules-samples/src/main/java/net/benas/easyrules/samples/order/SuspectOrderRule.java +++ b/easyrules-samples/src/main/java/io/github/easyrules/samples/order/SuspectOrderRule.java @@ -22,9 +22,9 @@ * THE SOFTWARE. */ -package net.benas.easyrules.samples.order; +package io.github.easyrules.samples.order; -import net.benas.easyrules.core.BasicJmxManagedRule; +import io.github.easyrules.core.BasicJmxManagedRule; /** * Business rule class that defines suspect order rule. diff --git a/easyrules-samples/src/main/java/net/benas/easyrules/samples/helloworld/HelloWorldRule.java b/easyrules-samples/src/main/java/net/benas/easyrules/samples/helloworld/HelloWorldRule.java deleted file mode 100644 index 1e0c007..0000000 --- a/easyrules-samples/src/main/java/net/benas/easyrules/samples/helloworld/HelloWorldRule.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.benas.easyrules.samples.helloworld; - -import net.benas.easyrules.core.BasicRule; - -/** - * Hello World rule class. - * - * @author benas (md.benhassine@gmail.com) - */ -public class HelloWorldRule extends BasicRule { - - /** - * The user input - */ - private String input; - - public HelloWorldRule(String name, String description, int priority) { - super(name, description, priority); - } - - @Override - public boolean evaluateConditions() { - //The rule should be applied only if the user's response is yes (duke friend) - return input.equalsIgnoreCase("yes"); - } - - @Override - public void performActions() throws Exception { - //When rule conditions are satisfied, prints 'Hello duke's friend!' to the console - System.out.println("Hello duke's friend!"); - } - - public void setInput(String input) { - this.input = input; - } -} diff --git a/easyrules-samples/src/main/java/net/benas/easyrules/samples/order/SuspectOrderJmxManagedRule.java b/easyrules-samples/src/main/java/net/benas/easyrules/samples/order/SuspectOrderJmxManagedRule.java deleted file mode 100644 index 822a80f..0000000 --- a/easyrules-samples/src/main/java/net/benas/easyrules/samples/order/SuspectOrderJmxManagedRule.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.benas.easyrules.samples.order; - -import net.benas.easyrules.api.JmxManagedRule; - -import javax.management.MXBean; - -/** - * Interface to make suspect order rule manageable via JMX.
- * Suspect order threshold should be changed at runtime. - * - * @author benas (md.benhassine@gmail.com) - */ - -@MXBean -public interface SuspectOrderJmxManagedRule extends JmxManagedRule { - - /** - * Get the current suspect order amount threshold - * @return current suspect order amount threshold - */ - float getSuspectOrderAmountThreshold(); - - /** - * Set the suspect order amount threshold - * @param suspectOrderAmountThreshold the new suspect order amount threshold - */ - void setSuspectOrderAmountThreshold(float suspectOrderAmountThreshold); - -} diff --git a/pom.xml b/pom.xml index 94927fc..c897d96 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 - net.benas + io.github.benas easyrules 1.1.0