p2ps.imp.discovery.cache
Class AdvertisementCache

java.lang.Object
  extended byp2ps.imp.discovery.cache.AdvertisementCache

public class AdvertisementCache
extends java.lang.Object

A index of cache ids for adverts keyed by advert type. Queries are additionally keyed by query type

Version:
$Revision: 295 $
Author:
Ian Wang

Nested Class Summary
 class AdvertisementCache.IndexIterator
           
 
Constructor Summary
AdvertisementCache()
           
 
Method Summary
 java.util.Iterator advertIterator()
           
 java.util.Iterator advertIterator(java.lang.String type)
           
 void cache(Advertisement advert)
          Indexes an advert and its associated cache id.
 void dispose()
          Disposes the advertisement cache
 void init(java.io.File file, Peer peer)
           
static void main(java.lang.String[] args)
           
 java.util.Iterator queryIterator()
           
 java.util.Iterator queryIterator(java.lang.String type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdvertisementCache

public AdvertisementCache()
Method Detail

init

public void init(java.io.File file,
                 Peer peer)
          throws java.io.IOException
Throws:
java.io.IOException

cache

public void cache(Advertisement advert)
           throws java.io.IOException
Indexes an advert and its associated cache id.

Throws:
java.io.IOException

advertIterator

public java.util.Iterator advertIterator()
Returns:
an iterator for all adverts

advertIterator

public java.util.Iterator advertIterator(java.lang.String type)
Returns:
an iterator for the specified advert type

queryIterator

public java.util.Iterator queryIterator()
Returns:
an iterator for all adverts

queryIterator

public java.util.Iterator queryIterator(java.lang.String type)
Returns:
an iterator of queries for the specified query type

dispose

public void dispose()
Disposes the advertisement cache


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception