rename base package from net.benas to io.github.benas

pull/3/head
benas 11 years ago
parent c923f0d656
commit 85d636f70e

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.benas</groupId>
<groupId>io.github.benas</groupId>
<artifactId>easyrules</artifactId>
<version>1.1.0</version>
</parent>

@ -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.<br/>
* 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 {
}

@ -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.<br/>

@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
package net.benas.easyrules.api;
package io.github.easyrules.api;
import java.util.Set;

@ -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.<br/>

@ -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.<br/>

@ -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;

@ -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());

@ -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;
*/

@ -1,15 +0,0 @@
package net.benas.easyrules.api;
import javax.management.MXBean;
/**
* Interface to make rules manageable via JMX.<br/>
* 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 {
}

@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
package net.benas.easyrules.core;
package io.github.easyrules.core;
import org.junit.Before;
import org.junit.Test;

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.benas</groupId>
<groupId>io.github.benas</groupId>
<artifactId>easyrules</artifactId>
<version>1.1.0</version>
</parent>
@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>net.benas</groupId>
<groupId>io.github.benas</groupId>
<artifactId>easyrules-core</artifactId>
<version>1.1.0</version>
</dependency>
@ -31,7 +31,7 @@
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>net.benas.easyrules.samples.helloworld.HelloWorldSampleLauncher</mainClass>
<mainClass>io.github.easyrules.samples.helloworld.HelloWorldSampleLauncher</mainClass>
</configuration>
</plugin>
</plugins>
@ -47,7 +47,7 @@
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>net.benas.easyrules.samples.order.OrderSampleLauncher</mainClass>
<mainClass>io.github.easyrules.samples.order.OrderSampleLauncher</mainClass>
</configuration>
</plugin>
</plugins>

@ -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;
}
}

@ -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;

@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
package net.benas.easyrules.samples.order;
package io.github.easyrules.samples.order;
/**
* Customer java bean.

@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
package net.benas.easyrules.samples.order;
package io.github.easyrules.samples.order;
/**
* Order java bean.

@ -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...");

@ -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.<br/>
* 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);
}

@ -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.

@ -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;
}
}

@ -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.<br/>
* 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);
}

@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.benas</groupId>
<groupId>io.github.benas</groupId>
<artifactId>easyrules</artifactId>
<version>1.1.0</version>

Loading…
Cancel
Save