Skip to content

Commit

Permalink
Readme adjusted
Browse files Browse the repository at this point in the history
  • Loading branch information
Fruchuxs committed Feb 1, 2015
1 parent d9cc201 commit 48c89f4
Show file tree
Hide file tree
Showing 2 changed files with 173 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/monitor/derby.log
/monitor.properties
/monitor/logs/
/monitor/Database/
/monitor/monitor.properties
/monitor/logs/*
/monitor/Database/*
/monitor/target/
/client/target/
/*~
170 changes: 170 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <cli|gui|none>
```

* `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=<endpoint>[ --process=<identifier>[ --trigger={start:<start>, end:<end>, interval:<interval>, type:<type>}]]
add --wps=<endpoint> --process=<identifier> [ --trigger={start:<start>, end:<end>, interval:<interval>, type:<type>} | --request-file=<filepath>]
delete --wps=<endpoint>[ --process=<identifier>[ --only-measured-data [--date=<date>] | --trigger-id=<>]]
show [--wps=<endpoint> --process=<identifier> --triggers]
status --wps=<endpoint> --process=<identifier>
pause --wps=<endpoint> --process=<identifier>
resume --wps=<endpoint> --process=<identifier>
```

General help usage:
```
add Adds a Process to a already registred WPS, or a Trigger to a already registred WPS Process.
Options:
--process=<identifier> : Specifies which WPS process should be selected by identifier.
--trigger=<triggerjson> : 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=<endpoint> : Specifies which WPS should be selected by endpoint.
--rf, --request-file=<requestfile> : Enter a valid path to a file with a xml test request to import.
exit Exits the Application
Options:
--process=<identifier> : Specifies which WPS process should be selected by identifier.
--wps=<endpoint> : 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=<identifier> : Specifies which WPS process should be selected by identifier.
--trigger=<triggerjson> : 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=<endpoint> : 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 <endpoint> to show processes of a WPS. --triggers in combination with --process
<identifier> shows the triggers of the process.If the --triggers parameter missing, the testreques
will be displayed.
Options:
--process=<identifier> : Specifies which WPS process should be selected by identifier.
--wps=<endpoint> : 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=<identifier> : Specifies which WPS process should be selected by identifier.
--wps=<endpoint> : 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 <date>.
Options:
--process=<identifier> : Specifies which WPS process should be selected by identifier.
--d, --date=<date> : Specified the date at which the measured data should be deleted. e.g. 12.03.2012
--wps=<endpoint> : 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=<triggerid> : Deletes the trigger with the given ID. type show <wps> <process> --triggers to find out the
right trigger id.
resume Resumes the monitoring of a process.
Options:
--process=<identifier> : Specifies which WPS process should be selected by identifier.
--wps=<endpoint> : Specifies which WPS should be selected by endpoint.
pause Pauses the monitoring of a process.
Options:
--process=<identifier> : Specifies which WPS process should be selected by identifier.
--wps=<endpoint> : 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=<identifier> : Specifies which WPS process should be selected by identifier.
--wps=<endpoint> : Specifies which WPS should be selected by endpoint.
--rf, --request-file=<requestfile> : 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=<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.

Expand Down

0 comments on commit 48c89f4

Please sign in to comment.