fr.dyade.aaa.agent

Class Network

Implemented Interfaces:
MessageConsumer, NetworkMBean
Known Direct Subclasses:
StreamNetwork

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

The Network abstract class provides ..

Field Summary

protected String
bootTSFN
Filename for boot time stamp storage
protected String
domain
The domain name.
protected int
idxLS
Index of local server in status and matrix arrays.
protected Logger
logmon
protected String
name
The component's name as it appears in logging.
protected int
port
The communication port.
protected fr.dyade.aaa.agent.MessageVector
qout
The MessageVector associated with this network component.
protected short[]
servers
List of id.
protected String
serversFN
Filename for servers storage
protected short
sid
Id.

Constructor Summary

Network()
Creates a new network component.

Method Summary

void
delete()
This operation always throws an IllegalStateException.
protected void
deliver(fr.dyade.aaa.agent.Message msg)
Try to deliver the received message to the right consumer.
String
getDomainName()
Returns the corresponding domain's name.
String
getName()
Returns this session's name.
int
getPort()
fr.dyade.aaa.agent.MessageQueue
getQueue()
protected int
index(short id)
Returns the index in internal table of the specified server.
void
init(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
post(fr.dyade.aaa.agent.Message msg)
Adds a message in "ready to deliver" list.
void
restore()
Restores component's information from persistent storage.
void
save()
Saves information to persistent storage.
void
setPort(int port)
Updates the network port.
String
toString()
Returns a string representation of this consumer.
void
validate()
Validates all messages pushed in queue during transaction session.

Field Details

bootTSFN

protected String bootTSFN
Filename for boot time stamp storage


domain

protected String domain
The domain name.


idxLS

protected int idxLS
Index of local server in status and matrix arrays.


logmon

protected Logger logmon


name

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


port

protected int port
The communication port.


qout

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


servers

protected short[] servers
List of id. for all servers in the domain, this list is sorted and is used as index for internal tables.


serversFN

protected String serversFN
Filename for servers storage


sid

protected short sid
Id. of local server.

Constructor Details

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 Details

delete

public void delete()
            throws IllegalStateException
This operation always throws an IllegalStateException.
Specified by:
delete in interface MessageConsumer


deliver

protected void deliver(fr.dyade.aaa.agent.Message msg)
            throws Exception
Try to deliver the received message to the right consumer.

Parameters:
msg - the message.


getDomainName

public final String getDomainName()
Returns the corresponding domain's name.
Specified by:
getDomainName in interface MessageConsumer

Returns:
this domain's name.


getName

public final String getName()
Returns this session's name.
Specified by:
getName in interface MessageConsumer
getName in interface NetworkMBean

Returns:
this session's name.


getPort

public final int getPort()


getQueue

public fr.dyade.aaa.agent.MessageQueue getQueue()
Specified by:
getQueue in interface MessageConsumer


index

protected final int index(short id)
Returns the index in internal table of the specified server. The servers array must be ordered.

Parameters:
id - the unique server id.


init

public void init(String name,
                 int port,
                 short[] servers)
            throws 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.


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


post

public void post(fr.dyade.aaa.agent.Message msg)
            throws 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


restore

public void restore()
            throws Exception
Restores component's information from persistent storage. If it is the first load, initializes it.
Specified by:
restore in interface MessageConsumer


save

public void save()
            throws IOException
Saves information to persistent storage.
Specified by:
save in interface MessageConsumer


setPort

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


toString

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

Returns:
A string representation of this consumer.


validate

public void validate()
Validates all messages pushed in queue during transaction session.
Specified by:
validate in interface MessageConsumer


Copyright B) 2004 Scalagent - All rights reserved