Skip to content

Commit

Permalink
1.1.7 Adding and clean some logs messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
vertigo17 committed Jan 20, 2018
1 parent 7967113 commit 14cb7dc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org</groupId>
<artifactId>cerberus-extension-sikuli</artifactId>
<version>1.1.6</version>
<version>1.1.7</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
25 changes: 13 additions & 12 deletions src/main/java/org/sikuliserver/QueueReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public static void main(String[] args) throws IOException {
Option debug = new Option("d", "debug", false, "Start the server in debug mode");
debug.setRequired(false);
options.addOption(debug);

Option highlight = new Option("e", "highlightElement", true, "Highlight focussed element during this [INTEGER] <number of seconds>");
highlight.setRequired(false);
options.addOption(highlight);

Option help = new Option("h", "help", false, "Display the help message");
help.setRequired(false);
options.addOption(help);
Expand All @@ -73,38 +73,38 @@ public static void main(String[] args) throws IOException {
* Change port if specified
*/
String portParam = "5555";
if (cmd.hasOption("port")){
portParam = cmd.getOptionValue("port");
}
if (cmd.hasOption("port")) {
portParam = cmd.getOptionValue("port");
}

/**
* Set DebugMode if specified
*/
if (cmd.hasOption("debug")){
if (cmd.hasOption("debug")) {
LOG.info("Activating Debug Mode.");
setLogLevelToDebug();
}
/**
* Set Highlight Element if specified
*/
if (cmd.hasOption("highlightElement")){
if (cmd.hasOption("highlightElement")) {
System.setProperty("highlightElement", cmd.getOptionValue("highlightElement"));
LOG.info("Set HighlightElement parameter to " +cmd.getOptionValue("highlightElement") + " seconds");
LOG.info("Set HighlightElement parameter to " + cmd.getOptionValue("highlightElement") + " seconds");
}

/**
* Display help if -h present
*/
if (cmd.hasOption("help")){
if (cmd.hasOption("help")) {
formatter.printHelp("utility-name", options);
System.exit(1);
return;
}


/*
* Start the server
*/
LOG.info("Launching a HttpServer on port : " + port);
LOG.info("Cerberus Extension Sikuli 1.1.7 - Http Server Launching on port : " + portParam);
Server server = new Server();

ServerConnector connector = new ServerConnector(server);
Expand All @@ -115,6 +115,7 @@ public static void main(String[] args) throws IOException {

server.setHandler(servletHandler);
servletHandler.addServletWithMapping(ExecuteSikuliAction.class, "/extra/ExecuteSikuliAction");
LOG.info("Servlet listening on : /extra/ExecuteSikuliAction");

server.start();
server.join();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/sikuliserver/SikuliAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ JSONObject doAction(String action, String picture, String text) throws FindFaile
try {
switch (action) {
case "openApp":
LOG.info("Opening Application : " + text);
App app = new App(text);
app.open();
status = "OK";
break;
case "closeApp":
LOG.info("Closing Application : " + text);
App openApp = new App(text);
openApp.close();
status = "OK";
Expand Down

0 comments on commit 14cb7dc

Please sign in to comment.