Package adams.flow.standalone
Class PyroNameServer
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,Actor
,ErrorHandler
,com.github.fracpete.processoutput4j.core.StreamingProcessOwner
,Serializable
,Comparable
public class PyroNameServer extends AbstractStandalone implements com.github.fracpete.processoutput4j.core.StreamingProcessOwner
Defines the Pyro nameserver to use.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-name <java.lang.String> (property: name) The name of the actor. default: PyroNameServer
-annotation <adams.core.base.BaseAnnotation> (property: annotations) The annotations to attach to this actor. default:
-skip <boolean> (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is. default: false
-stop-flow-on-error <boolean> (property: stopFlowOnError) If set to true, the flow execution at this level gets stopped in case this actor encounters an error; the error gets propagated; useful for critical actors. default: false
-silent <boolean> (property: silent) If enabled, then no errors are output in the console; Note: the enclosing actor handler must have this enabled as well. default: false
-server <adams.core.base.BaseHostname> (property: server) The hostname and port of the nameserver to connect to (and/or launch). default: localhost:9090
-mode <CONNECT|LAUNCH_AND_CONNECT> (property: mode) How to operate, eg simply using or also launching. default: CONNECT
-launch-mode-options <java.lang.String> (property: launchModeOptions) The additional options to use for the nameserver (aside hostname and port ). default:
-launch-wait <int> (property: launchWait) The number of milliseconds to wait for the nameserver to become operational (and check for potential errors); disabled if 0. default: 1000 minimum: 0
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PyroNameServer.Mode
The server mode.
-
Field Summary
Fields Modifier and Type Field Description static String
EXECUTABLE
the nameserver executable.protected PythonEnvironment
m_Environment
the environment in use.protected IllegalStateException
m_ExecutionFailure
in case an exception occurred executing the command (gets rethrown).protected String
m_LaunchModeOptions
the options for the launch mode.protected int
m_LaunchWait
the number of milliseconds to wait for nameserver to launch (and check for errors).protected PyroNameServer.Mode
m_Mode
whether to launch a nameserver instance or just connect to an existing one.protected RunnableWithLogging
m_Monitor
the runnable executing the command.protected net.razorvine.pyro.NameServerProxy
m_NameServer
the nameserver in use.protected String
m_NameServerExecutable
the nameserver executable.protected com.github.fracpete.processoutput4j.output.StreamingProcessOutput
m_ProcessOutput
the process monitor.protected BaseHostname
m_Server
the address/port of the nameserver to use.-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description PyroNameServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
connect()
Connects to the nameserver.void
defineOptions()
Adds options to the internal list of options.protected void
disconnect()
Disconnects from the nameserver.protected String
doExecute()
Executes the flow item.String
getLaunchModeOptions()
Returns the additional options when launching the nameserver (aside hostname and port).int
getLaunchWait()
Returns the time to wait for the nameserver to become operational (and check for errors).PyroNameServer.Mode
getMode()
Returns the mode for operating.net.razorvine.pyro.NameServerProxy
getNameServer()
Returns the nameserver instance.String
getNameServerExecutable()
Returns the nameserver executable.com.github.fracpete.processoutput4j.core.StreamingProcessOutputType
getOutputType()
Returns what output from the process to forward.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.BaseHostname
getServer()
Returns the server to connect to.String
globalInfo()
Returns a string describing the object.protected void
launch()
Launches the nameserver.String
launchModeOptionsTipText()
Returns the tip text for this property.String
launchWaitTipText()
Returns the tip text for this property.String
modeTipText()
Returns the tip text for this property.void
processOutput(String line, boolean stdout)
Processes the incoming line.protected void
reset()
Resets the scheme.String
serverTipText()
Returns the tip text for this property.void
setLaunchModeOptions(String value)
Sets the additional options when launching the nameserver (aside hostname and port).void
setLaunchWait(int value)
Sets the time to wait for the nameserver to become operational (and check for errors).void
setMode(PyroNameServer.Mode value)
Sets the mode for operating.void
setServer(BaseHostname value)
Sets the server to connect to.String
setUp()
Initializes the item for flow execution.void
stopExecution()
Stops the execution.void
wrapUp()
Cleans up after the execution has finished.-
Methods inherited from class adams.flow.standalone.AbstractStandalone
preExecute
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, backupState, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, pruneBackup, pruneBackup, restoreState, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
toCommandLine
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
-
-
-
-
Field Detail
-
EXECUTABLE
public static final String EXECUTABLE
the nameserver executable.- See Also:
- Constant Field Values
-
m_Server
protected BaseHostname m_Server
the address/port of the nameserver to use.
-
m_Mode
protected PyroNameServer.Mode m_Mode
whether to launch a nameserver instance or just connect to an existing one.
-
m_LaunchModeOptions
protected String m_LaunchModeOptions
the options for the launch mode.
-
m_LaunchWait
protected int m_LaunchWait
the number of milliseconds to wait for nameserver to launch (and check for errors).
-
m_NameServer
protected transient net.razorvine.pyro.NameServerProxy m_NameServer
the nameserver in use.
-
m_NameServerExecutable
protected transient String m_NameServerExecutable
the nameserver executable.
-
m_Environment
protected transient PythonEnvironment m_Environment
the environment in use.
-
m_ProcessOutput
protected transient com.github.fracpete.processoutput4j.output.StreamingProcessOutput m_ProcessOutput
the process monitor.
-
m_Monitor
protected RunnableWithLogging m_Monitor
the runnable executing the command.
-
m_ExecutionFailure
protected IllegalStateException m_ExecutionFailure
in case an exception occurred executing the command (gets rethrown).
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractActor
-
setServer
public void setServer(BaseHostname value)
Sets the server to connect to.- Parameters:
value
- the server
-
getServer
public BaseHostname getServer()
Returns the server to connect to.- Returns:
- the server
-
serverTipText
public String serverTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMode
public void setMode(PyroNameServer.Mode value)
Sets the mode for operating.- Parameters:
value
- the mode
-
getMode
public PyroNameServer.Mode getMode()
Returns the mode for operating.- Returns:
- the mode
-
modeTipText
public String modeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLaunchModeOptions
public void setLaunchModeOptions(String value)
Sets the additional options when launching the nameserver (aside hostname and port).- Parameters:
value
- the additional options
-
getLaunchModeOptions
public String getLaunchModeOptions()
Returns the additional options when launching the nameserver (aside hostname and port).- Returns:
- the additional options
-
launchModeOptionsTipText
public String launchModeOptionsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLaunchWait
public void setLaunchWait(int value)
Sets the time to wait for the nameserver to become operational (and check for errors).- Parameters:
value
- the wait time (milliseconds), disabled if 0
-
getLaunchWait
public int getLaunchWait()
Returns the time to wait for the nameserver to become operational (and check for errors).- Returns:
- the wait time (milliseconds), disabled if 0
-
launchWaitTipText
public String launchWaitTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceActor
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractActor
- Returns:
- null if no info available, otherwise short string
-
getNameServer
public net.razorvine.pyro.NameServerProxy getNameServer()
Returns the nameserver instance.- Returns:
- the server instance, null if not available
-
getNameServerExecutable
public String getNameServerExecutable()
Returns the nameserver executable.- Returns:
- the full path, null if not available
-
getOutputType
public com.github.fracpete.processoutput4j.core.StreamingProcessOutputType getOutputType()
Returns what output from the process to forward.- Specified by:
getOutputType
in interfacecom.github.fracpete.processoutput4j.core.StreamingProcessOwner
- Returns:
- the output type
-
processOutput
public void processOutput(String line, boolean stdout)
Processes the incoming line.- Specified by:
processOutput
in interfacecom.github.fracpete.processoutput4j.core.StreamingProcessOwner
- Parameters:
line
- the line to processstdout
- whether stdout or stderr
-
launch
protected void launch() throws Exception
Launches the nameserver.- Throws:
Exception
- if launching fails
-
connect
protected void connect() throws IOException
Connects to the nameserver.- Throws:
IOException
- if connection fails
-
disconnect
protected void disconnect()
Disconnects from the nameserver.
-
setUp
public String setUp()
Initializes the item for flow execution.- Specified by:
setUp
in interfaceActor
- Overrides:
setUp
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractActor.reset()
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecute
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecution
in interfaceActor
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
in classAbstractActor
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished. Graphical output is left untouched.- Specified by:
wrapUp
in interfaceActor
- Overrides:
wrapUp
in classAbstractActor
-
-