org.objectweb.petals.tools.webadmin.collector
Class DataCollector

java.lang.Object
  extended by org.objectweb.petals.tools.webadmin.collector.DataCollector

public final class DataCollector
extends java.lang.Object

DataCollector is a singleton : only one can be instantiate and it's not cloneable. Clients can only gets a reference to the existing DataCollector and call methods through this reference.

Author:
msauvage

Method Summary
 void activateMonitoring(java.lang.String serverName, boolean showMessageContent)
          starts monitoring on a server of the list of servers via a JMX call on the administration MBean of this server to call his activation method
 void activateMonitoringAllServers(boolean showMessageContent)
          starts monitoring on each server of the list of servers via a JMX call on their administration MBean.
 void changeCompoState(java.lang.String serverName, java.lang.String compoName, java.lang.String action)
          Change the state of a component on a PEtALS server
 void changeSAState(java.lang.String serverName, java.lang.String saName, java.lang.String operation)
          Temporary method to change the state of a new Service Assembly
protected  void createListener(ServerConfiguration serverConf)
          Creates a listener to a server and stores it in the messagesListeners map
 void deactivateMonitoring(java.lang.String serverName)
          starts monitoring on a server of the list of servers via a JMX call on the administration MBean of this server to call his activation method
 void deactivateMonitoringAllServers()
          stops monitoring on each server of the list of servers via a JMX call on their administration MBean.
static DataCollector getCollector()
          Return the actual collector
 ServerConfiguration getEntryServerConf()
          Gets the configuration of PEtALS entry server
 MessageExchange getMessageExchange(java.lang.String serverName, java.lang.String exchangeId)
           
 java.util.Map<java.lang.String,MessageExchange> getMessagesExchanges(java.lang.String serverName)
           
 javax.management.ObjectName getPetalsAdminName()
          Gets admin MBean name of PEtALS
 java.util.List<ServerConfiguration> getPetalsServersConf()
          Gets configuration of all servers
 ServerPropertiesManager getPropertiesManager()
          Gets the manager of properties file
 ServerConfiguration getServer(java.lang.String serverName)
          Gets a server configuration from the list of servers by his name
 ServerConfiguration getStorageServerConf()
          Gets the configuration of storage server
 void init(java.lang.String rootPath)
          Initialize the DataCollector.
 void installComponent(java.lang.String serverName, java.lang.String filePath)
          Install a component on a given server.
 void installServiceAssembly(java.lang.String serverName, java.lang.String filepath)
          Temporary method to install a new Service Assembly
 boolean isInit()
          Indicates if DataCollector have successfully been initialized by init() method
 boolean isMessageContentShown(java.lang.String serverName)
           
 boolean isMonitoring(java.lang.String serverName)
          Indicates if monitoring is active or not on a server by retrieving the information on the server himself.
 void processNewDatas(java.util.List<Message> messagesList)
          Process a new set of messages.
 void setEntryServerConf(ServerConfiguration serverConf)
          Sets the PEtALS entry server configuration.
 void setLastRetrieveTime(java.lang.String serverName, long timestamp)
          Sets the last time of retrieval for a server by associating the name of the server as key to a timestamp as the time.
 void setPetalsAdminName(javax.management.ObjectName petalsAdminName)
          Sets the admin MBean name of PEtALS
 void setPetalsServersConf(java.util.List<ServerConfiguration> petalsServersConf)
          Sets the list of PEtALS servers to a new list.
 void setPropertiesManager(ServerPropertiesManager propertiesManager)
          Sets the properties manager to a new ServerPropertiesManager
 void setStorageServerConf(ServerConfiguration serverConf)
          Sets the configuration of datas storage server
 void showMessagesInConsole(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> messages)
          debug function to see the content of the messages in a list of messages
 void storeMessages(java.util.List<Message> list, java.lang.String notificationNumber)
           
 void uninstallComponent(java.lang.String serverName, java.lang.String compoName)
          Uninstall a component on a PEtALS server
 void uninstallServiceAssembly(java.lang.String serverName, java.lang.String saName)
          Temporary method to uninstall a new Service Assembly
 void updateAndExposeComponents()
          Retrieves via a JMX call to each server of the list of servers petalsServersConf a Map of his components installed and expose them in the storage JMX server as a List in ServersComponents MBean
 void updateExposedServerConf(ServerConfiguration serverConf)
          Update a server's configuration in the ServersList mbean on the storage server
 void updateListeners()
          Updates the listeners stored : removes listeners to server unexisting or stopped and adds listeners to new active servers
 void updateServers()
          Update the list of servers petalsServersConf and expose the list on the storage JMX server by retrieving the informations of all servers via a JMX call to the entry server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCollector

