com.metamatrix.platform.admin.apiimpl
Class RuntimeStateAdminAPIHelper

java.lang.Object
  extended by com.metamatrix.platform.admin.apiimpl.RuntimeStateAdminAPIHelper

public class RuntimeStateAdminAPIHelper
extends java.lang.Object

Singleton helper class for performing Runtime administrative functionality.

Since:
4.3

Constructor Summary
protected RuntimeStateAdminAPIHelper(ClusteredRegistryState registry, HostManagement hostManagement)
           
 
Method Summary
 void bounceServer()
          Shutdown server and restart.
 byte[] exportLogs(java.lang.String hostName, java.lang.String processName)
          Export the server logs to a byte[].
 java.util.List<ServiceRegistryBinding> getActiveServices(java.lang.String serviceType)
          get the active services of given type
 java.util.Collection getConnectionPoolStats(ServiceRegistryBinding binding)
          Return Collection of ConnectionPoolStats for a service.
 java.util.Date getEldestProcessStartTime()
           
 java.util.List<java.lang.String> getHosts()
          Return all hosts running in mm system.
static RuntimeStateAdminAPIHelper getInstance(ClusteredRegistryState registry, HostManagement hostManagement)
          Get the singleton instance.
 java.util.List<ProcessRegistryBinding> getProcesses()
          Return all processes.
 ServiceRegistryBinding getServiceBinding(ServiceID serviceID)
          Return ServiceRegistryBinding for the given serviceID
 java.util.Collection getServiceQueueStatistics(ServiceRegistryBinding binding)
          Return Collection of QueueStats for service.
 java.util.List<ServiceRegistryBinding> getServices()
          Return serviceID's for all services running in mm system.
 SystemState getSystemState()
          Return the running state of the system.
 ProcessManagement getVMControllerInterface(java.lang.String hostName, java.lang.String processName)
           
 java.net.InetAddress getVMHostName(java.lang.String hostName, java.lang.String processName)
           
 ProcessStatistics getVMStatistics(java.lang.String hostName, java.lang.String processName)
          Return VMStatistics object for Process.
 boolean isSystemStarted()
          Return TRUE if the system is started; i.e.
 void restartService(ServiceID serviceID)
          Restart a failed or stopped service.
 void setLogConfiguration(Configuration config, LogConfiguration logConfig, java.util.List actions, java.lang.String principalName)
          Set the Log Configuration in the database and propagate changes to other VM
 void shutdownServer()
          Gracefully shutdown server waiting for work to complete.
 void startHost(java.lang.String host)
          Start Host and all processes/services for host.
 void startProcess(java.lang.String host, java.lang.String process)
          Start Process and all services for process.
 void stopHost(java.lang.String host, boolean stopNow)
          Stop host processes/services.
 void stopProcess(java.lang.String hostName, java.lang.String processName, boolean stopNow)
          Stop process.
 void stopService(ServiceID serviceID, boolean stopNow)
          Stop service.
 void synchronizeServer()
          Synchronize running services with runtime configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuntimeStateAdminAPIHelper

protected RuntimeStateAdminAPIHelper(ClusteredRegistryState registry,
                                     HostManagement hostManagement)
Method Detail

getInstance

public static RuntimeStateAdminAPIHelper getInstance(ClusteredRegistryState registry,
                                                     HostManagement hostManagement)
Get the singleton instance.

Returns:
Since:
4.3

getSystemState

public SystemState getSystemState()
                           throws MetaMatrixComponentException
Return the running state of the system.

Returns:
SysteState object that represents the system.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

isSystemStarted

public boolean isSystemStarted()
                        throws MetaMatrixComponentException
Return TRUE if the system is started; i.e. at leat one of every essential services in a product is running. Authorization, Configuration, Membership and Session services are considered to be essential.

Parameters:
callerSessionID - ID of the caller's current session.
Returns:
Boolean - TRUE if system is started, FALSE if not.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

getHosts

public java.util.List<java.lang.String> getHosts()
                                          throws MetaMatrixComponentException
Return all hosts running in mm system.

Parameters:
callerSessionID - ID of the caller's current session.
Returns:
List of Strings
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

getVMStatistics

public ProcessStatistics getVMStatistics(java.lang.String hostName,
                                         java.lang.String processName)
                                  throws MetaMatrixComponentException
Return VMStatistics object for Process.

Parameters:
callerSessionID - ID of the caller's current session.
VMControllerID - ID of the process.
Returns:
VMStatistics.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

getVMHostName

public java.net.InetAddress getVMHostName(java.lang.String hostName,
                                          java.lang.String processName)
                                   throws MetaMatrixComponentException
Throws:
MetaMatrixComponentException

getServiceQueueStatistics

public java.util.Collection getServiceQueueStatistics(ServiceRegistryBinding binding)
                                               throws MetaMatrixComponentException
Return Collection of QueueStats for service.

Parameters:
binding - The ServiceRegistryBinding for the connector
Returns:
Collection of QueueStats objects.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

getConnectionPoolStats

