Skip to content

Commit

Permalink
Move Katalyzer from properties to YAML configuration.
Browse files Browse the repository at this point in the history
Addresses issue #1.
  • Loading branch information
eldering committed Feb 25, 2017
1 parent 5743cde commit 588e93e
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config.yaml
katalyze/bin
katalyze/katalyzer.properties
katalyze/katalyzer.yaml
.metadata
*.class
*~
Expand Down
61 changes: 0 additions & 61 deletions katalyze/katalyzer.properties.template

This file was deleted.

71 changes: 71 additions & 0 deletions katalyze/katalyzer.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# AutoAnalyst Katalyzer YAML configuration file

# ---- INPUTS ---------------------------------------------------------------------------

# These are currently not in use
#input: tcp://192.168.1.1:4714
#input: data/kattislog_vm2010.txt

# ---- OUTPUTS ---------------------------------------------------------------------------
#

# --- Database export
db:
enable: true
driver: com.mysql.jdbc.Driver
connection: jdbc:mysql://localhost/icat?user=icat&password=THISISNOTAPASSWORD

# --- Web Server
web:
enable: true
compress: true
port: 8099

# --- File publisher
#file:
# enable: true
# targetDirectory: /Users/Stein/Dev/icat/output

# -- Twitter
twitter:
enable: false
oAuthConsumer: ["", ""]
accessToken: ["", ""]
hashtag: "#katalyzer"

# -- Event Stream
eventStream:
enable: true
target: /Users/Stein/Dev/icat/bin/eventstream.xml

# The eventStream.target file needs to be writable by the katalyzer process in order for
# the event stream to be available. This also applies if you are only accessing the event
# stream using http


# ---- RULES ---------------------------------------------------------------------------

rule:

# ProblemFirstSolved - whenever a problem is solved for the first time
problemFirstSolved:
enable: true

# NewLeader - when a team takes the lead, or gets into the top n positions
newLeader:
enable: true
ranks: 10
breakingRanks: 5

# RejectedSubmission - when the judges reject a submission from
# one of the top n teams
rejectedSubmission:
enable: true
ranks: 10

# RankPredictor - when a team submits a solution that would put
# the team among the top n teams
rankPredictor:
enable: true
ranks: 10
# exec: "./capture.sh {teamId} {time} {currentRank} {potentialRank}"
Binary file added katalyze/lib/configurations-yaml-0.5.jar
Binary file not shown.
Binary file added katalyze/lib/snakeyaml-1.16.jar
Binary file not shown.
8 changes: 5 additions & 3 deletions katalyze/src/katalyzeapp/ConfigReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.apache.commons.configuration.*;
import org.apache.log4j.Logger;

import com.github.mbredel.commons.configuration.*;

import config.TwitterConfig;
import rules.*;
import clics.ExtendedScoreDump;
Expand All @@ -30,17 +32,17 @@
public class ConfigReader {
static Logger logger = Logger.getLogger(ConfigReader.class);

BaseConfiguration config;
Configuration config;


public ConfigReader(Reader in) throws ConfigurationException {

PropertiesConfiguration loadedConfig = new PropertiesConfiguration();
YAMLConfiguration loadedConfig = new YAMLConfiguration();
loadedConfig.load(in);
this.config = loadedConfig;
}

public ConfigReader(BaseConfiguration config) {
public ConfigReader(Configuration config) {
this.config = config;
}

Expand Down
10 changes: 5 additions & 5 deletions katalyze/src/katalyzeapp/Katalyze.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import java.io.FileInputStream;
import java.io.InputStream;

import org.apache.commons.configuration.BaseConfiguration;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;

import com.github.mbredel.commons.configuration.*;

public class Katalyze {

Expand All @@ -24,7 +24,7 @@ public static void main(String[] args) throws Exception {

String fileName = null;
String configFileName = null;
BaseConfiguration config = null;
Configuration config = null;

for (int i = 0; i < args.length; ++i) {
if ("-input".equals(args[i]) && i<args.length-1){
Expand All @@ -39,11 +39,11 @@ public static void main(String[] args) throws Exception {
}

if (configFileName == null) {
configFileName = new String("katalyzer.properties");
configFileName = new String("katalyzer.yaml");
}

try {
config = new PropertiesConfiguration(configFileName);
config = new YAMLConfiguration(configFileName);
} catch (ConfigurationException e) {
logger.error(String.format("Unable to parse config file %s", configFileName));
}
Expand Down
4 changes: 2 additions & 2 deletions katalyze/src/katalyzeapp/Katalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import java.io.*;

import org.apache.commons.configuration.BaseConfiguration;
import org.apache.commons.configuration.Configuration;
import org.apache.log4j.Logger;

public class Katalyzer {
Expand All @@ -19,7 +19,7 @@ public class Katalyzer {
Contest contest;
ContestMessages handlers;

public Katalyzer(BaseConfiguration config) throws Exception {
public Katalyzer(Configuration config) throws Exception {
this.contest = new Contest();
this.handlers = new ContestMessages(contest);

Expand Down

0 comments on commit 588e93e

Please sign in to comment.