service.id
Class IdentificationServiceUDP

java.lang.Object
  extended by service.Service
      extended by service.id.IdentificationServiceUDP
All Implemented Interfaces:
java.lang.Runnable, IIdentification

public class IdentificationServiceUDP
extends Service
implements IIdentification, java.lang.Runnable


Field Summary
protected  java.util.Vector<ProcessIdentifier> identifiers
           
 
Fields inherited from class service.Service
buffer, commElt, dispatcher, myType
 
Fields inherited from interface service.IIdentification
ipGroup, port
 
Constructor Summary
IdentificationServiceUDP()
           
 
Method Summary
 java.util.Vector<ProcessIdentifier> getAllIdentifiers()
           
 ProcessIdentifier getMyIdentifier()
           
 void initialize(MessageDispatcher dispatcher, ICommunication commElt, MessageType myType)
          Initialize the service: register the service on the message dispatcher
 void leaveSystem()
          Leave the system: the identification server remove the current process from the process list identifiers and inform the other processes of the leaving of the current process.
protected  void printIdentifiers()
           
protected  IdentificationData receiveData()
           
 void run()
           
protected  void sendData(IdentificationData data)
           
protected  void sendIdRequestToServer()
           
 void setCommunicationElement(CommunicationElement elt)
           
 
Methods inherited from class service.Service
sendMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

identifiers

protected java.util.Vector<ProcessIdentifier> identifiers
Constructor Detail

IdentificationServiceUDP

public IdentificationServiceUDP()
Method Detail

getMyIdentifier

public ProcessIdentifier getMyIdentifier()
Specified by:
getMyIdentifier in interface IIdentification
Returns:
the identifier of the current process

setCommunicationElement

public void setCommunicationElement(CommunicationElement elt)

getAllIdentifiers

public java.util.Vector<ProcessIdentifier> getAllIdentifiers()
Specified by:
getAllIdentifiers in interface IIdentification
Returns:
the list of identifiers of all processes of the system (excepting the one of the current process)

sendData

protected void sendData(IdentificationData data)

receiveData

protected IdentificationData receiveData()

sendIdRequestToServer

protected void sendIdRequestToServer()

initialize

public void initialize(MessageDispatcher dispatcher,
                       ICommunication commElt,
                       MessageType myType)
Description copied from class: Service
Initialize the service: register the service on the message dispatcher

Overrides:
initialize in class Service
Parameters:
dispatcher - the message dispatcher to use for associating the current service with its type of message
commElt - the communication element to use to send messages to service parts on other processes
myType - the type of the service

printIdentifiers

protected void printIdentifiers()

leaveSystem

public void leaveSystem()
Description copied from interface: IIdentification
Leave the system: the identification server remove the current process from the process list identifiers and inform the other processes of the leaving of the current process.

Specified by:
leaveSystem in interface IIdentification

run

public void run()
Specified by:
run in interface java.lang.Runnable