public static DataCollector getCollector()
Return the actual collector

Returns:

activateMonitoring

public void activateMonitoring(java.lang.String serverName,
                               boolean showMessageContent)
                        throws java.lang.NoSuchFieldException,
                               javax.management.MBeanException
starts monitoring on a server of the list of servers via a JMX call on the administration MBean of this server to call his activation method

Parameters:
serverName - the name of the server to monitor
showMessageContent - true to monitor also the content of messages, false to ignore it
Throws:
java.lang.NoSuchFieldException - thrown if server is not found in the list of servers
javax.management.MBeanException - problem occured in communication with server when trying to sets the new monitoring attribute value

activateMonitoringAllServers

public void activateMonitoringAllServers(boolean showMessageContent)
                                  throws java.lang.NoSuchFieldException,
                                         javax.management.MBeanException
starts monitoring on each server of the list of servers via a JMX call on their administration MBean. If showMessageContent is set to true, activate the monitoring of the content of messages.

Parameters:
showMessageContent - true to monitor content of messages, false to ignore it
Throws:
java.lang.NoSuchFieldException - thrown if server is not found in the list of servers
javax.management.MBeanException

changeCompoState

public void changeCompoState(java.lang.String serverName,
                             java.lang.String compoName,
                             java.lang.String action)
                      throws java.lang.NoSuchFieldException,
                             javax.management.MBeanException
Change the state of a component on a PEtALS server

Parameters:
serverName - the name of the server on which the component is installed
compoName - the name of the component
action - the action to do : "start" or "stop"
Throws:
java.lang.NoSuchFieldException
javax.management.MBeanException

deactivateMonitoring

public void deactivateMonitoring(java.lang.String serverName)
                          throws java.lang.NoSuchFieldException,
                                 javax.management.MBeanException
starts monitoring on a server of the list of servers via a JMX call on the administration MBean of this server to call his activation method

Parameters:
serverName - the name of the server to monitor
showMessageContent - true to monitor also the content of messages, false to ignore it
Throws:
java.lang.NoSuchFieldException - thrown if server is not found in the list of servers
javax.management.MBeanException - problem occured in communication with server when trying to sets the new monitoring attribute value

deactivateMonitoringAllServers

public void deactivateMonitoringAllServers()
                                    throws java.lang.NoSuchFieldException,
                                           javax.management.MBeanException
stops monitoring on each server of the list of servers via a JMX call on their administration MBean.

Throws:
java.lang.NoSuchFieldException - thrown if server is not found in the list of servers
javax.management.MBeanException

updateAndExposeComponents

public void updateAndExposeComponents()
                               throws java.io.IOException,
                                      javax.management.MBeanException
Retrieves via a JMX call to each server of the list of servers petalsServersConf a Map of his components installed and expose them in the storage JMX server as a List in ServersComponents MBean

Throws:
java.io.IOException - storage server is not reachable
javax.management.MBeanException - invocation of MBean in storage server threw an exception

getEntryServerConf

public ServerConfiguration getEntryServerConf()
Gets the configuration of PEtALS entry server

