Interface JMadKernel
-
- All Known Implementing Classes:
JMadKernelImpl
public interface JMadKernel
this is the interface for central class which controls an instance of MadX. The kernel only is able to do the most primitives tasks: start the MadX-process, stop it and send commands to it. Furthermore it takes care of the logging of input and output of the MadX process. Listeners can also be attached, which then get notified, when the status of the kernel changes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addListener(JMadKernelListener listener)
Result
execute(JMadExecutable executable)
executes a Command or Task, waits for completion (our timeout if set), and returns result, if command/task provides one.java.io.File
getOutputFile()
boolean
isMadxRunning()
void
removeListener(JMadKernelListener listener)
void
start()
starts madx as a separate thread and configures the needed streams.int
stop()
stops the madx-thread
-
-
-
Method Detail
-
start
void start() throws JMadException
starts madx as a separate thread and configures the needed streams.- Throws:
JMadException
- if the starting of the MadX process fails
-
stop
int stop() throws JMadException
stops the madx-thread- Returns:
- the exit-value of madx
- Throws:
JMadException
- if the stopping of the MadX process fails
-
execute
Result execute(JMadExecutable executable) throws JMadException
executes a Command or Task, waits for completion (our timeout if set), and returns result, if command/task provides one.- Parameters:
executable
- the command or task to execute- Returns:
- the result, if available, otherwise null
- Throws:
JMadException
- if the execution fails
-
isMadxRunning
boolean isMadxRunning()
- Returns:
- true, if madx was started before, false otherwise
-
addListener
void addListener(JMadKernelListener listener)
- Parameters:
listener
- the listener to add
-
removeListener
void removeListener(JMadKernelListener listener)
- Parameters:
listener
- the listener to remove
-
getOutputFile
java.io.File getOutputFile()
- Returns:
- the JMadKernel OutputFile
-
-