Class TaskManager

java.lang.Object
  |
  +--TaskManager
All Implemented Interfaces:
java.util.EventListener, net.jxta.pipe.OutputPipeListener

public class TaskManager
extends java.lang.Object
implements net.jxta.pipe.OutputPipeListener

This class is used to implement the Task Manager that manages the query tasks by maintaining a HashMap structure and manipulating it


Constructor Summary
TaskManager(net.jxta.pipe.PipeService pipeService)
          Constructor : Constructs the task manager
 
Method Summary
 void broadcastPeerDetails()
          Broadcasts peer details to all other peers.
 java.lang.String fileToString(java.lang.String fileName)
          Converts a file to string.
 void inputTask(byte[] im)
          Synchronously adds task to the HashMap to execute them.
static void main(java.lang.String[] args)
           
 void outputPipeEvent(net.jxta.pipe.OutputPipeEvent event)
          The OutputPipeListener event that is triggered when an OutputPipe is resolved by the call to PipeService.createOutputPipe.
 void performTasks()
          Synchronously executes the task queries and the response is stored in HashMap.
 void sendOntology(java.lang.String pipeAdvString, int messageType, java.util.ArrayList peerDetailStructList)
          Sends Ontology to Peer corresponing to parameter PipeAdv with or without PeerDetailStructList.
 void updatePeerTable(java.lang.String pipeAdv, java.lang.String url, java.lang.String nodeName)
          Updates Peer table by adding the details of the new peer to the peer table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskManager

public TaskManager(net.jxta.pipe.PipeService pipeService)
Constructor : Constructs the task manager

Parameters:
pipeService - PipeService created in Server.java
Method Detail

outputPipeEvent

public void outputPipeEvent(net.jxta.pipe.OutputPipeEvent event)
The OutputPipeListener event that is triggered when an OutputPipe is resolved by the call to PipeService.createOutputPipe.

Specified by:
outputPipeEvent in interface net.jxta.pipe.OutputPipeListener
Parameters:
event - the event to use to extract the resolved output pipe.

inputTask

public void inputTask(byte[] im)
Synchronously adds task to the HashMap to execute them.


performTasks

public void performTasks()
Synchronously executes the task queries and the response is stored in HashMap.


sendOntology

public void sendOntology(java.lang.String pipeAdvString,
                         int messageType,
                         java.util.ArrayList peerDetailStructList)
Sends Ontology to Peer corresponing to parameter PipeAdv with or without PeerDetailStructList.


broadcastPeerDetails

public void broadcastPeerDetails()
Broadcasts peer details to all other peers.


fileToString

public java.lang.String fileToString(java.lang.String fileName)
Converts a file to string.

Returns:
String String that is generate from the contents of the file.

main

public static void main(java.lang.String[] args)

updatePeerTable

public void updatePeerTable(java.lang.String pipeAdv,
                            java.lang.String url,
                            java.lang.String nodeName)
Updates Peer table by adding the details of the new peer to the peer table.