Skip to content

Commit

Permalink
2016.04.29_stellar
Browse files Browse the repository at this point in the history
Lefteris Paraskevas

[ADD]: Console argument passing now implemented using Apache Commons CLI.
[ADD]: All name flags moved to config.properties file.
[CNG]: Changed EvS, Config and Console to support new changes.
--------------------------------------------------
  • Loading branch information
Lefteris authored and Lefteris committed Apr 29, 2016
1 parent 9a3c084 commit 4263804
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 89 deletions.
62 changes: 50 additions & 12 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#Sun Apr 24 19:42:10 EEST 2016
file.reference.commons-cli-1.3.1-javadoc.jar=lib/commons-cli-1.3.1-javadoc.jar
file.reference.commons-cli-1.3.1.jar=lib/commons-cli-1.3.1.jar
#Fri Apr 29 13:47:44 EEST 2016
jnlp.offline-allowed=false
javadoc.splitindex=true
file.reference.twitter4j-examples-4.0.4.jar=lib/twitter4j-examples-4.0.4.jar
Expand All @@ -9,7 +11,9 @@ build.sysclasspath=ignore
file.reference.twitter4j-media-support-4.0.4.jar=lib/twitter4j-media-support-4.0.4.jar
javac.target=1.8
build.generated.dir=${build.dir}/generated
run.classpath=${javac.classpath}\:${build.classes.dir}
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
file.reference.mongodb-driver-3.0.4.jar=lib/mongodb-driver-3.0.4.jar
file.reference.reflections-0.9.9-RC1.jar=lib/reflections-0.9.9-RC1.jar
debug.test.classpath=${run.test.classpath}
Expand All @@ -22,15 +26,15 @@ file.reference.jmod-1.2b.jar=lib/jmod-1.2b.jar
file.reference.jWave_java_groovy.jar=lib/jWave_java_groovy.jar
file.reference.twitter4j-stream-4.0.4.jar=lib/twitter4j-stream-4.0.4.jar
test.src.dir=test
junit.selected.version=3
jar.archive.disabled=${jnlp.enabled}
junit.selected.version=3
includes=**
application.vendor=Lefteris Paraskevas
file.reference.twitter4j-async-4.0.4.jar=lib/twitter4j-async-4.0.4.jar
file.reference.ejml-0.23.jar=lib/ejml-0.23.jar
mkdist.disabled=false
jnlp.mixed.code=default
jar.compress=false
jnlp.mixed.code=default
annotation.processing.processors.list=
javac.external.vm=false
javadoc.version=true
Expand All @@ -44,7 +48,9 @@ run.jvmargs=
manifest.custom.permissions=
javac.test.processorpath=${javac.test.classpath}
dist.archive.excludes=
run.test.classpath=${javac.test.classpath}\:${build.test.classes.dir}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
build.generated.sources.dir=${build.dir}/generated-sources
jnlp.signing=
javadoc.notree=false
Expand All @@ -61,34 +67,66 @@ dist.javadoc.dir=${dist.dir}/javadoc
file.reference.xom.jar=lib/xom.jar
file.reference.commons-math3-3.4.jar=lib/commons-math3-3.4.jar
javadoc.additionalparam=
javac.classpath=${file.reference.HAC.jar}\:${file.reference.twitter4j-async-4.0.4.jar}\:${file.reference.twitter4j-core-4.0.4.jar}\:${file.reference.twitter4j-examples-4.0.4.jar}\:${file.reference.twitter4j-media-support-4.0.4.jar}\:${file.reference.twitter4j-stream-4.0.4.jar}\:${file.reference.bson-3.0.4.jar}\:${file.reference.commons-io-2.4.jar}\:${file.reference.commons-lang3-3.1.jar}\:${file.reference.commons-math3-3.4.jar}\:${file.reference.controlsfx-8.40.10-20150826.135843-344.jar}\:${file.reference.gs-algo-1.2.jar}\:${file.reference.gs-core-1.2.jar}\:${file.reference.gs-ui-1.2.jar}\:${file.reference.guava-18.0.jar}\:${file.reference.javassist.jar}\:${file.reference.jmod-1.2b.jar}\:${file.reference.jtransforms-2.4.jar}\:${file.reference.lucene-analyzers-common-4.10.2.jar}\:${file.reference.lucene-core-4.10.2.jar}\:${file.reference.mongodb-driver-3.0.4.jar}\:${file.reference.mongodb-driver-async-3.0.4.jar}\:${file.reference.mongodb-driver-core-3.0.4.jar}\:${file.reference.reflections-0.9.9-RC1.jar}\:${file.reference.xom.jar}\:${file.reference.ejml-0.23.jar}\:${file.reference.stanford-corenlp-3.5.2.jar}\:${file.reference.stanford-corenlp-3.5.2-models.jar}\:${file.reference.jWave_java_groovy.jar}
javac.classpath=\
${file.reference.HAC.jar}:\
${file.reference.twitter4j-async-4.0.4.jar}:\
${file.reference.twitter4j-core-4.0.4.jar}:\
${file.reference.twitter4j-examples-4.0.4.jar}:\
${file.reference.twitter4j-media-support-4.0.4.jar}:\
${file.reference.twitter4j-stream-4.0.4.jar}:\
${file.reference.bson-3.0.4.jar}:\
${file.reference.commons-io-2.4.jar}:\
${file.reference.commons-lang3-3.1.jar}:\
${file.reference.commons-math3-3.4.jar}:\
${file.reference.controlsfx-8.40.10-20150826.135843-344.jar}:\
${file.reference.gs-algo-1.2.jar}:\
${file.reference.gs-core-1.2.jar}:\
${file.reference.gs-ui-1.2.jar}:\
${file.reference.guava-18.0.jar}:\
${file.reference.javassist.jar}:\
${file.reference.jmod-1.2b.jar}:\
${file.reference.jtransforms-2.4.jar}:\
${file.reference.lucene-analyzers-common-4.10.2.jar}:\
${file.reference.lucene-core-4.10.2.jar}:\
${file.reference.mongodb-driver-3.0.4.jar}:\
${file.reference.mongodb-driver-async-3.0.4.jar}:\
${file.reference.mongodb-driver-core-3.0.4.jar}:\
${file.reference.reflections-0.9.9-RC1.jar}:\
${file.reference.xom.jar}:\
${file.reference.ejml-0.23.jar}:\
${file.reference.stanford-corenlp-3.5.2.jar}:\
${file.reference.stanford-corenlp-3.5.2-models.jar}:\
${file.reference.jWave_java_groovy.jar}:\
${file.reference.commons-cli-1.3.1-javadoc.jar}:\
${file.reference.commons-cli-1.3.1.jar}
javadoc.noindex=false
manifest.custom.codebase=
file.reference.jtransforms-2.4.jar=lib/jtransforms-2.4.jar
annotation.processing.enabled.in.editor=false
file.reference.controlsfx-8.40.10-20150826.135843-344.jar=lib/controlsfx-8.40.10-20150826.135843-344.jar
javadoc.private=false
file.reference.commons-io-2.4.jar=lib/commons-io-2.4.jar
javadoc.encoding=${source.encoding}
build.test.classes.dir=${build.dir}/test/classes
javadoc.encoding=${source.encoding}
jar.index=${jnlp.enabled}
javac.compilerargs=
file.reference.lucene-analyzers-common-4.10.2.jar=lib/lucene-analyzers-common-4.10.2.jar
source.encoding=UTF-8
project.license=gpl30
source.encoding=UTF-8
file.reference.gs-algo-1.2.jar=lib/gs-algo-1.2.jar
jnlp.signing.keystore=
meta.inf.dir=${src.dir}/META-INF
annotation.processing.run.all.processors=true
excludes=
annotation.processing.run.all.processors=true
application.title=MSc
jnlp.codebase.type=no.codebase
file.reference.stanford-corenlp-3.5.2-models.jar=lib/stanford-corenlp-3.5.2-models.jar
javac.processorpath=${javac.classpath}
javac.processorpath=\
${javac.classpath}
build.test.results.dir=${build.dir}/test/results
file.reference.commons-lang3-3.1.jar=lib/commons-lang3-3.1.jar
javadoc.use=true
endorsed.classpath=
javadoc.use=true
javadoc.nonavbar=false
jnlp.signing.alias=
javadoc.windowtitle=
Expand All @@ -99,7 +137,7 @@ javac.test.classpath=\
${libs.hamcrest.classpath}
file.reference.mongodb-driver-core-3.0.4.jar=lib/mongodb-driver-core-3.0.4.jar
src.dir=src
file.reference.HAC.jar=lib/HAC.jar
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
file.reference.HAC.jar=lib/HAC.jar
debug.classpath=${run.classpath}
jnlp.enabled=false
9 changes: 8 additions & 1 deletion src/config-test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,11 @@ retweeted =
retweetedStatus =
retweetId =
positiveEmoticon =
negativeEmoticon =
negativeEmoticon =

