org.ow2.jonas.discovery.internal.client
Class DiscoveryClient

java.lang.Object
  extended by org.ow2.jonas.discovery.internal.client.DiscoveryClient
All Implemented Interfaces:
MBeanRegistration, DiscoveryClientMBean, EnrollerMBean

public class DiscoveryClient
extends Object
implements DiscoveryClientMBean, MBeanRegistration

The DiscoveryClient is in charge of sending discovery messages on the LAN to discover resources. It waits during a Timeout period of time for the discovery answers (discovery messages containing a response).

Version:
1.0
Author:
Takoua Abdellatif

Constructor Summary
DiscoveryClient(int listeningPort, String listeningIP, int sourcePort)
          Creates a new Discovery client.
 
Method Summary
 String getListeningIp()
           
 int getListeningPort()
          gets the port on which the Enroller is listening for a discovery request.
 String getSourceIp()
          Gets the source port
 int getSourcePort()
          Gets the source port that the discovery response has to use.
 int getTimeout()
          gets the duration time the DiscoveryClient has to wait for discovery answers.
 int getTimeToLive()
          gets the time to live of the multicast socket.
 void postDeregister()
           
 void postRegister(Boolean arg0)
           
 void preDeregister()
           
 ObjectName preRegister(MBeanServer mbeanServer, ObjectName on)
           
 void setListeningIp(String ipAddress)
          sets the IP address the listening manager uses.
 void setListeningPort(int listeningPort)
          sets the port on which the Enroller is listening.
 void setSourceIp(String sourceIp)
          Sets the source Ip
 void setSourcePort(int sourcePort)
          Sets the source port
 void setTimeout(int timeout)
          Sets the timeout value the DiscoveryClient for receiving discovery answers.
 void setTimeToLive(int ttl)
          sets the time to live value to ttl.
 void start()
          starts the listening task on the listeningPort and listening Ip defined with the parameters.
 void stop()
          stops the listening task
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscoveryClient

public DiscoveryClient(int listeningPort,
                       String listeningIP,
                       int sourcePort)
Creates a new Discovery client.

Parameters:
listeningPort -
listeningIP -
sourcePort -
Method Detail

getTimeout

public int getTimeout()
Description copied from interface: DiscoveryClientMBean
gets the duration time the DiscoveryClient has to wait for discovery answers.

Specified by:
getTimeout in interface DiscoveryClientMBean
Returns:
timeout value.

setTimeout

public void setTimeout(int timeout)
Description copied from interface: DiscoveryClientMBean
Sets the timeout value the DiscoveryClient for receiving discovery answers.

Specified by:
setTimeout in interface DiscoveryClientMBean

getListeningPort

public int getListeningPort()
Description copied from interface: EnrollerMBean
gets the port on which the Enroller is listening for a discovery request.

Specified by:
getListeningPort in interface EnrollerMBean
Returns:
notification port.

setListeningPort

public void setListeningPort(int listeningPort)
Description copied from interface: EnrollerMBean
sets the port on which the Enroller is listening.

Specified by:
setListeningPort in interface EnrollerMBean
Parameters:
listeningPort - port on which the Enroller is listening.

getListeningIp

public String getListeningIp()
Specified by:
getListeningIp in interface EnrollerMBean
Returns:
IP address the Enroller uses.

setListeningIp

public void setListeningIp(String ipAddress)
Description copied from interface: EnrollerMBean
sets the IP address the listening manager uses.

Specified by:
setListeningIp in interface EnrollerMBean

getSourcePort

public int getSourcePort()
Description copied from interface: DiscoveryClientMBean
Gets the source port that the discovery response has to use.

Specified by:
getSourcePort in interface DiscoveryClientMBean
Returns:
source port

setSourcePort

public void setSourcePort(int sourcePort)
Description copied from interface: DiscoveryClientMBean
Sets the source port

Specified by:
setSourcePort in interface DiscoveryClientMBean

getSourceIp

public String getSourceIp()
Description copied from interface: DiscoveryClientMBean
Gets the source port

Specified by:
getSourceIp in interface DiscoveryClientMBean
Returns:
the source port

getTimeToLive

public int getTimeToLive()
Description copied from interface: EnrollerMBean
gets the time to live of the multicast socket.

Specified by:
getTimeToLive in interface EnrollerMBean
Returns:
ttl value.

setSourceIp

public void setSourceIp(String sourceIp)
Description copied from interface: DiscoveryClientMBean
Sets the source Ip

Specified by:
setSourceIp in interface DiscoveryClientMBean

setTimeToLive

public void setTimeToLive(int ttl)
Description copied from interface: EnrollerMBean
sets the time to live value to ttl. Defines the number of hops the multicast socket does.

Specified by:
setTimeToLive in interface EnrollerMBean
Parameters:
ttl - time to live

start

public void start()
Description copied from interface: EnrollerMBean
starts the listening task on the listeningPort and listening Ip defined with the parameters.

Specified by:
start in interface EnrollerMBean

stop

public void stop()
Description copied from interface: EnrollerMBean
stops the listening task

Specified by:
stop in interface EnrollerMBean

preRegister

public ObjectName preRegister(MBeanServer mbeanServer,
                              ObjectName on)
Specified by:
preRegister in interface MBeanRegistration
See Also:
MBeanRegistration.preRegister(javax.management.MBeanServer, javax.management.ObjectName)

postRegister

public void postRegister(Boolean arg0)
Specified by:
postRegister in interface MBeanRegistration
See Also:
MBeanRegistration.postRegister(java.lang.Boolean)

preDeregister

public void preDeregister()
                   throws Exception
Specified by:
preDeregister in interface MBeanRegistration
Throws:
Exception
See Also:
MBeanRegistration.preDeregister()

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface MBeanRegistration
See Also:
MBeanRegistration.postDeregister()


Copyright © 2010 OW2 Consortium. All Rights Reserved.