Returns:
a ServerConfiguration containing server's informations

getPetalsAdminName

public javax.management.ObjectName getPetalsAdminName()
Gets admin MBean name of PEtALS

Returns:
an Objectname representation of the name of the MBean

getPetalsServersConf

public java.util.List<ServerConfiguration> getPetalsServersConf()
Gets configuration of all servers

Returns:
a List of ServerConfiguration containing informations about all servers of the domain

getPropertiesManager

public ServerPropertiesManager getPropertiesManager()
Gets the manager of properties file

Returns:
the properties manager

getServer

public ServerConfiguration getServer(java.lang.String serverName)
                              throws java.lang.NoSuchFieldException
Gets a server configuration from the list of servers by his name

Parameters:
serverName - the name of the server wanted
Returns:
a ServerConfiguration of the server
Throws:
java.lang.NoSuchFieldException - server doesn't exist
java.lang.NullPointerException - serverName parameter is null

getStorageServerConf

public ServerConfiguration getStorageServerConf()
Gets the configuration of storage server

Returns:
a ServerConfiguration containing server's information

init

public void init(java.lang.String rootPath)
          throws javax.management.MBeanException,
                 java.io.IOException,
                 javax.management.AttributeNotFoundException
Initialize the DataCollector. Sets a new ServerPropertiesManager and a initialize petals entry server and datas storage JMX server configurations by reading their properties via the ServerPropertiesManager. Initialize the list of servers and exposes on the storage server their properties and components

Throws:
java.io.IOException - the properties manager file is not readable or is not found
javax.management.MBeanException - problem occured in communication with storage server
javax.management.AttributeNotFoundException

installComponent

public void installComponent(java.lang.String serverName,
                             java.lang.String filePath)
                      throws javax.management.MBeanException
Install a component on a given server. Component is on its archive (.zip) form and is located by its path on the machine where is hosted the webadmin application

Parameters:
serverName - the name of the server where to install component
filePath - complete path of the archive on the server hosting the webapp
Throws:
javax.management.MBeanException - a problem occured with server during the installation

installServiceAssembly

public void installServiceAssembly(java.lang.String serverName,
                                   java.lang.String filepath)
                            throws javax.management.MBeanException
Temporary method to install a new Service Assembly

Throws:
javax.management.MBeanException

uninstallServiceAssembly

public void uninstallServiceAssembly(java.lang.String serverName,
                                     java.lang.String saName)
                              throws javax.management.MBeanException
Temporary method to uninstall a new Service Assembly

Throws:
javax.management.MBeanException

changeSAState

public void changeSAState(java.lang.String serverName,
                          java.lang.String saName,
                          java.lang.String operation)
                   throws javax.management.MBeanException
Temporary method to change the state of a new Service Assembly

Throws:
javax.management.MBeanException

isInit

public boolean isInit()
Indicates if DataCollector have successfully been initialized by init() method

Returns:
true if init() method have been called and have successfully initialized the collector, false if not

isMessageContentShown

public boolean isMessageContentShown(java.lang.String serverName)
                              throws javax.management.MBeanException,
                                     java.lang.NoSuchFieldException
Throws:
javax.management.MBeanException
java.lang.NoSuchFieldException

isMonitoring

public boolean isMonitoring(java.lang.String serverName)
                     throws javax.management.MBeanException,
                            java.lang.NoSuchFieldException
Indicates if monitoring is active or not on a server by retrieving the information on the server himself.

Returns:
true if monitoring is running, false if not.
Throws:
javax.management.MBeanException
java.lang.NoSuchFieldException

processNewDatas

public void processNewDatas(java.util.List<Message> messagesList)
Process a new set of messages.

Parameters:
messagesList - a list of Message object representations of messages. Must not be null.
Throws:
java.io.IOException
javax.management.MBeanException

setEntryServerConf

public void setEntryServerConf(ServerConfiguration serverConf)
                        throws java.io.IOException
Sets the PEtALS entry server configuration. Sets it as properties of the DataCollector and register the informations in a properties file

Parameters:
serverConf - a server's configuration
Throws:
java.io.IOException

setLastRetrieveTime

public void setLastRetrieveTime(java.lang.String serverName,
                                long timestamp)
Sets the last time of retrieval for a server by associating the name of the server as key to a timestamp as the time. Both key and values must be not null.

Parameters:
serverName - the name of the server
timestamp - the time to associate with the server's name

setPetalsAdminName

public void setPetalsAdminName(javax.management.ObjectName petalsAdminName)
Sets the admin MBean name of PEtALS

Parameters:
petalsAdminName - an Objectname representation of the name of the MBean

setPetalsServersConf

public void setPetalsServersConf(java.util.List<ServerConfiguration> petalsServersConf)
Sets the list of PEtALS servers to a new list.

Parameters:
petalsServersConf - a list of ServerConfiguration representation of the informations of each server

setPropertiesManager

public void setPropertiesManager(ServerPropertiesManager propertiesManager)
Sets the properties manager to a new ServerPropertiesManager

Parameters:
propertiesManager - a ServerPropertiesManager representation of a properties manager

setStorageServerConf

public void setStorageServerConf(ServerConfiguration serverConf)
Sets the configuration of datas storage server

Parameters:
serverConf - a ServerConfiguration containing informations of the JMX Server to set

uninstallComponent

public void uninstallComponent(java.lang.String serverName,
                               java.lang.String compoName)
                        throws javax.management.MBeanException
Uninstall a component on a PEtALS server

Parameters:
serverName - the name of the PEtALS server on which component is installed
compoName - the name of the component to uninstall
Throws:
javax.management.MBeanException

updateExposedServerConf

public void updateExposedServerConf(ServerConfiguration serverConf)
                             throws javax.management.MBeanException
Update a server's configuration in the ServersList mbean on the storage server

Parameters:
serverConf - the new server's configuration
Throws:
javax.management.MBeanException

updateServers

public void updateServers()
                   throws java.io.IOException,
                          javax.management.MBeanException
Update the list of servers petalsServersConf and expose the list on the storage JMX server by retrieving the informations of all servers via a JMX call to the entry server. Update their monitor status after retrieval. If an exception occures while retrieving the monitor status, it stays to null and servers are exposed anyway.

Throws:
java.io.IOException - one of the entry server or the storage server is not reachable
javax.management.MBeanException - re-throwing exception received from exposing servers
javax.management.AttributeNotFoundException

updateListeners

public void updateListeners()
                     throws javax.management.MBeanException
Updates the listeners stored : removes listeners to server unexisting or stopped and adds listeners to new active servers

Throws:
javax.management.MBeanException - an exception occured when trying to create a listener
See Also:
createListener(ServerConfiguration), messagesListeners

createListener

protected void createListener(ServerConfiguration serverConf)
                       throws javax.management.MBeanException
Creates a listener to a server and stores it in the messagesListeners map

Parameters:
serverConf - configuration of the server to listen
Throws:
javax.management.MBeanException - a problem occurs while communicating with the server
See Also:
messagesListeners

getMessagesExchanges

public java.util.Map<java.lang.String,MessageExchange> getMessagesExchanges(java.lang.String serverName)

getMessageExchange

public MessageExchange getMessageExchange(java.lang.String serverName,
                                          java.lang.String exchangeId)

showMessagesInConsole

public void showMessagesInConsole(java.util.List<java.util.Map<java.lang.String,java.lang.Object>> messages)
debug function to see the content of the messages in a list of messages

Parameters:
messages - the list of messages

storeMessages

public void storeMessages(java.util.List<Message> list,
                          java.lang.String notificationNumber)


Copyright © 2005-2007 ObjectWeb Consortium. All Rights Reserved.