@groovy.transform.CompileStatic class Jexler extends java.lang.Object
Jexler, runs a Groovy script that handles events.
| Modifiers | Name | Description |
|---|---|---|
class |
Jexler.Events |
Blocking queue for events sent to a Jexler ('events' variable in jexler scripts). |
| Modifiers | Name | Description |
|---|---|---|
protected Jexler.Events |
events |
Event queue. |
| Constructor and description |
|---|
Jexler
(java.io.File file, JexlerContainer container)Constructor. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
forgetIssues() |
|
groovy.util.ConfigObject |
getAsConfig()Convenience method for getting ConfigSlurper config from parsing this jexler; uses the class already compiled by Grengine. |
|
JexlerContainer |
getContainer()Get container that contains this jexler. |
|
java.io.File |
getDir()Get directory that contains script file. |
|
java.io.File |
getFile()Get jexler script file. |
|
java.lang.String |
getId() |
|
java.util.List<Issue> |
getIssues() |
|
groovy.util.ConfigObject |
getMetaConfig()Get meta config. |
|
groovy.lang.Script |
getScript()Get jexler script instance, null if script is not running. |
|
ServiceState |
getState() |
|
void |
handle(Event event)Handle given event. |
|
boolean |
isRunnable()Return true if jexler is indicated as a jexler in the first line of its script text (meta config); more precisely returns the state at startup if already running, else reads from file. |
|
void |
start()Initiate jexler start. |
|
void |
stop()Initiate jexler stop by sending it a stop event to handle. |
|
void |
trackIssue(Issue issue) |
|
void |
trackIssue(Service service, java.lang.String message, java.lang.Throwable cause) |
|
void |
zap() |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Event queue.
Constructor.
file - file with jexler scriptcontainer - jexler container that contains this jexlerConvenience method for getting ConfigSlurper config from parsing this jexler; uses the class already compiled by Grengine.
Get container that contains this jexler.
Get directory that contains script file.
Get jexler script file.
Get meta config. Read from the jexler file at each call except if the jexler is already running, in that case returns meta config read at the time the jexler was started. The meta config of a jexler is stored in the first line of a jexler script file. Example:
// Jexler { autostart = true; some = 'thing' }
Returns null if there is no meta config in the jexler or the
file could not be read; returns an empty config object if
config is present but could not be parsed.
Get jexler script instance, null if script is not running.
Handle given event.
Return true if jexler is indicated as a jexler in the first line of its script text (meta config); more precisely returns the state at startup if already running, else reads from file.
Initiate jexler start. Immediately marks the jexler service as starting up, then tries to start the script. Typically returns before the jexler script has started or completed to initialize all of its services. The jexler remains in the running state until the script exits in any way, after it has been tried to stop all registered services.
Initiate jexler stop by sending it a stop event to handle.