public java.util.Collection getConnectionPoolStats(ServiceRegistryBinding binding)
                                            throws MetaMatrixComponentException
Return Collection of ConnectionPoolStats for a service.

Parameters:
binding - The ServiceRegistryBinding for the connector
Returns:
Collection of ConnectionPoolStat objects.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

getServiceBinding

public ServiceRegistryBinding getServiceBinding(ServiceID serviceID)
                                         throws ResourceNotBoundException
Return ServiceRegistryBinding for the given serviceID

Parameters:
serviceID - Identifies service
Returns:
ServiceRegistryBinding
Throws:
ResourceNotBoundException

getServices

public java.util.List<ServiceRegistryBinding> getServices()
                                                   throws MetaMatrixComponentException
Return serviceID's for all services running in mm system.

Parameters:
callerSessionID - ID of the caller's current session.
Returns:
List of ServiceIDs.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

getActiveServices

public java.util.List<ServiceRegistryBinding> getActiveServices(java.lang.String serviceType)
                                                         throws MetaMatrixComponentException
get the active services of given type

Parameters:
serviceType -
Returns:
Throws:
MetaMatrixComponentException

shutdownServer

public void shutdownServer()
                    throws MetaMatrixComponentException
Gracefully shutdown server waiting for work to complete.

Parameters:
registry - used by MetaMatrix to find the active VMs
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

bounceServer

public void bounceServer()
                  throws MetaMatrixComponentException
Shutdown server and restart.

Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

synchronizeServer

public void synchronizeServer()
                       throws MetaMatrixComponentException,
                              MultipleException
Synchronize running services with runtime configuration. Any running hosts/processes/services that are running but not in the configuration are killed Any deployed hosts/processes/services that are not running but are deployed are started Any deployed services that are running are set to the open state.

Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.
a - MultipleException if an error occurs
MultipleException

getVMControllerInterface

public ProcessManagement getVMControllerInterface(java.lang.String hostName,
                                                  java.lang.String processName)
                                           throws ResourceNotBoundException
Throws:
ResourceNotBoundException

restartService

public void restartService(ServiceID serviceID)
                    throws MetaMatrixComponentException
Restart a failed or stopped service.

Parameters:
registry - the Registry.
serviceID - ID of service instance.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

setLogConfiguration

public void setLogConfiguration(Configuration config,
                                LogConfiguration logConfig,
                                java.util.List actions,
                                java.lang.String principalName)
                         throws ConfigurationException,
                                ServiceException,
                                MetaMatrixComponentException
Set the Log Configuration in the database and propagate changes to other VM

Parameters:
registry -
config -
logConfig -
actions -
token -
Throws:
ConfigurationLockException
ConfigurationException
ServiceException
MetaMatrixComponentException
RegistryCommunicationException
Since:
4.3

stopService

public void stopService(ServiceID serviceID,
                        boolean stopNow)
                 throws MetaMatrixComponentException
Stop service.

Parameters:
registry - the Registry.
serviceID - ID of service instance.
stopNow - If true, stop forcefully. If false, wait until work is complete.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

startHost

public void startHost(java.lang.String host)
               throws MetaMatrixComponentException
Start Host and all processes/services for host.

Parameters:
registry - The Registry.
host - Name of host to start.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

startProcess

public void startProcess(java.lang.String host,
                         java.lang.String process)
                  throws MetaMatrixComponentException
Start Process and all services for process.

Parameters:
registry - The Registry.
host - Host processes belongs to.
process - Name of process to start.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

stopHost

public void stopHost(java.lang.String host,
                     boolean stopNow)
              throws MetaMatrixComponentException,
                     MultipleException
Stop host processes/services.

Parameters:
registry - The Registry.
host - Name of host.
stopNow - If true, stop forcefully. If false, wait until work is complete.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.
MultipleException

stopProcess

public void stopProcess(java.lang.String hostName,
                        java.lang.String processName,
                        boolean stopNow)
                 throws AuthorizationException,
                        MetaMatrixComponentException
Stop process.

Parameters:
registry - The Registry.
processID - VMControllerID.
stopNow - If true, stop forcefully. If false, wait until work is complete.
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.
AuthorizationException

exportLogs

public byte[] exportLogs(java.lang.String hostName,
                         java.lang.String processName)
                  throws MetaMatrixComponentException
Export the server logs to a byte[]. The bytes contain the contents of a .zip file containing the logs.

Parameters:
registry -
processID - Identifies the process to use to get the logs. This will export all logs on the host that contains the speciefied process.
Returns:
the logs, as a byte[].
Throws:
AdminException
MetaMatrixComponentException
Since:
4.3

getProcesses

public java.util.List<ProcessRegistryBinding> getProcesses()
                                                    throws MetaMatrixComponentException
Return all processes.

Returns:
List of processes
Throws:
MetaMatrixComponentException - if an error occurred in communicating with a component.

getEldestProcessStartTime

public java.util.Date getEldestProcessStartTime()
                                         throws MetaMatrixComponentException
Throws:
MetaMatrixComponentException


Copyright © 2009. All Rights Reserved.