|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.mud.jta.Plugin
de.mud.jta.plugin.Script
public class Script
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
Field Summary | |
---|---|
protected FilterPlugin |
source
holds the data source for input and output |
Fields inherited from class de.mud.jta.Plugin |
---|
bus, id |
Constructor Summary | |
---|---|
Script(PluginBus bus,
java.lang.String id)
Create a new scripting plugin. |
Method Summary | |
---|---|
FilterPlugin |
getFilterSource()
|
int |
read(byte[] b)
Read an array of bytes from the back end and put it through the script parser to see if it matches. |
void |
setFilterSource(FilterPlugin plugin)
Set the filter source where we can read data from and where to write the script answer to. |
void |
write(byte[] b)
Write a block of data to the back end. |
Methods inherited from class de.mud.jta.Plugin |
---|
error, getId |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected FilterPlugin source
Constructor Detail |
---|
public Script(PluginBus bus, java.lang.String id)
Method Detail |
---|
public void setFilterSource(FilterPlugin plugin)
setFilterSource
in interface FilterPlugin
plugin
- the filter plugin we use as sourcepublic FilterPlugin getFilterSource()
getFilterSource
in interface FilterPlugin
public int read(byte[] b) throws java.io.IOException
read
in interface FilterPlugin
b
- the array where to read the bytes in
java.io.IOException
public void write(byte[] b) throws java.io.IOException
FilterPlugin
write
in interface FilterPlugin
b
- the buffer to be sent
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |