fr.dyade.aaa.agent
Class Network

java.lang.Object
  extended byfr.dyade.aaa.agent.Network
All Implemented Interfaces:
MessageConsumer, NetworkMBean
Direct Known Subclasses:
StreamNetwork

public abstract class Network
extends java.lang.Object
implements MessageConsumer, NetworkMBean

The Network abstract class provides ..


Field Summary
protected  fr.dyade.aaa.agent.LogicalClock clock
          The logical clock associated to this network component.
protected  java.lang.String domain
          The domain name.
protected  org.objectweb.util.monolog.api.Logger logmon
           
protected  java.lang.String name
          The component's name as it appears in logging.
protected  Network network
          Reference to the current network component in order to be used by inner daemon's.
protected  int port
          The communication port.
protected  fr.dyade.aaa.agent.MessageQueue qout
          The MessageQueue associated with this network component.
protected  java.util.Vector waiting
          The waiting list: it contains all messages that waiting to be delivered.
 
Constructor Summary
Network()
          Creates a new network component.
 
Method Summary
 void addServer(short sid)
           
 void delServer(short sid)
           
 java.lang.String getDomainName()
          Returns the corresponding domain's name.
 java.lang.String getName()
          Returns this session's name.
 int getPort()
           
 fr.dyade.aaa.agent.MessageQueue getQueue()
          Get this consumer's MessageQueue.
 void init(java.lang.String name, int port, short[] servers)
          Initializes a new network component.
 void insert(fr.dyade.aaa.agent.Message msg)
          Insert a message in the MessageQueue.
 void invalidate()
          Invalidates all messages pushed in queue during transaction session.
 void post(fr.dyade.aaa.agent.Message msg)
          Adds a message in "ready to deliver" list.
 void restore()
          Restores logical clock information from persistent storage.
 void save()
          Saves logical clock information to persistent storage.
 void setPort(int port)
          Updates the network port.
 java.lang.String toString()
          Returns a string representation of this consumer.
 void validate()
          Validates all messages pushed in queue during transaction session.
abstract  void wakeup()
          Wakes up the watch-dog thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface fr.dyade.aaa.agent.MessageConsumer
isRunning, start, stop
 
Methods inherited from interface fr.dyade.aaa.agent.NetworkMBean
isRunning, start, stop
 

Field Detail

logmon

protected org.objectweb.util.monolog.api.Logger logmon

network

protected Network network
Reference to the current network component in order to be used by inner daemon's.


name

protected java.lang.String name
The component's name as it appears in logging.


domain

protected java.lang.String domain
The domain name.


port

protected int port
The communication port.


qout

protected fr.dyade.aaa.agent.MessageQueue qout
The MessageQueue associated with this network component.


clock

protected fr.dyade.aaa.agent.LogicalClock clock
The logical clock associated to this network component.


waiting

protected java.util.Vector waiting
The waiting list: it contains all messages that waiting to be delivered.

Constructor Detail

Network

public Network()
Creates a new network component. This simple constructor is required in order to use Class.newInstance() method during configuration. The configuration of component is then done by init method.

Method Detail

getName

public final java.lang.String getName()
Returns this session's name.

Specified by:
getName in interface MessageConsumer
Returns:
this session's name.

getDomainName

public final java.lang.String getDomainName()
Returns the corresponding domain's name.

Specified by:
getDomainName in interface MessageConsumer
Returns:
this domain's name.

toString

public java.lang.String toString()
Returns a string representation of this consumer.

Returns:
A string representation of this consumer.

insert

public void insert(fr.dyade.aaa.agent.Message msg)
Insert a message in the MessageQueue. This method is used during initialisation to restore the component state from persistent storage.

Specified by:
insert in interface MessageConsumer
Parameters:
msg - the message

save

public void save()
          throws java.io.IOException
Saves logical clock information to persistent storage.

Specified by:
save in interface MessageConsumer
Throws:
java.io.IOException

restore

public void restore()
             throws java.lang.Exception
Restores logical clock information from persistent storage.

Specified by:
restore in interface MessageConsumer
Throws:
java.lang.Exception

init

public void init(java.lang.String name,
                 int port,
                 short[] servers)
          throws java.lang.Exception
Initializes a new network component. This method is used in order to easily creates and configure a Network component from a class name. So we can use the Class.newInstance() method for create (whitout any parameter) the component, then we can initialize it with this method.
This method initializes the logical clock for the domain.

Parameters:
name - The domain name.
port - The listen port.
servers - The list of servers directly accessible from this network interface.
Throws:
java.lang.Exception

addServer

public void addServer(short sid)
               throws java.lang.Exception
Throws:
java.lang.Exception

delServer

public void delServer(short sid)
               throws java.lang.Exception
Throws:
java.lang.Exception

post

public void post(fr.dyade.aaa.agent.Message msg)
          throws java.lang.Exception
Adds a message in "ready to deliver" list. This method allocates a new time stamp to the message ; be Careful, changing the stamp imply the filename change too.

Specified by:
post in interface MessageConsumer
Throws:
java.lang.Exception

validate

public void validate()
Validates all messages pushed in queue during transaction session.

Specified by:
validate in interface MessageConsumer

invalidate

public void invalidate()
Invalidates all messages pushed in queue during transaction session.

Specified by:
invalidate in interface MessageConsumer

getQueue

public fr.dyade.aaa.agent.MessageQueue getQueue()
Description copied from interface: MessageConsumer
Get this consumer's MessageQueue. Use in administration and debug tasks, should be replaced by a common attribute.

Specified by:
getQueue in interface MessageConsumer
Returns:
this MessageConsumer's queue.

wakeup

public abstract void wakeup()
Wakes up the watch-dog thread.


setPort

public void setPort(int port)
Updates the network port.


getPort

public final int getPort()


Copyright © 2004 Scalagent - All rights reserved