infoservice
Class UpdateInformationHandler

java.lang.Object
  extended by infoservice.UpdateInformationHandler
All Implemented Interfaces:
java.lang.Runnable

public class UpdateInformationHandler
extends java.lang.Object
implements java.lang.Runnable

Manages the propaganda of the JAP update information.


Field Summary
private static UpdateInformationHandler ms_uihInstance
          Stores the instance of UpdateInformationHandler (Singleton).
 
Constructor Summary
private UpdateInformationHandler()
          Creates a new instance of UpdateInformationHandler.
 
Method Summary
static UpdateInformationHandler getInstance()
          Returns the instance of UpdateInformationHandler (Singleton).
private  void prepareEntryForPropaganda(org.w3c.dom.Element a_entryRootElement)
          This prepares a JAP update information entry read from the local filesystem for propaganda within the infoservice network.
private  byte[] readLocalFile(java.lang.String a_fileName)
          Reads a file from local filesystem and returns the data.
 void run()
          This is the propaganda thread for all JAP update specific information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ms_uihInstance

private static UpdateInformationHandler ms_uihInstance
Stores the instance of UpdateInformationHandler (Singleton).

Constructor Detail

UpdateInformationHandler

private UpdateInformationHandler()
Creates a new instance of UpdateInformationHandler.

Method Detail

getInstance

public static UpdateInformationHandler getInstance()
Returns the instance of UpdateInformationHandler (Singleton). If there is no instance, there is a new one created, also the included thread is started.

Returns:
The UpdateInformationHandler instance.

run

public void run()
This is the propaganda thread for all JAP update specific information. It posts the current JAP update information periodically (default: 10 minutes, see Constants.UPDATE_INFORMATION_ANNOUNCE_PERIOD) to all neighbour infoservices. Also it reads the information from the local filesystem, if this is the root-of-update information infoservice.

Specified by:
run in interface java.lang.Runnable

readLocalFile

private byte[] readLocalFile(java.lang.String a_fileName)
Reads a file from local filesystem and returns the data.

Parameters:
a_fileName - The file to read (path + filename).
Returns:
The data read from the file or null, if there was an error.

prepareEntryForPropaganda

private void prepareEntryForPropaganda(org.w3c.dom.Element a_entryRootElement)
This prepares a JAP update information entry read from the local filesystem for propaganda within the infoservice network. The LastUpdate timestamp will be updated and the whole structure is signed with the update messages certificate. This method is only necessary within the root-of-update-information infoservice.

Parameters:
a_entryRootElement - The root node of the update entry to prepare.