net.i2p.client.naming
Class NamingService

java.lang.Object
  extended by net.i2p.client.naming.NamingService
Direct Known Subclasses:
AddressDBNamingService, DummyNamingService, HostsTxtNamingService, MetaNamingService, PetNameNamingService

public abstract class NamingService
extends java.lang.Object

Naming services create a subclass of this class.


Field Summary
protected  I2PAppContext _context
           
static java.lang.String PROP_IMPL
          what classname should be used as the naming service impl?
 
Constructor Summary
protected NamingService(I2PAppContext context)
          The naming service should only be constructed and accessed through the application context.
 
Method Summary
static NamingService createInstance(I2PAppContext context)
          Get a naming service instance.
abstract  Destination lookup(java.lang.String hostname)
          Look up a host name.
protected  Destination lookupBase64(java.lang.String hostname)
          Check if host name is valid Base64 encoded dest and return this dest in that case.
abstract  java.lang.String reverseLookup(Destination dest)
          Reverse look up a destination
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_context

protected I2PAppContext _context

PROP_IMPL

public static final java.lang.String PROP_IMPL
what classname should be used as the naming service impl?

See Also:
Constant Field Values
Constructor Detail

NamingService

protected NamingService(I2PAppContext context)
The naming service should only be constructed and accessed through the application context. This constructor should only be used by the appropriate application context itself.

Method Detail

lookup

public abstract Destination lookup(java.lang.String hostname)
Look up a host name.

Returns:
the Destination for this host name, or null if name is unknown.

reverseLookup

public abstract java.lang.String reverseLookup(Destination dest)
Reverse look up a destination

Returns:
a host name for this Destination, or null if none is known. It is safe for subclasses to always return null if no reverse lookup is possible.

lookupBase64

protected Destination lookupBase64(java.lang.String hostname)
Check if host name is valid Base64 encoded dest and return this dest in that case. Useful as a "fallback" in custom naming implementations.


createInstance

public static final NamingService createInstance(I2PAppContext context)
Get a naming service instance. This method ensures that there will be only one naming service instance (singleton) as well as choose the implementation from the "i2p.naming.impl" system property.