Class Controller


  • public class Controller
    extends java.lang.Object

    This Controller class is used to interact with a Manager MBean running inside an OpenNMS JMX service. This class can invoke operations on that MBean and request status information from it. It is used to execute shell operations to control the lifecycle of the OpenNMS process from init.d or systemd scripts.

    Author:
    Seth, Brian Weaver, Sowmya Nataraj
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CONNECTOR_ADDRESS
      The system property used to determine the JMX management agent URI for the JVM that we are attaching to.
      static java.lang.String DEFAULT_JMX_RMI_URL  
    • Constructor Summary

      Constructors 
      Constructor Description
      Controller()  
    • Field Detail

      • CONNECTOR_ADDRESS

        public static final java.lang.String CONNECTOR_ADDRESS
        The system property used to determine the JMX management agent URI for the JVM that we are attaching to. This is used for getting status information from a running OpenNMS instance.
        See Also:
        Constant Field Values
      • DEFAULT_JMX_RMI_URL

        public static final java.lang.String DEFAULT_JMX_RMI_URL
        See Also:
        Constant Field Values
    • Constructor Detail

      • Controller

        public Controller()
    • Method Detail

      • main

        public static void main​(java.lang.String[] argv)

        main

        Parameters:
        argv - an array of String objects.
      • start

        public void start()
        Start the OpenNMS daemon. Never returns.
      • stop

        public int stop()

        stop

        Returns:
        a int.
      • status

        public int status()

        status

        Returns:
        a int.
      • check

        public int check()

        check

        Returns:
        a int.
      • dumpThreads

        public int dumpThreads()

        dumpThreads

        Returns:
        a int.
      • exit

        public int exit()

        exit

        Returns:
        a int.
      • invokeOperation

        public int invokeOperation​(java.lang.String operation)
      • doInvokeOperation

        public java.lang.Object doInvokeOperation​(java.lang.String operation)
                                           throws java.net.MalformedURLException,
                                                  java.io.IOException,
                                                  javax.management.InstanceNotFoundException,
                                                  javax.management.MalformedObjectNameException,
                                                  javax.management.MBeanException,
                                                  javax.management.ReflectionException,
                                                  java.lang.NullPointerException
        Throws:
        java.net.MalformedURLException
        java.io.IOException
        javax.management.InstanceNotFoundException
        javax.management.MalformedObjectNameException
        javax.management.MBeanException
        javax.management.ReflectionException
        java.lang.NullPointerException
      • isVerbose

        public boolean isVerbose()

        isVerbose

        Returns:
        a boolean.
      • setVerbose

        public void setVerbose​(boolean verbose)

        setVerbose

        Parameters:
        verbose - a boolean.
      • getJmxUrl

        public java.lang.String getJmxUrl()
        This method uses the Java Attach API to connect to a running OpenNMS JVM and fetch the dynamically assigned local JMX agent URL.
        Returns:
        a String object.
      • setJmxRmiUrl

        public void setJmxRmiUrl​(java.lang.String jmxUrl)

        setJmxRmiUrl

        Parameters:
        jmxUrl - a String object.
      • getPid

        public java.lang.String getPid()
      • setPid

        public void setPid​(java.lang.String pid)
      • getRmiHandshakeTimeout

        public int getRmiHandshakeTimeout()
      • setRmiHandshakeTimeout

        public void setRmiHandshakeTimeout​(int httpRequestReadTimeout)