Package com.apama.net.beans
Class GenericComponentManagementBean
- java.lang.Object
-
- com.apama.net.beans.AbstractGenericComponentManagementBean
-
- com.apama.net.beans.GenericComponentManagementBean
-
- All Implemented Interfaces:
BaseClientInterface
,GenericComponentManagementOperationsInterface
,PingClientInterface
,PingOperationsInterface
,java.lang.AutoCloseable
public class GenericComponentManagementBean extends AbstractGenericComponentManagementBean implements GenericComponentManagementOperationsInterface
GenericComponentManagementBean is a JavaBean that provides a way of controlling an arbitrary server that exports a GenericComponentManagement interface. The bean is intended to be a building block for the creation of client applications.The main() method provides the ability to run the bean from the command line.
Note that changes to the value of the "host" or "port" properties that are inherited from the superclass will cause the bean to attempt to re-connect to a server running on a new host/port. This re-connection will happen immediately if the bean was connected at the time of the property change, but will happen later in a "lazy" fashion if there was no existing connection at the time of the property change.
General pattern of use:
- Construct (optionally providing initial values for the host and port properties)
- [Optional] Set property values
- Tell server to perform actions.
-
-
Field Summary
-
Fields inherited from class com.apama.net.beans.AbstractGenericComponentManagementBean
DEFAULT_PORT
-
Fields inherited from interface com.apama.net.beans.interfaces.BaseClientInterface
COPYRIGHT, DEFAULT_CONNECTION_POLLING_INTERVAL, DEFAULT_HOST, DEFAULT_PORT, DEFAULT_PROCESS_NAME, PROPERTY_BEAN_CONNECTED, PROPERTY_CONNECTION_POLLING_INTERVAL, PROPERTY_HOST, PROPERTY_PORT, PROPERTY_PROCESS_NAME, PROPERTY_VERBOSE, VERSION
-
-
Constructor Summary
Constructors Constructor Description GenericComponentManagementBean()
Default constructor - as required to be a bean.GenericComponentManagementBean(java.lang.String socket_hostname, int socket_port, java.lang.String processName)
Full argument constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
deepPing()
Ask the remote server to perform a 'deep ping' operation.boolean
disconnectReceiverByComponentId(com.apama.message.ComponentIDTuple id, java.lang.String why)
Disconnect the receiver connected to this component that has component ID id.boolean
disconnectSenderByComponentId(com.apama.message.ComponentIDTuple id, java.lang.String why)
Disconnect the sender connected to this component that has component ID id.java.lang.String
doRequest(java.lang.String type, java.lang.String[] args)
Execute a component-specific commandjava.lang.String
getBuildNumber()
Get the component's build numberjava.lang.String
getBuildPlatform()
Get the component's build platformjava.lang.String
getComponentVersion()
Get the component's version numberGenericComponentManagement.GenericComponentConnectionSet
getConnections()
java.lang.String
getCurrentDirectory()
Get the component's current working directory pathjava.lang.String
getHostname()
Get the hostname that component is running onGenericComponentManagement.GenericComponentInfo
getInfo(java.lang.String category)
Request component-specific status/configuration informationlong
getLogicalId()
Get the unique logical ID of the componentGenericComponentManagement.GenericComponentLogLevel
getLogLevel()
Get the component's current logging leveljava.lang.String
getName()
Get the name of the component, encoded as UTF-8long
getPhysicalId()
Get the globally unique physical ID of the componentlong
getPID()
Return the process identifier of the remote server.float
getPMemory()
Get the physical memory usage of the component, in megabytesjava.lang.String
getProductVersion()
Get the version number of the product the component belongs toint
getRemotePort()
Get the port number that the component is listening onjava.lang.String
getType()
Get the type of the component, encoded as UTF-8int
getUptime()
Get the uptime of the component, in msjava.lang.String
getUsername()
Get the effective username the component is running asfloat
getVMemory()
Get the virtual memory usage of the component, in megabytesboolean
isGenericComponentManagementAvailable()
Return true if the remote server actually implements the GenericComponentManagement interface.static void
main(java.lang.String[] args)
This bean can be invoked from the command prompt.void
setLogLevel(GenericComponentManagement.GenericComponentLogLevel logLevel)
Set the component's logging levelvoid
shutdown(java.lang.String why)
Tell the remote server to shut itself down.-
Methods inherited from class com.apama.net.beans.AbstractGenericComponentManagementBean
addPropertyChangeListener, addPropertyChangeListener, close, connectNow, disconnect, dispose, getBeanConnected, getConnectionPollingInterval, getHost, getPort, getProcessName, getVerbose, isBeanConnected, pingServer, removePropertyChangeListener, removePropertyChangeListener, setConnectionPollingInterval, setHost, setPort, setProcessName, setVerbose
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.apama.net.beans.interfaces.BaseClientInterface
addPropertyChangeListener, addPropertyChangeListener, close, connectNow, disconnect, dispose, getBeanConnected, getConnectionPollingInterval, getHost, getPort, getProcessName, isBeanConnected, removePropertyChangeListener, removePropertyChangeListener, setConnectionPollingInterval, setHost, setPort, setProcessName
-
Methods inherited from interface com.apama.net.beans.interfaces.PingOperationsInterface
pingServer
-
-
-
-
Constructor Detail
-
GenericComponentManagementBean
public GenericComponentManagementBean()
Default constructor - as required to be a bean. Initialises the bean with default values for the properties. This default constructor does not make a connection to a remote server.
-
GenericComponentManagementBean
public GenericComponentManagementBean(java.lang.String socket_hostname, int socket_port, java.lang.String processName) throws GenericComponentManagementException
Full argument constructor. Calls the super constructor, then connects to a remote server.- Parameters:
socket_hostname
- Name of the host where the server is running.socket_port
- Port number on which the server is listening.processName
- the process name to use- Throws:
GenericComponentManagementException
- Thrown if any exceptions occur in the Client SDK.
-
-
Method Detail
-
isGenericComponentManagementAvailable
public boolean isGenericComponentManagementAvailable()
Return true if the remote server actually implements the GenericComponentManagement interface.- Specified by:
isGenericComponentManagementAvailable
in interfaceGenericComponentManagementOperationsInterface
-
deepPing
public boolean deepPing() throws GenericComponentManagementException
Ask the remote server to perform a 'deep ping' operation. Unlike a normal 'ping' that just tests connectivity to the server, a deep ping is expected to exercise the server in such a way that the caller will have a reasonable expectation that the server is working, if this method returns true.- Specified by:
deepPing
in interfaceGenericComponentManagementOperationsInterface
- Returns:
- True if the deep ping succeeded, false otherwise.
- Throws:
GenericComponentManagementException
- Thrown if any exceptions occur in the Client SDK.
-
getPID
public long getPID() throws GenericComponentManagementException
Return the process identifier of the remote server. This is primarily useful if the server becomes unresponsive and needs to be killed.- Specified by:
getPID
in interfaceGenericComponentManagementOperationsInterface
- Returns:
- The process identifier of the remote server.
- Throws:
GenericComponentManagementException
- Thrown if any exceptions occur in the Client SDK.
-
shutdown
public void shutdown(java.lang.String why) throws GenericComponentManagementException
Tell the remote server to shut itself down. This is a command, not a request. The remote server should expect that the client will wait for a reasonable interval for it to die (testing this by pinging it) then take more extreme steps to terminate the server.- Specified by:
shutdown
in interfaceGenericComponentManagementOperationsInterface
- Parameters:
why
- Message that the server can write to its logs, indicating why it was shut down.- Throws:
GenericComponentManagementException
- Thrown if any exceptions occur in the Client SDK.
-
disconnectReceiverByComponentId
public boolean disconnectReceiverByComponentId(com.apama.message.ComponentIDTuple id, java.lang.String why) throws GenericComponentManagementException
Disconnect the receiver connected to this component that has component ID id. IDs can be discovered through the getConnections() call. You can provide a reason.- Parameters:
id
- the IDwhy
- free form text that is sent to the remote receiver- Throws:
GenericComponentManagementException
- See Also:
getConnections()
-
disconnectSenderByComponentId
public boolean disconnectSenderByComponentId(com.apama.message.ComponentIDTuple id, java.lang.String why) throws GenericComponentManagementException
Disconnect the sender connected to this component that has component ID id. IDs can be discovered through the getConnections() call. You can provide a reason.- Parameters:
id
- the IDwhy
- free form text that is sent to the remote sender- Throws:
GenericComponentManagementException
- See Also:
getConnections()
-
getName
public java.lang.String getName() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the name of the component, encoded as UTF-8- Specified by:
getName
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getType
public java.lang.String getType() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the type of the component, encoded as UTF-8- Specified by:
getType
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getUptime
public int getUptime() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the uptime of the component, in ms- Specified by:
getUptime
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getVMemory
public float getVMemory() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the virtual memory usage of the component, in megabytes- Specified by:
getVMemory
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getPMemory
public float getPMemory() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the physical memory usage of the component, in megabytes- Specified by:
getPMemory
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getPhysicalId
public long getPhysicalId() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the globally unique physical ID of the component- Specified by:
getPhysicalId
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getLogicalId
public long getLogicalId() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the unique logical ID of the component- Specified by:
getLogicalId
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getLogLevel
public GenericComponentManagement.GenericComponentLogLevel getLogLevel() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the component's current logging level- Specified by:
getLogLevel
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
setLogLevel
public void setLogLevel(GenericComponentManagement.GenericComponentLogLevel logLevel) throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Set the component's logging level- Specified by:
setLogLevel
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getComponentVersion
public java.lang.String getComponentVersion() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the component's version number- Specified by:
getComponentVersion
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getProductVersion
public java.lang.String getProductVersion() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the version number of the product the component belongs to- Specified by:
getProductVersion
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getBuildNumber
public java.lang.String getBuildNumber() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the component's build number- Specified by:
getBuildNumber
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getBuildPlatform
public java.lang.String getBuildPlatform() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the component's build platform- Specified by:
getBuildPlatform
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getHostname
public java.lang.String getHostname() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the hostname that component is running on- Specified by:
getHostname
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getUsername
public java.lang.String getUsername() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the effective username the component is running as- Specified by:
getUsername
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getCurrentDirectory
public java.lang.String getCurrentDirectory() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the component's current working directory path- Specified by:
getCurrentDirectory
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getRemotePort
public int getRemotePort() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Get the port number that the component is listening on- Specified by:
getRemotePort
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
doRequest
public java.lang.String doRequest(java.lang.String type, java.lang.String[] args) throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Execute a component-specific command- Specified by:
doRequest
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getInfo
public GenericComponentManagement.GenericComponentInfo getInfo(java.lang.String category) throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterface
Request component-specific status/configuration information- Specified by:
getInfo
in interfaceGenericComponentManagementOperationsInterface
- Throws:
GenericComponentManagementException
-
getConnections
public GenericComponentManagement.GenericComponentConnectionSet getConnections() throws GenericComponentManagementException
-
main
public static void main(java.lang.String[] args)
This bean can be invoked from the command prompt. Invoke with "--help" as parameter to print usage information.
-
-