From 48c89f49439a19bbbbcdb9275266fd539a7eb843 Mon Sep 17 00:00:00 2001 From: Fruchuxs Date: Mon, 2 Feb 2015 00:02:41 +0100 Subject: [PATCH] Readme adjusted --- .gitignore | 6 +- README.md | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 173 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ec83c4c..1217579 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /monitor/derby.log -/monitor.properties -/monitor/logs/ -/monitor/Database/ +/monitor/monitor.properties +/monitor/logs/* +/monitor/Database/* /monitor/target/ /client/target/ /*~ \ No newline at end of file diff --git a/README.md b/README.md index 4621291..e0565b9 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,18 @@ See the [Project Site](http://fruchuxs.github.io/RichWPS-Monitor/) for Releases * [GSON](https://code.google.com/p/google-gson/) * [Apache HTTP Components](http://hc.apache.org/) (used for a simple WpsClient) * [Apache Derby](http://db.apache.org/derby/) +* [Apache Commons](http://commons.apache.org/) +* [Apache Log4j 2](http://logging.apache.org/log4j/2.x/) + +## V2.1 Changelog +* All logging outputs now redirected to log4j to prevent massive spam +* Only Level.ERROR and above events are printed to the console +* CLI added +* Start parameters added +* `ApplicationInfo` class added with some constants like VERSION, PROJECT_SITE, etc. +* `getProcess(endpoint : URL, identifier : String) : WpsProcessEntity` method added to the `MonitorControl` facade +* The RESTful Interface now implements the `java.lang.AutoCloseable` interface +* `Monitor#shutdown()` now also shutdowns the underlying Jetty Webserver ## V2 Changelog @@ -28,6 +40,164 @@ Changelog: * GUI tests removed (in fact the gui should be replaced in the future and the tests are not working on every machine ..) * RESTful Interface display option removed. Metrics are now always shown +## Monitor Start Parameters +``` +--ui-type +``` + +* `gui` The monitor starts with the GUI as user interface +* `cli` The monitor starts with the CLI as user interface +* `none` The monitor starts without any UI type + +## Monitor CLI +Overview: +``` +create --wps=[ --process=[ --trigger={start:, end:, interval:, type:}]] +add --wps= --process= [ --trigger={start:, end:, interval:, type:} | --request-file=] +delete --wps=[ --process=[ --only-measured-data [--date=] | --trigger-id=<>]] +show [--wps= --process= --triggers] +status --wps= --process= +pause --wps= --process= +resume --wps= --process= +``` + +General help usage: +``` +add Adds a Process to a already registred WPS, or a Trigger to a already registred WPS Process. + + Options: + --process= : Specifies which WPS process should be selected by identifier. + --trigger= : The TriggerConfig Object as JSON string. e.g. + '{"intervalType":"SECOND|MINUTE|HOUR|DAY|WEEK|MONTH", "start":"Jan 31, 2015 7:20:04 PM", + "end":"Feb 19, 2015 7:20:04 PM", "interval":2}' + --wps= : Specifies which WPS should be selected by endpoint. + --rf, --request-file= : Enter a valid path to a file with a xml test request to import. + +exit Exits the Application + + Options: + --process= : Specifies which WPS process should be selected by identifier. + --wps= : Specifies which WPS should be selected by endpoint. + +create Registers a new WPS, Process or Trigger to a Process in the monitor. If the WPS of thr entered + Processname does not exists, the WPS will be registred also. + + Options: + --process= : Specifies which WPS process should be selected by identifier. + --trigger= : The TriggerConfig Object as JSON string. e.g. + '{"intervalType":"SECOND|MINUTE|HOUR|DAY|WEEK|MONTH", "start":"Jan 31, 2015 7:20:04 PM", + "end":"Feb 19, 2015 7:20:04 PM", "interval":2}' + --wps= : Specifies which WPS should be selected by endpoint. + +show shows all WPS and Processes. Can be specified by parameters. --wps to show a list of WPS and + processes, --wps to show processes of a WPS. --triggers in combination with --process + shows the triggers of the process.If the --triggers parameter missing, the testreques + will be displayed. + + Options: + --process= : Specifies which WPS process should be selected by identifier. + --wps= : Specifies which WPS should be selected by endpoint. + --md, --measured-data : Shows the last 15 measured data of the wps process. This functionallity is only for testing + purposes. + --triggers : Prints all Triggers of the specified WPS Process. + +status Displays the current status of a monitored WPS process. + + Options: + --process= : Specifies which WPS process should be selected by identifier. + --wps= : Specifies which WPS should be selected by endpoint. + +delete Deletes a WPS, Process of a WPS, Trigger of a WPS process or the measured Data of a WPS process. If + the data option is specified with the onley-measured-data option, all measured data will be deleted + which are older than . + + Options: + --process= : Specifies which WPS process should be selected by identifier. + --d, --date= : Specified the date at which the measured data should be deleted. e.g. 12.03.2012 + --wps= : Specifies which WPS should be selected by endpoint. + --omd, --only-measured-data : Delete only the measured Data of the specified WPS process + --tid, --trigger-id= : Deletes the trigger with the given ID. type show --triggers to find out the + right trigger id. + +resume Resumes the monitoring of a process. + + Options: + --process= : Specifies which WPS process should be selected by identifier. + --wps= : Specifies which WPS should be selected by endpoint. + +pause Pauses the monitoring of a process. + + Options: + --process= : Specifies which WPS process should be selected by identifier. + --wps= : Specifies which WPS should be selected by endpoint. + +test Requests a WPS with the testrequest of a file or an already saved testrequest of the specified + wps/process. + + Options: + --process= : Specifies which WPS process should be selected by identifier. + --wps= : Specifies which WPS should be selected by endpoint. + --rf, --request-file= : Enter a valid path to a file with a xml test request to import. + +help Prints all Commands with their descriptions and options. +``` + +### Create own Commands +For own `MonitorCommand` implementations you need to create an own class which extends the abstract class `MonitorCommand` and implements the `execute`() method. For own options like `--file=` it's necessary to create a non final field like `private String fileName` with the `@CommandOption` annotation. + +Annotation Overview: +```java +public @interface CommandOption { + String shortOptionName(); + String description(); + String longOptionName() default ""; + boolean hasArgument() default false; + boolean optionalArgument() default false; + String argumentName() default ""; + boolean required() default false; +} +``` + +The example below creates an option `--f` (`--file` also possible) with the given description. This option is not required and has an argument with the argumentName "filename". If the command is choosen, the CLI would inject the entered string besides the `--file` option into the `file` field of the `MonitorCommand` class specialisation. +```java + @CommandOption( + shortOptionName = "f", + longOptionName = "file", + description = "Enter a valid path to a file.", + hasArgument = true, + argumentName = "filename" + ) + private String file; +``` + +Complete Example: +```java +public class ExampleCommand extends MonitorCommand { + @CommandOption( + shortOptionName = "f", + longOptionName = "file", + description = "Enter a valid path to a file.", + hasArgument = true, + argumentName = "filename" + ) + private String file; + + public PauseCommand(final Monitor monitor) { + super("example", "Only an example command.", monitor); + } + + @Override + public void execute() throws CommandException { + if (file != null) { + super.consoleProxy.printLine(file); + } else { + super.consoleProxy.printLine("File option was empty"); + } + } + +} +``` + ## Monitor RESTful Routes By default the Monitor RESTful Interface is reachable on port 1111.