|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object examples.PipeWrapperAgent
This agent is an example for an agent wrapping a resource of the
underlying operating system. Its purpose is to open a named pipe
and simply print anything read from it to System.out
.
The name of the pipe is inpipe
and has to be
located in in ${HOME}/tmp
. What the users home
directory is, depends on the opereating system the virtual machine
is run on. If you're in doubt set the Java property
user.home
accordingly.
For testing just write to the pipe from a different process, for instance:
cat foo.txt > inpipe echo Hello World > inpipe cat > inpipeHow to create a named pipe depends on your operating system. On all UNIX/Linux derivats there is a command
mkfifo
which
will do just that. Creating named pipes in Windows makes the things
more difficult. There are API calls even for some scripting
languages, which is in fact not that intuitive ;o) but, I do not
know any other way. Perphaps just switch to UNIX?
Please check out that the agent has the proper rights to open the
named pipe from the filesystem. Please check out the file
semoa/etc/semoa.policy To grant this right to the agent there
should be an entry as follows:
PERM java.io.FilePermission ${HOME}/tmp/- "read"If you test it with the standard SeMoA distribution, the according entry already exists.
System.getProperties()
,
Serialized FormField Summary | |
private static String |
PIPE
The pipe's name which is expected at the user's home directory. |
Constructor Summary | |
PipeWrapperAgent()
The agent's constructor. |
Method Summary | |
void |
run()
Performs the agent's job. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static String PIPE
Constructor Detail |
public PipeWrapperAgent()
Method Detail |
public void run()
run
in interface Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |