org.objectweb.jonas.discovery
Class DiscoveryServiceImpl

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.objectweb.jonas.management.ReconfigDispatcher
          extended by org.objectweb.jonas.service.AbsServiceImpl
              extended by org.objectweb.jonas.discovery.DiscoveryServiceImpl
All Implemented Interfaces:
javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, DiscoveryService, DiscoveryServiceImplMBean, ReconfigDispatcherMBean, Service

public class DiscoveryServiceImpl
extends AbsServiceImpl
implements DiscoveryService, DiscoveryServiceImplMBean

Author:
Adriana Danes The discovery service creates and starts at least a DiscoveryManager which is a MBean that multicasts discovery information to all the servers who joined the discovery multicast group.

The discovery service may also create a Enroller and a DiscoveryClient, and in this case the current server becomes a discovery server.

Discovery information contains information allowing to remotely manage a server in the group.

Discovery multicast group is a group of servers which can be managed remotely by a discovery server.

Discovery server is the server in the group who detains the discovery information concerning all the servers in the group.


Field Summary
 
Fields inherited from class org.objectweb.jonas.management.ReconfigDispatcher
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Constructor Summary
DiscoveryServiceImpl()
           
 
Method Summary
protected  void doInit(javax.naming.Context ctx)
          Initialize the discovery service
protected  void doStart()
          Start the discovery service
protected  void doStop()
          Abstract method for service stopping to be implemented by sub-classes
 DiscEvent getDiscEvent(java.lang.String serverName, java.lang.String domainName, java.lang.String[] connectorURLs, java.lang.String state)
          Create a 'fake' DiscEvent object containing info to establish a JMX connection with a new server in the domain
 java.lang.String getDiscoveryProtocolVersion()
           
 java.lang.String getDiscoveryTtl()
           
 Enroller getEnroller()
           
 java.lang.Boolean getIsDiscoveryMaster()
           
 java.lang.String getMulticastAddress()
           
 java.lang.String getMulticastPort()
           
 void startDiscoveryMaster()
          Management operation allowing to make the current server become a master if its not already.
 
Methods inherited from class org.objectweb.jonas.service.AbsServiceImpl
getDomainName, getJonasServerName, getName, init, isStarted, setName, start, stop
 
Methods inherited from class org.objectweb.jonas.management.ReconfigDispatcher
addNotificationListener, getFilter, getHandback, getListener, getNotificationInfo, initLogger, removeNotificationListener, sendReconfigNotification, sendSaveNotification
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
handleNotification, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jonas.service.Service
getName, init, isStarted, setName, start, stop
 

Constructor Detail

DiscoveryServiceImpl

public DiscoveryServiceImpl()
Method Detail

getMulticastAddress

public java.lang.String getMulticastAddress()
Specified by:
getMulticastAddress in interface DiscoveryServiceImplMBean
Returns:
the multicast group IP address used by the discovery service

getMulticastPort

public java.lang.String getMulticastPort()
Specified by:
getMulticastPort in interface DiscoveryServiceImplMBean
Returns:
the multicast group port number used by the discovery service

getIsDiscoveryMaster

public java.lang.Boolean getIsDiscoveryMaster()
Specified by:
getIsDiscoveryMaster in interface DiscoveryServiceImplMBean
Returns:
true if the current server is a discovery server

startDiscoveryMaster

public void startDiscoveryMaster()
                          throws javax.management.JMException
Management operation allowing to make the current server become a master if its not already.

Specified by:
startDiscoveryMaster in interface DiscoveryServiceImplMBean
Throws:
javax.management.JMException - a JMX exception occured when trying to make current server a discovery master

doInit

protected void doInit(javax.naming.Context ctx)
               throws ServiceException
Initialize the discovery service

Specified by:
doInit in class AbsServiceImpl
Parameters:
ctx - context containing initialization parameters
Throws:
discovery - service could not be correctly initialized
ServiceException - service initialization failed

doStart

protected void doStart()
                throws ServiceException
Start the discovery service

Specified by:
doStart in class AbsServiceImpl
Throws:
ServiceException - An error occured when starting the service

doStop

protected void doStop()
               throws ServiceException
Description copied from class: AbsServiceImpl
Abstract method for service stopping to be implemented by sub-classes

Specified by:
doStop in class AbsServiceImpl
Throws:
ServiceException - service stopping failed

getEnroller

public Enroller getEnroller()
Returns:
Returns the enroller.

getDiscEvent

public DiscEvent getDiscEvent(java.lang.String serverName,
                              java.lang.String domainName,
                              java.lang.String[] connectorURLs,
                              java.lang.String state)
Create a 'fake' DiscEvent object containing info to establish a JMX connection with a new server in the domain

Parameters:
serverName - the OBJECT_NAME of the server MBean corresponding to the server to connect
domainName - the JOnAS server's domain name
connectorURLs - the urls of the connector server of the server to connect
state - the state of the server (RUNNING in case the DiscEvent is used to add a server; could be STOPPING if the DiscEvent is used to remove a server)
Returns:
a new DiscEvent object

getDiscoveryProtocolVersion

public java.lang.String getDiscoveryProtocolVersion()
Specified by:
getDiscoveryProtocolVersion in interface DiscoveryServiceImplMBean
Returns:
the discovery protocol version number

getDiscoveryTtl

public java.lang.String getDiscoveryTtl()
Specified by:
getDiscoveryTtl in interface DiscoveryServiceImplMBean
Returns:
the time-to-live of the discovery multicast