org.livetribe.slp.api.da
Class StandardDirectoryAgent

java.lang.Object
  extended by org.livetribe.slp.api.StandardAgent
      extended by org.livetribe.slp.api.da.StandardDirectoryAgent
All Implemented Interfaces:
Agent, DirectoryAgent

public class StandardDirectoryAgent
extends StandardAgent
implements DirectoryAgent

Implementation of an SLP DirectoryAgent.

Version:
$Rev: 258 $ $Date: 2006-08-23 15:45:17 +0200 (Wed, 23 Aug 2006) $

Field Summary
 
Fields inherited from class org.livetribe.slp.api.StandardAgent
logger
 
Constructor Summary
StandardDirectoryAgent()
           
 
Method Summary
protected  void configureDirectoryAgentManager(DirectoryAgentManager daManager)
           
protected  DirectoryAgentManager createDirectoryAgentManager()
           
protected  edu.emory.mathcs.backport.java.util.concurrent.ScheduledExecutorService createScheduledExecutorService()
          Creates and returns the default ScheduledExecutorService, configured to use one daemon thread.
protected  void doStart()
           
protected  void doStop()
           
 int getAdvertisementPeriod()
          Returns the period of time, in seconds, between unsolicited DAAdverts.
 Attributes getAttributes()
           
 long getBootTime()
          Returns the POSIX time of the boot of this DirectoryAgent, in milliseconds.
 InetAddress getInetAddress()
           
 int getServiceExpirationPeriod()
          Returns the period, in seconds, between checks to remove expired services.
 Collection getServices()
           
protected  void handleMulticastSrvRqst(SrvRqst message, InetSocketAddress address)
           
protected  void handleTCPSrvDeReg(SrvDeReg message, Socket socket)
           
protected  void handleTCPSrvReg(SrvReg message, Socket socket)
           
protected  void handleTCPSrvRqst(SrvRqst message, Socket socket)
           
 boolean isPeriodicAdvertisementEnabled()
          Returns whether this DirectoryAgent sends periodically unsolicited DAAdverts to advertise its presence.
 boolean isPeriodicServiceExpirationEnabled()
          Returns whether this DirectoryAgent periodically checks for service expiration, to remove expired services.
 void setAdvertisementPeriod(int advertisementPeriod)
          Sets the period of time, in seconds, between unsolicited DAAdverts.
 void setAttributes(Attributes attributes)
           
 void setDirectoryAgentManager(DirectoryAgentManager manager)
           
 void setInetAddress(InetAddress address)
           
 void setPeriodicAdvertisementEnabled(boolean periodicAdvertisement)
          Sets whether this DirectoryAgent sends periodically unsolicited DAAdverts to advertise its presence.
 void setPeriodicServiceExpirationEnabled(boolean periodicServiceExpiration)
          Sets whether this DirectoryAgent periodically checks for service expiration, to remove expired services.
 void setScheduledExecutorService(edu.emory.mathcs.backport.java.util.concurrent.ScheduledExecutorService scheduledExecutorService)
          Sets the ScheduledExecutorService used to perform periodic tasks such as sending unsolicited DAAdverts or to check if services' lifetime are expired.
 void setServiceExpirationPeriod(int serviceExpirationPeriod)
          Sets the period, in seconds, between checks to remove expired services
 
Methods inherited from class org.livetribe.slp.api.StandardAgent
getPort, getScopes, isRunning, setPort, setScopes, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.livetribe.slp.api.Agent
isRunning, setScopes, start, stop
 

Constructor Detail

StandardDirectoryAgent

public StandardDirectoryAgent()
Method Detail

setDirectoryAgentManager

public void setDirectoryAgentManager(DirectoryAgentManager manager)
Specified by:
setDirectoryAgentManager in interface DirectoryAgent

setScheduledExecutorService

public void setScheduledExecutorService(edu.emory.mathcs.backport.java.util.concurrent.ScheduledExecutorService scheduledExecutorService)
Sets the ScheduledExecutorService used to perform periodic tasks such as sending unsolicited DAAdverts or to check if services' lifetime are expired.

See Also:
createScheduledExecutorService()

setAttributes

public void setAttributes(Attributes attributes)

getAttributes

public Attributes getAttributes()

getAdvertisementPeriod

public int getAdvertisementPeriod()
Returns the period of time, in seconds, between unsolicited DAAdverts.

See Also:
setAdvertisementPeriod(int), isPeriodicAdvertisementEnabled()

setAdvertisementPeriod

public void setAdvertisementPeriod(int advertisementPeriod)
Sets the period of time, in seconds, between unsolicited DAAdverts.

See Also:
getAdvertisementPeriod(), isPeriodicAdvertisementEnabled()

isPeriodicAdvertisementEnabled

public boolean isPeriodicAdvertisementEnabled()
Returns whether this DirectoryAgent sends periodically unsolicited DAAdverts to advertise its presence. By default, DirectoryAgents advertise their presence.

See Also:
setPeriodicAdvertisementEnabled(boolean), getAdvertisementPeriod()

setPeriodicAdvertisementEnabled

public void setPeriodicAdvertisementEnabled(boolean periodicAdvertisement)
Sets whether this DirectoryAgent sends periodically unsolicited DAAdverts to advertise its presence.

See Also:
isPeriodicAdvertisementEnabled(), getAdvertisementPeriod()

isPeriodicServiceExpirationEnabled

public boolean isPeriodicServiceExpirationEnabled()
Returns whether this DirectoryAgent periodically checks for service expiration, to remove expired services.

See Also:
setPeriodicServiceExpirationEnabled(boolean), getServiceExpirationPeriod()

setPeriodicServiceExpirationEnabled

public void setPeriodicServiceExpirationEnabled(boolean periodicServiceExpiration)
Sets whether this DirectoryAgent periodically checks for service expiration, to remove expired services.

See Also:
isPeriodicServiceExpirationEnabled(), getServiceExpirationPeriod()

getServiceExpirationPeriod

public int getServiceExpirationPeriod()
Returns the period, in seconds, between checks to remove expired services.

See Also:
setServiceExpirationPeriod(int), isPeriodicServiceExpirationEnabled()

setServiceExpirationPeriod

public void setServiceExpirationPeriod(int serviceExpirationPeriod)
Sets the period, in seconds, between checks to remove expired services

See Also:
getServiceExpirationPeriod(), isPeriodicServiceExpirationEnabled()

getInetAddress

public InetAddress getInetAddress()

setInetAddress

public void setInetAddress(InetAddress address)

getBootTime

public long getBootTime()
Returns the POSIX time of the boot of this DirectoryAgent, in milliseconds.


getServices

public Collection getServices()

doStart

protected void doStart()
                throws IOException
Specified by:
doStart in class StandardAgent
Throws:
IOException

createDirectoryAgentManager

protected DirectoryAgentManager createDirectoryAgentManager()

configureDirectoryAgentManager

protected void configureDirectoryAgentManager(DirectoryAgentManager daManager)

createScheduledExecutorService

protected edu.emory.mathcs.backport.java.util.concurrent.ScheduledExecutorService createScheduledExecutorService()
Creates and returns the default ScheduledExecutorService, configured to use one daemon thread.


doStop

protected void doStop()
               throws IOException
Specified by:
doStop in class StandardAgent
Throws:
IOException

handleMulticastSrvRqst

protected void handleMulticastSrvRqst(SrvRqst message,
                                      InetSocketAddress address)
                               throws ServiceLocationException
Throws:
ServiceLocationException

handleTCPSrvReg

protected void handleTCPSrvReg(SrvReg message,
                               Socket socket)

handleTCPSrvDeReg

protected void handleTCPSrvDeReg(SrvDeReg message,
                                 Socket socket)

handleTCPSrvRqst

protected void handleTCPSrvRqst(SrvRqst message,
                                Socket socket)
                         throws ServiceLocationException
Throws:
ServiceLocationException


Copyright © 2006-2012 LiveTribe. All Rights Reserved.