fr.dyade.aaa.agent
Class Network

java.lang.Object
  extended by fr.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. for all servers in the domain, this list is sorted and is used as index for internal tables.
protected  java.lang.String serversFN
          Filename for servers storage
protected  short sid
          Id. of local server.
 
Constructor Summary
Network()
          Creates a new network component.
 
Method Summary
 void delete()
          Deletes the component, removes all persistent datas.
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  byte[] getStamp()
           
 long getWDActivationPeriod()
          Gets the WDActivationPeriod value.
 int getWDNbRetryLevel1()
          Gets the WDNbRetryLevel1 value.
 int getWDNbRetryLevel2()
          Gets the WDNbRetryLevel2 value.
 long getWDRetryPeriod1()
          Gets the WDRetryPeriod1 value.
 long getWDRetryPeriod2()
          Gets the WDRetryPeriod2 value.
 long getWDRetryPeriod3()
          Gets the WDRetryPeriod3 value.
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.
protected  void setStamp(byte[] stampbuf)
           
 void setWDActivationPeriod(long WDActivationPeriod)
          Sets the WDActivationPeriod value.
 void setWDNbRetryLevel1(int WDNbRetryLevel1)
          Sets the WDNbRetryLevel1 value.
 void setWDNbRetryLevel2(int WDNbRetryLevel2)
          Sets the WDNbRetryLevel2 value.
 void setWDRetryPeriod1(long WDRetryPeriod1)
          Sets the WDRetryPeriod1 value.
 void setWDRetryPeriod2(long WDRetryPeriod2)
          Sets the WDRetryPeriod2 value.
 void setWDRetryPeriod3(long WDRetryPeriod3)
          Sets the WDRetryPeriod3 value.
 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

getWDActivationPeriod

public long getWDActivationPeriod()
Gets the WDActivationPeriod value.

Specified by:
getWDActivationPeriod in interface NetworkMBean
Returns:
the WDActivationPeriod value

setWDActivationPeriod

public void setWDActivationPeriod(long WDActivationPeriod)
Sets the WDActivationPeriod value.

Specified by:
setWDActivationPeriod in interface NetworkMBean
Parameters:
WDActivationPeriod - the WDActivationPeriod value

getWDNbRetryLevel1

public int getWDNbRetryLevel1()
Gets the WDNbRetryLevel1 value.

Specified by:
getWDNbRetryLevel1 in interface NetworkMBean
Returns:
the WDNbRetryLevel1 value

setWDNbRetryLevel1

public void setWDNbRetryLevel1(int WDNbRetryLevel1)
Sets the WDNbRetryLevel1 value.

Specified by:
setWDNbRetryLevel1 in interface NetworkMBean
Parameters:
WDNbRetryLevel1 - the WDNbRetryLevel1 value

getWDRetryPeriod1

public long getWDRetryPeriod1()
Gets the WDRetryPeriod1 value.

Specified by:
getWDRetryPeriod1 in interface NetworkMBean
Returns:
the WDRetryPeriod1 value

setWDRetryPeriod1

public void setWDRetryPeriod1(long WDRetryPeriod1)
Sets the WDRetryPeriod1 value.

Specified by:
setWDRetryPeriod1 in interface NetworkMBean
Parameters:
WDRetryPeriod1 - the WDRetryPeriod1 value

getWDNbRetryLevel2

public int getWDNbRetryLevel2()
Gets the WDNbRetryLevel2 value.

Specified by:
getWDNbRetryLevel2 in interface NetworkMBean
Returns:
the WDNbRetryLevel2 value

setWDNbRetryLevel2

public void setWDNbRetryLevel2(int WDNbRetryLevel2)
Sets the WDNbRetryLevel2 value.

Specified by:
setWDNbRetryLevel2 in interface NetworkMBean
Parameters:
WDNbRetryLevel2 - the WDNbRetryLevel2 value

getWDRetryPeriod2

public long getWDRetryPeriod2()
Gets the WDRetryPeriod2 value.

Specified by:
getWDRetryPeriod2 in interface NetworkMBean
Returns:
the WDRetryPeriod2 value

setWDRetryPeriod2

public void setWDRetryPeriod2(long WDRetryPeriod2)
Sets the WDRetryPeriod2 value.

Specified by:
setWDRetryPeriod2 in interface NetworkMBean
Parameters:
WDRetryPeriod2 - the WDRetryPeriod2 value

getWDRetryPeriod3

public long getWDRetryPeriod3()
Gets the WDRetryPeriod3 value.

Specified by:
getWDRetryPeriod3 in interface NetworkMBean
Returns:
the WDRetryPeriod3 value

setWDRetryPeriod3

public void setWDRetryPeriod3(long WDRetryPeriod3)
Sets the WDRetryPeriod3 value.

Specified by:
setWDRetryPeriod3 in interface NetworkMBean
Parameters:
WDRetryPeriod3 - the WDRetryPeriod3 value

getName

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

Specified by:
getName in interface MessageConsumer
Specified by:
getName in interface NetworkMBean
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.

Specified by:
toString in interface NetworkMBean
Overrides:
toString in class java.lang.Object
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.

getStamp

protected final byte[] getStamp()

setStamp

protected final void setStamp(byte[] stampbuf)

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

delete

public void delete()
            throws java.lang.IllegalStateException
Deletes the component, removes all persistent datas. The component may have been previously stopped, and removed from MessageConsumer list. This operation use Transaction calls, you may use commit to validate it.

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

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.

setPort

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


getPort

public final int getPort()


Copyright © 2004 Scalagent - All rights reserved