Author: rezan
Date: Wed Jul 29 13:03:18 2015
New Revision: 1693255
URL: http://svn.apache.org/r1693255
Log:
quiet mode
Modified:
devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java
devicemap/trunk/clients/2.0/reference/src/Main.java
Modified: devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java
URL:
http://svn.apache.org/viewvc/devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java?rev=1693255&r1=1693254&r2=1693255&view=diff
==============================================================================
--- devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java (original)
+++ devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java Wed Jul 29
13:03:18 2015
@@ -67,7 +67,7 @@ public class DeviceMapClient {
throw new Exception("DomainVersions do not match: " + domainVersion + "
!= " + patterns.getDomainVersion());
}
- System.out.println(" Loading pattern domain: " + patterns.getDomain() +
", version: " +
+ Main.log(" Loading pattern domain: " + patterns.getDomain() + ", version:
" +
patterns.getDomainVersion() + (patch ? ", patch" : ""));
if(patterns.getJsonNode().get("inputParser").isObject()) {
@@ -77,7 +77,7 @@ public class DeviceMapClient {
for(Iterator<JsonNode> i = inputParser.get("transformers").iterator();
i.hasNext();) {
JsonNode transformer = i.next();
transformers.add(transformer.get("type").asText());
- System.out.println(" Found transformer: " +
transformer.get("type"));
+ Main.log(" Found transformer: " + transformer.get("type"));
}
}
@@ -85,13 +85,13 @@ public class DeviceMapClient {
for(Iterator<JsonNode> i =
inputParser.get("tokenSeperators").iterator(); i.hasNext();) {
JsonNode tokenSeperator = i.next();
tokenSeperators.add(tokenSeperator.asText());
- System.out.println(" Found tokenSeperator: '" +
tokenSeperator.asText() + "'");
+ Main.log(" Found tokenSeperator: '" + tokenSeperator.asText() +
"'");
}
}
if(inputParser.get("ngramConcatSize").asInt(0) > 0) {
ngramConcatSize = inputParser.get("ngramConcatSize").asInt(0);
- System.out.println(" Found ngramConcatSize: " + ngramConcatSize);
+ Main.log(" Found ngramConcatSize: " + ngramConcatSize);
}
}
@@ -100,7 +100,7 @@ public class DeviceMapClient {
if(patternSet.get("defaultId").isTextual()) {
defaultId = patternSet.get("defaultId").asText();
- System.out.println(" Found defaultId: " + defaultId);
+ Main.log(" Found defaultId: " + defaultId);
}
int patternCount = 0;
@@ -109,7 +109,7 @@ public class DeviceMapClient {
JsonNode tokenSeperator = i.next();
patternCount++;
}
- System.out.println(" Found " + patternCount + " pattern(s)");
+ Main.log(" Found " + patternCount + " pattern(s)");
}
}
}
Modified: devicemap/trunk/clients/2.0/reference/src/Main.java
URL:
http://svn.apache.org/viewvc/devicemap/trunk/clients/2.0/reference/src/Main.java?rev=1693255&r1=1693254&r2=1693255&view=diff
==============================================================================
--- devicemap/trunk/clients/2.0/reference/src/Main.java (original)
+++ devicemap/trunk/clients/2.0/reference/src/Main.java Wed Jul 29 13:03:18 2015
@@ -21,6 +21,8 @@ import java.util.ArrayList;
import java.util.List;
public class Main {
+
+ private static boolean verbose = true;
public static void main(String args[]) throws Exception {
System.out.println("DeviceMap Reference Client " +
DeviceMapClient.VERSION);
@@ -47,6 +49,8 @@ public class Main {
tests.add(getParam(args, ++i, "-t file parameter missing"));
} else if(!option.startsWith("-") && testString == null) {
testString = option;
+ } else if(option.equals("-q")) {
+ verbose = false;
} else {
printHelp();
throw new Exception("unknown option: " + option);
@@ -59,22 +63,22 @@ public class Main {
}
for(String pattern : patterns) {
- System.out.println("Pattern file: '" + pattern + "'");
+ Main.log("Pattern file: '" + pattern + "'");
client.loadPatterns(new JsonFile(pattern));
}
for(String attribute : attributes) {
- System.out.println("Attribute file: '" + attribute + "'");
+ Main.log("Attribute file: '" + attribute + "'");
client.loadAttributes(new JsonFile(attribute));
}
for(String test : tests) {
- System.out.println("Test file: '" + test + "'");
+ Main.log("Test file: '" + test + "'");
JsonFile testSuite = new JsonFile(test);
}
if(testString != null) {
- System.out.println("Test string: '" + testString + "'");
+ Main.log("Test string: '" + testString + "'");
}
}
@@ -84,6 +88,7 @@ public class Main {
System.out.println(" -a <file> load DeviceMap 2.0 attribute
file");
System.out.println(" -t <file> load DeviceMap 2.0 test file");
System.out.println(" -h print help");
+ System.out.println(" -q quiet");
System.out.println(" STRING test string");
System.out.println("");
}
@@ -97,4 +102,10 @@ public class Main {
return args[pos];
}
}
+
+ public static void log(String s) {
+ if(verbose) {
+ System.out.println(s);
+ }
+ }
}