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
    • Field Detail

      • 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_ExecutionFailure

        protected IllegalStateException m_ExecutionFailure
        in case an exception occurred executing the command (gets rethrown).
    • Constructor Detail

      • PyroNameServer

        public PyroNameServer()
    • Method Detail

      • reset

        protected void reset()
        Resets the scheme.
        Overrides:
        reset in class AbstractActor
      • 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.
      • 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 interface com.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 interface com.github.fracpete.processoutput4j.core.StreamingProcessOwner
        Parameters:
        line - the line to process
        stdout - 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.
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message
      • wrapUp

        public void wrapUp()
        Cleans up after the execution has finished. Graphical output is left untouched.
        Specified by:
        wrapUp in interface Actor
        Overrides:
        wrapUp in class AbstractActor