Package org.opennms.netmgt.vmmgr
Class Controller
- java.lang.Object
-
- org.opennms.netmgt.vmmgr.Controller
-
public class Controller extends 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 String
CONNECTOR_ADDRESS
The system property used to determine the JMX management agent URI for the JVM that we are attaching to.static String
DEFAULT_JMX_RMI_URL
-
Constructor Summary
Constructors Constructor Description Controller()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
check()
checkObject
doInvokeOperation(String operation)
int
dumpThreads()
dumpThreadsint
exit()
exitString
getJmxUrl()
This method uses the Java Attach API to connect to a running OpenNMS JVM and fetch the dynamically assigned local JMX agent URL.String
getPid()
int
getRmiHandshakeTimeout()
int
invokeOperation(String operation)
boolean
isVerbose()
isVerbosestatic void
main(String[] argv)
mainvoid
setJmxRmiUrl(String jmxUrl)
setJmxRmiUrlvoid
setPid(String pid)
void
setRmiHandshakeTimeout(int httpRequestReadTimeout)
void
setVerbose(boolean verbose)
setVerbosevoid
start()
Start the OpenNMS daemon.int
status()
statusint
stop()
stop
-
-
-
Field Detail
-
CONNECTOR_ADDRESS
public static final 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 String DEFAULT_JMX_RMI_URL
- See Also:
- Constant Field Values
-
-
Method Detail
-
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(String operation)
-
doInvokeOperation
public Object doInvokeOperation(String operation) throws MalformedURLException, IOException, InstanceNotFoundException, MalformedObjectNameException, MBeanException, ReflectionException, NullPointerException
-
isVerbose
public boolean isVerbose()
isVerbose
- Returns:
- a boolean.
-
setVerbose
public void setVerbose(boolean verbose)
setVerbose
- Parameters:
verbose
- a boolean.
-
getJmxUrl
public 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(String jmxUrl)
setJmxRmiUrl
- Parameters:
jmxUrl
- aString
object.
-
getPid
public String getPid()
-
setPid
public void setPid(String pid)
-
getRmiHandshakeTimeout
public int getRmiHandshakeTimeout()
-
setRmiHandshakeTimeout
public void setRmiHandshakeTimeout(int httpRequestReadTimeout)
-
-