com.apama.net.beans
Class GenericComponentManagementBean

java.lang.Object
  extended by com.apama.net.beans.AbstractGenericComponentManagementBean
      extended by com.apama.net.beans.GenericComponentManagementBean
All Implemented Interfaces:
BaseClientInterface, GenericComponentManagementOperationsInterface, PingClientInterface, PingOperationsInterface

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:

  1. Construct (optionally providing initial values for the host and port properties)
  2. [Optional] Set property values
  3. 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
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
 boolean deepPing()
          Ask the remote server to perform a 'deep ping' operation.
 boolean disconnectReceiverByPhysicalId(long id, java.lang.String why)
          Disconnect the receiver connected to this component that has physical ID id.
 boolean disconnectSenderByPhysicalId(long id, java.lang.String why)
          Disconnect the sender connected to this component that has physical ID id.
 java.lang.String doRequest(java.lang.String request)
          Execute a component-specific command
 java.lang.String getBuildNumber()
          Get the component's build number
 java.lang.String getBuildPlatform()
          Get the component's build platform
 java.lang.String getComponentVersion()
          Get the component's version number
 GenericComponentManagement.GenericComponentConnectionSet getConnections()
           
 java.lang.String getCurrentDirectory()
          Get the component's current working directory path
 java.lang.String getHostname()
          Get the hostname that component is running on
 GenericComponentManagement.GenericComponentInfo getInfo(java.lang.String category)
          Request component-specific status/configuration information
 long getLogicalId()
          Get the unique logical ID of the component
 GenericComponentManagement.GenericComponentLogLevel getLogLevel()
          Get the component's current logging level
 java.lang.String getName()
          Get the name of the component, encoded as UTF-8
 long getPhysicalId()
          Get the globally unique physical ID of the component
 long getPID()
          Return the process identifier of the remote server.
 java.lang.String getProductVersion()
          Get the version number of the product the component belongs to
 int getRemotePort()
          Get the port number that the component is listening on
 java.lang.String getType()
          Get the type of the component, encoded as UTF-8
 java.lang.String getUsername()
          Get the effective username the component is running as
 boolean 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 level
 void shutdown(java.lang.String why)
          Tell the remote server to shut itself down.
 
Methods inherited from class com.apama.net.beans.AbstractGenericComponentManagementBean
addPropertyChangeListener, addPropertyChangeListener, 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.PingOperationsInterface
pingServer
 
Methods inherited from interface com.apama.net.beans.interfaces.BaseClientInterface
addPropertyChangeListener, addPropertyChangeListener, connectNow, disconnect, dispose, getBeanConnected, getConnectionPollingInterval, getHost, getPort, getProcessName, isBeanConnected, removePropertyChangeListener, removePropertyChangeListener, setConnectionPollingInterval, setHost, setPort, setProcessName
 

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 interface GenericComponentManagementOperationsInterface

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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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.

disconnectReceiverByPhysicalId

public boolean disconnectReceiverByPhysicalId(long id,
                                              java.lang.String why)
                                       throws GenericComponentManagementException
Disconnect the receiver connected to this component that has physical ID id. IDs can be discovered through the getConnections() call. You can provide a reason.

Parameters:
id - the ID
why - free form text that is sent to the remote receiver
Throws:
GenericComponentManagementException
See Also:
getConnections()

disconnectSenderByPhysicalId

public boolean disconnectSenderByPhysicalId(long id,
                                            java.lang.String why)
                                     throws GenericComponentManagementException
Disconnect the sender connected to this component that has physical ID id. IDs can be discovered through the getConnections() call. You can provide a reason.

Parameters:
id - the ID
why - 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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
Throws:
GenericComponentManagementException

doRequest

public java.lang.String doRequest(java.lang.String request)
                           throws GenericComponentManagementException
Description copied from interface: GenericComponentManagementOperationsInterface
Execute a component-specific command

Specified by:
doRequest in interface GenericComponentManagementOperationsInterface
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 interface GenericComponentManagementOperationsInterface
Throws:
GenericComponentManagementException

getConnections

public GenericComponentManagement.GenericComponentConnectionSet getConnections()
                                                                        throws GenericComponentManagementException
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.



Submit a bug or feature
Copyright (c) 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG