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 booleandeepPing()Ask the remote server to perform a 'deep ping' operation.booleandisconnectReceiverByComponentId(com.apama.message.ComponentIDTuple id, java.lang.String why)Disconnect the receiver connected to this component that has component ID id.booleandisconnectSenderByComponentId(com.apama.message.ComponentIDTuple id, java.lang.String why)Disconnect the sender connected to this component that has component ID id.java.lang.StringdoRequest(java.lang.String type, java.lang.String[] args)Execute a component-specific commandjava.lang.StringgetBuildNumber()Get the component's build numberjava.lang.StringgetBuildPlatform()Get the component's build platformjava.lang.StringgetComponentVersion()Get the component's version numberGenericComponentManagement.GenericComponentConnectionSetgetConnections()java.lang.StringgetCurrentDirectory()Get the component's current working directory pathjava.lang.StringgetHostname()Get the hostname that component is running onGenericComponentManagement.GenericComponentInfogetInfo(java.lang.String category)Request component-specific status/configuration informationlonggetLogicalId()Get the unique logical ID of the componentGenericComponentManagement.GenericComponentLogLevelgetLogLevel()Get the component's current logging leveljava.lang.StringgetName()Get the name of the component, encoded as UTF-8longgetPhysicalId()Get the globally unique physical ID of the componentlonggetPID()Return the process identifier of the remote server.floatgetPMemory()Get the physical memory usage of the component, in megabytesjava.lang.StringgetProductVersion()Get the version number of the product the component belongs tointgetRemotePort()Get the port number that the component is listening onjava.lang.StringgetType()Get the type of the component, encoded as UTF-8intgetUptime()Get the uptime of the component, in msjava.lang.StringgetUsername()Get the effective username the component is running asfloatgetVMemory()Get the virtual memory usage of the component, in megabytesbooleanisGenericComponentManagementAvailable()Return true if the remote server actually implements the GenericComponentManagement interface.static voidmain(java.lang.String[] args)This bean can be invoked from the command prompt.voidsetLogLevel(GenericComponentManagement.GenericComponentLogLevel logLevel)Set the component's logging levelvoidshutdown(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 GenericComponentManagementExceptionFull 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:
isGenericComponentManagementAvailablein interfaceGenericComponentManagementOperationsInterface
-
deepPing
public boolean deepPing() throws GenericComponentManagementExceptionAsk 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:
deepPingin 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 GenericComponentManagementExceptionReturn the process identifier of the remote server. This is primarily useful if the server becomes unresponsive and needs to be killed.- Specified by:
getPIDin 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 GenericComponentManagementExceptionTell 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:
shutdownin 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 GenericComponentManagementExceptionDisconnect 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 GenericComponentManagementExceptionDisconnect 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 GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the name of the component, encoded as UTF-8- Specified by:
getNamein interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getType
public java.lang.String getType() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the type of the component, encoded as UTF-8- Specified by:
getTypein interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getUptime
public int getUptime() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the uptime of the component, in ms- Specified by:
getUptimein interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getVMemory
public float getVMemory() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the virtual memory usage of the component, in megabytes- Specified by:
getVMemoryin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getPMemory
public float getPMemory() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the physical memory usage of the component, in megabytes- Specified by:
getPMemoryin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getPhysicalId
public long getPhysicalId() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the globally unique physical ID of the component- Specified by:
getPhysicalIdin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getLogicalId
public long getLogicalId() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the unique logical ID of the component- Specified by:
getLogicalIdin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getLogLevel
public GenericComponentManagement.GenericComponentLogLevel getLogLevel() throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterfaceGet the component's current logging level- Specified by:
getLogLevelin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
setLogLevel
public void setLogLevel(GenericComponentManagement.GenericComponentLogLevel logLevel) throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterfaceSet the component's logging level- Specified by:
setLogLevelin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getComponentVersion
public java.lang.String getComponentVersion() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the component's version number- Specified by:
getComponentVersionin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getProductVersion
public java.lang.String getProductVersion() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the version number of the product the component belongs to- Specified by:
getProductVersionin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getBuildNumber
public java.lang.String getBuildNumber() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the component's build number- Specified by:
getBuildNumberin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getBuildPlatform
public java.lang.String getBuildPlatform() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the component's build platform- Specified by:
getBuildPlatformin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getHostname
public java.lang.String getHostname() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the hostname that component is running on- Specified by:
getHostnamein interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getUsername
public java.lang.String getUsername() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the effective username the component is running as- Specified by:
getUsernamein interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getCurrentDirectory
public java.lang.String getCurrentDirectory() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the component's current working directory path- Specified by:
getCurrentDirectoryin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getRemotePort
public int getRemotePort() throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceGet the port number that the component is listening on- Specified by:
getRemotePortin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
doRequest
public java.lang.String doRequest(java.lang.String type, java.lang.String[] args) throws GenericComponentManagementExceptionDescription copied from interface:GenericComponentManagementOperationsInterfaceExecute a component-specific command- Specified by:
doRequestin interfaceGenericComponentManagementOperationsInterface- Throws:
GenericComponentManagementException
-
getInfo
public GenericComponentManagement.GenericComponentInfo getInfo(java.lang.String category) throws GenericComponentManagementException
Description copied from interface:GenericComponentManagementOperationsInterfaceRequest component-specific status/configuration information- Specified by:
getInfoin 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.
-
-