#Console fields
showMongoLogging = mongoL
showInlineInfo = inline
edcow = edcow
opf = opf
noSentimet = nosentiment
44 changes: 24 additions & 20 deletions src/evs/EvS.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,31 @@
import experimenter.SentimentPeakFindingExperimenter;
import java.io.IOException;
import java.util.Scanner;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.ParseException;
import utilities.Config;
import utilities.Console;
import utilities.Utilities;

/**
*
* @author Lefteris Paraskevas
* @version 2016.04.24_1922
* @version 2016.04.29_1429
*/
public class EvS {

private static int showMongoLogging = -1;
private static boolean showMongoLogging = true;
private static boolean showInlineInfo = false;
private static boolean hasExtCommands = false;
private static int choice;

/**
* Method to manually set mongoLoggingFlag if the tool is executed as a JAR
* library.
* @param value 0 if the user wishes to show Mongo Logging information,
* 1 otherwise.
* @param value True if the user wishes to show Mongo Logging information,
* false otherwise.
*/
public static void setShowMongoLoggingFlag(int value) {
public static void setShowMongoLoggingFlag(boolean value) {
showMongoLogging = value;
}

Expand All @@ -61,21 +63,7 @@ public static void setShowMongoLoggingFlag(int value) {
* if she wishes to execute the tool as a .jar executable.
* @param args A list of arguments.
*/
public static void main(String[] args) {

if(args.length != 0) { //If the user supplied arguments
Console console = new Console(args); //Read the console
showMongoLogging = console.showMongoLogging; //Set the mongo logging flag.
showInlineInfo = console.showInlineInfo; //Set the inline info flag.
hasExtCommands = console.hasExternalCommands;
choice = console.choice;
}

if(showMongoLogging == 1) {
//Stop reporting logging information
Logger mongoLogger = Logger.getLogger("org.mongodb.driver");
mongoLogger.setLevel(Level.SEVERE);
}
public static void main(String[] args) throws ParseException {

Config config = null;
try {
Expand All @@ -86,6 +74,22 @@ public static void main(String[] args) {
Logger.getLogger(EvS.class.getName()).log(Level.SEVERE, null, ex);
System.exit(1);
}

if(args.length != 0) { //If the user supplied arguments
Console console = new Console(args, config); //Read the console

showMongoLogging = console.showMongoLogging();
showInlineInfo = console.showInlineInfo();
hasExtCommands = console.hasExternalCommands();
choice = console.getChoiceValue();
}

if(!showMongoLogging) {
//Stop reporting logging information
Logger mongoLogger = Logger.getLogger("org.mongodb.driver");
mongoLogger.setLevel(Level.SEVERE);
}

System.out.println("\n----EvS----");

if(!hasExtCommands) {
Expand Down
45 changes: 44 additions & 1 deletion src/utilities/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
*
* @author Lefteris Paraskevas
* @version 2016.04.24_1941
* @version 2016.04.29_1430
*/
public class Config {
private static String consumerKey;
Expand Down Expand Up @@ -83,6 +83,13 @@ public class Config {
private static String retweetId;
private static String positiveEmoticon;
private static String negativeEmoticon;

//Console arguments
private static String showMongoLogging;
private static String showInlineInfo;
private static String edcow;
private static String opf;
private static String noSentiment;

public Config() throws IOException {

Expand Down Expand Up @@ -153,6 +160,12 @@ public Config() throws IOException {
positiveEmoticon = prop.getProperty("positiveEmoticon");
negativeEmoticon = prop.getProperty("negativeEmoticon");

showMongoLogging = prop.getProperty("showMongoLogging");
showInlineInfo = prop.getProperty("showInlineInfo");
edcow = prop.getProperty("edcow");
opf = prop.getProperty("opf");
noSentiment = prop.getProperty("noSentiment");

} catch (IOException | NumberFormatException e) {
if(inputStream != null) {
inputStream.close();
Expand Down Expand Up @@ -444,4 +457,34 @@ public static String getPeakFindingOutputPath() {
* @return a String containing the negative emoticon field name.
*/
public static String getNegativeEmoticonFieldName() { return negativeEmoticon; }

/**
* Returns the argument name of MongoLogging flag.
* @return the argument name of MongoLogging flag.
*/
public static String getMongoLoggingArgName() { return showMongoLogging; }

/**
* Returns the argument name of InlineInfo flag.
* @return the argument name of InlineInfo flag.
*/
public static String getInlineInfoArgName() { return showInlineInfo; }

/**
* Returns the argument name of EDCoW flag.
* @return the argument name of EDCoW flag.
*/
public static String getEdcowArgName() { return edcow; }

/**
* Returns the argument name of Offline Peak Finding flag.
* @return the argument name of Offline Peak Finding flag.
*/
public static String getOpfArgName() { return opf; }

/**
* Returns the argument name of NoSentiment flag.
* @return the argument name of NoSentiment flag.
*/
public static String getNoSentimentArgName() { return noSentiment; }
}
Loading

0 comments on commit 4263804

Please sign in to comment.