disciple.core
Class DataDistributor

java.lang.Object
  |
  +--disciple.core.DataDistributor
All Implemented Interfaces:
ResourceConsumer, Service

public class DataDistributor
extends java.lang.Object
implements Service, ResourceConsumer

The role of the DataDistributor is to replicate commands and forward them to the active connections. The DataDistributor holds a list of all connections and knows the status of the connections i.e. connected or disconnected. If a DataDistributionAgent is present, the DataDistributor will use it to preform a selection of connections to forward commands to, based on e.g. user context and preferences, and resource status. The DataDistributor also implements the ResourceConsumer interface, and is listening for changes to the resource parameters.

Copyright (c) 2002 Rutgers, The State University of New Jersey


Field Summary
protected  Connection[] connections_
          The list of connections.
protected  Controller controller_
           
protected  DataDistributionAgent distributionAgent_
           
protected  ReplicationPolicy replicationPolicy_
           
 
Constructor Summary
DataDistributor(Controller controller)
           
 
Method Summary
 void addConnection(Connection connection)
          Adds a connection to the list of connections.
 Connection getConnection(java.lang.Object destination)
          Returns a connection by destination id.
 Connection[] getConnections()
          Returns all connections.
 Controller getController()
           
 DataDistributionAgent getDataDistributionAgent()
           
 ReplicationPolicy getReplicationPolicy()
           
 void removeConnection(Connection connection)
          Removes a connection from the list of connections.
 void resourceParametersChanged(org.w3c.dom.Node parameters)
           
 void send(Command cmd)
          Forwards a command to the active connections, using the DataDistributionAgent to select the connections.
 void send(Command cmd, Connection connection, int priority)
          Forwards a command to an active connection.
 void setController(Controller controller)
           
 void setDataDistributionAgent(DataDistributionAgent agent)
           
 void setReplicationPolicy(ReplicationPolicy policy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

controller_

protected Controller controller_

distributionAgent_

protected DataDistributionAgent distributionAgent_

replicationPolicy_

protected ReplicationPolicy replicationPolicy_

connections_

protected Connection[] connections_
The list of connections. Implemented as an array to optimize performance when iterating through the list of connections.

Constructor Detail

DataDistributor

public DataDistributor(Controller controller)
Rose:
3CF80D860011
Method Detail

send

public void send(Command cmd)
Forwards a command to the active connections, using the DataDistributionAgent to select the connections.

Parameters:
cmd -
Rose:
3CE40A2D01C3

send

public void send(Command cmd,
                 Connection connection,
                 int priority)
Forwards a command to an active connection. The DataDistribution is run to check if connection has a rules regarding the command.

Parameters:
cmd - Command to send.
connection - Connection to send to.
priority - Priority of command.

setDataDistributionAgent

public void setDataDistributionAgent(DataDistributionAgent agent)
Parameters:
agent -
Rose:
3CE40BBF0153

getDataDistributionAgent

public DataDistributionAgent getDataDistributionAgent()
Returns:
disciple.core.DataDistributionAgent
Rose:
3CE40BD0016B

setReplicationPolicy

public void setReplicationPolicy(ReplicationPolicy policy)

getReplicationPolicy

public ReplicationPolicy getReplicationPolicy()
Returns:
disciple.core.DataDistributionAgent

addConnection

public void addConnection(Connection connection)
Adds a connection to the list of connections.

Parameters:
connection -
Rose:
3CF54C5702CC

removeConnection

public void removeConnection(Connection connection)
Removes a connection from the list of connections.

Parameters:
connection -
Rose:
3CF54C520257

getConnection

public Connection getConnection(java.lang.Object destination)
Returns a connection by destination id.

Returns:
the Connection if found, else null

getConnections

public Connection[] getConnections()
Returns all connections.

Returns:
all connection

getController

public Controller getController()
Specified by:
getController in interface Service
Returns:
disciple.core.Controller
Since:
Disciple v3.0
Rose:
3D04CFF3002B

setController

public void setController(Controller controller)
Specified by:
setController in interface Service
Parameters:
controller -
Since:
Disciple v3.0

resourceParametersChanged

public void resourceParametersChanged(org.w3c.dom.Node parameters)
Specified by:
resourceParametersChanged in interface ResourceConsumer
Parameters:
parameters -
Since:
Disciple v3.0
Rose:
3D04CFF30049


Copyright (c) 2003 Rutgers, The State University of New Jersey