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  java.lang.String bootTSFN
          Filename for boot time stamp storage
protected  java.lang.String domain
          The domain name.
protected  int idxLS
          Index of local server in status and matrix arrays.
protected  org.objectweb.util.monolog.api.Logger logmon
           
protected  java.lang.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  java.lang.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.
 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.
protected  int index(short id)
          Returns the index in internal table of the specified server.
 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 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.
 java.lang.String toString()
          Returns a string representation of this consumer.
 void validate()
          Validates all messages pushed in queue during transaction session.
 
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

sid

protected short sid
Id. of local server.


idxLS

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


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 transient java.lang.String serversFN
Filename for servers storage


bootTSFN

protected transient java.lang.String bootTSFN
Filename for boot time stamp storage


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.MessageVector qout
The MessageVector associated with this network component.

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 information to persistent storage.

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

restore

public void restore()
             throws java.lang.Exception
Restores component's information from persistent storage. If it is the first load, initializes it.

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

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

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.

deliver

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

Parameters:
msg - the message.
Throws:
java.lang.Exception

validate

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

Specified by:
validate 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.

delete

public void delete()
            throws java.lang.IllegalStateException
This operation always throws an IllegalStateException.

Specified by:
delete in interface MessageConsumer
Throws:
java.lang.IllegalStateException
See Also:
Transaction

setPort

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


getPort

public final int getPort()


Copyright ? 2004 Scalagent - All rights reserved