Lightweight Bartering Grid

lbg.searchengine
Class SearchEngineServer

java.lang.Object
  extended by lbg.searchengine.SearchEngineServer
Direct Known Subclasses:
LiveSearchEngineServer, SimulatedSearchEngineServer

public abstract class SearchEngineServer
extends java.lang.Object

Search Engine server.

Since:
2007-03-21
Author:
Xavier Dalem
To do:
Optimize getHandles() with a "dirty" flag

Field Summary
 java.lang.String hostname
          Search engine hostname
 java.lang.String id
          Search engine ID
 int port
          Search engine port
static java.util.logging.Logger SELOGGER
           
 int timeout
          Search engine cache refresh timeout
 
Method Summary
 boolean add(ExternalPeerHandle handle)
          Adds a handle to this search engine.
 SearchEngineResponse getHandles()
           
 SearchEngineResponse getHandles(long since)
           
protected  void remove(ExternalPeerHandle handle)
          Removes a given handle from the engine if it was known.
protected  void remove(java.lang.String handleID)
          Removes a given handle from the engine if it was known.
 SearchEngineService service()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SELOGGER

public static final java.util.logging.Logger SELOGGER

id

public final java.lang.String id
Search engine ID


hostname

public final java.lang.String hostname
Search engine hostname


port

public final int port
Search engine port


timeout

public final int timeout
Search engine cache refresh timeout

Method Detail

service

public SearchEngineService service()

add

public boolean add(ExternalPeerHandle handle)
            throws GridException
Adds a handle to this search engine. It is only added if the handle is alive as per AbstractExternalPeerHandle.isAlive() and a handle if the same ID isn't already known.

Parameters:
handle - The handle to add
Returns:
true if a handle of the same ID wasn't already known
Throws:
GridException - if the handle is invalid

remove

protected final void remove(ExternalPeerHandle handle)
Removes a given handle from the engine if it was known. This method is reference-safe (checks the handle ID and not the reference for removal).

Parameters:
handle - The handle to remove

remove

protected void remove(java.lang.String handleID)
Removes a given handle from the engine if it was known.

Parameters:
handleID - The ID of the handle to remove

getHandles

public SearchEngineResponse getHandles()
                                throws GridException
Throws:
GridException

getHandles

public SearchEngineResponse getHandles(long since)
                                throws GridException
Throws:
GridException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Lightweight Bartering Grid

Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.