de.mud.jta.plugin
Class Script
- FilterPlugin
The script plugin takes a series of match and answer pairs to compare
the incoming data with the matches and if it succeeds writes the answers
back. It then moves on to the next match until all script elements have
matched.
The script property Script.script should contain
| separated strings
where each two represent a match and answer pair. A newline will be appended
to each answer!
If the first matching string is empty, the answer string will be sent upon
connect.
The script is very basic but is a very good example how to
write a plugin for
JTA - Telnet/SSH for the JAVA(tm) platform.
Maintainer: Matthias L. Jugel
$Id: Script.java 499 2005-09-29 08:24:54Z leo $- Matthias L. Jugel, Marcus Mei???ner
source
protected FilterPlugin source
holds the data source for input and output
Script
public Script(PluginBus bus,
String id)
Create a new scripting plugin.
read
public int read(byte[] b)
throws IOException
Read an array of bytes from the back end and put it through the
script parser to see if it matches. It will send the answer
immediately to the filter source if a match occurs.
- read in interface FilterPlugin
b
- the array where to read the bytes in
- the amount of bytes actually read
setFilterSource
public void setFilterSource(FilterPlugin plugin)
Set the filter source where we can read data from and where to
write the script answer to.
- setFilterSource in interface FilterPlugin
plugin
- the filter plugin we use as source