This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.easyrules.samples.bench; | |
import org.easyrules.core.AnnotatedRulesEngine; | |
import org.easyrules.core.DefaultRulesEngine; | |
import java.util.Random; | |
public class Benchmark { | |
public static final int NB_ITERATION = 20000; //should be even |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.easybatch.jdbc; | |
import org.easybatch.core.api.Record; | |
import org.easybatch.core.api.RecordMapper; | |
import org.easybatch.core.api.RecordProcessor; | |
import org.easybatch.core.dispatcher.PoisonRecordBroadcaster; | |
import org.easybatch.core.dispatcher.RoundRobinRecordDispatcher; | |
import org.easybatch.core.filter.PoisonRecordFilter; | |
import org.easybatch.core.impl.Engine; | |
import org.easybatch.core.mapper.GenericRecordMapper; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.easybatch.flatfile; | |
public class Tree { | |
private String adresse; | |
private float hauteur; | |
public Tree() { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.easybatch.core.api.Engine; | |
import org.easyrules.core.BasicRule; | |
public class JobRule extends BasicRule { | |
private ReportHolder reportHolder; | |
private ReportPredicate reportPredicate; | |
private Engine engine; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.easybatch.core.job.Job; | |
import org.easybatch.core.job.JobBuilder; | |
import org.easybatch.core.job.JobExecutor; | |
import org.easybatch.core.job.JobReport; | |
import org.easybatch.core.processor.RecordProcessor; | |
import org.easybatch.core.reader.IterableRecordReader; | |
import org.easybatch.core.record.Record; | |
import static java.util.Arrays.asList; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.easybatch.core.dispatcher.PoisonRecordBroadcaster; | |
import org.easybatch.core.dispatcher.RoundRobinRecordDispatcher; | |
import org.easybatch.core.filter.PoisonRecordFilter; | |
import org.easybatch.core.job.Job; | |
import org.easybatch.core.processor.RecordProcessingException; | |
import org.easybatch.core.processor.RecordProcessor; | |
import org.easybatch.core.reader.BlockingQueueRecordReader; | |
import org.easybatch.core.reader.IterableRecordReader; | |
import org.easybatch.core.record.Record; | |
import org.easybatch.core.writer.BlockingQueueRecordWriter; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get autoremove | |
sudo apt-get update | |
echo "Checking git version" | |
git --version | |
echo "Installing Jekyll" | |
gem install jekyll | |
cd ~/ && mkdir tools && cd tools |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.easyrules.annotation.Action; | |
import org.easyrules.annotation.Condition; | |
import org.easyrules.annotation.Rule; | |
import org.easyrules.api.RulesEngine; | |
import org.easyrules.core.AnnotatedRulesEngine; | |
public class Main { | |
public static void main(String[] args) { | |
RulesEngine rulesEngine = new AnnotatedRulesEngine(); | |
rulesEngine.registerRule(new MyRule()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) throws FileNotFoundException { | |
Engine engine = new EngineBuilder() | |
.reader(new FlatFileRecordReader(new File("/path/tp/ChessData-master/data.pgn"))) | |
.filter(new GrepFilter("[Result")) | |
.processor(new ComputationalRecordProcessor<StringRecord, StringRecord, Map<String, Integer>>() { | |
Map<String, Integer> results = new HashMap<String, Integer>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.sql.*; | |
public class DatabaseUtil { | |
private static final String DATABASE_URL = "jdbc:hsqldb:mem"; | |
private static final String USER = "sa"; | |
private static final String PASSWORD = "pwd"; | |
public static Connection getConnection() throws SQLException { | |
return DriverManager.getConnection(DATABASE_URL, USER, PASSWORD); |