Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.i2p.client.naming
Class NamingService

    java.lang.Object
      net.i2p.client.naming.NamingService

Direct Known Subclasses:
  AddressDBNamingService, DummyNamingService, EepGetNamingService, ExecNamingService, HostsTxtNamingService, MetaNamingService, PetNameNamingService

    public abstract class NamingService

extends Object

Naming services create a subclass of this class.

Field Summary
`protected I2PAppContext` | `_context`
`protected static long` | `CACHE_MAX_AGE` Don't know why a dest would ever change but keep this short anyway
`protected static int` | `CACHE_MAX_SIZE`
`static 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
`void` | `clearCache()`
`static NamingService` | `createInstance(I2PAppContext context)` Get a naming service instance.
`protected Destination` | `getCache(String s)`
`abstract Destination` | `lookup(String hostname)` Look up a host name.
`protected Destination` | `lookupBase64(String hostname)` Check if host name is valid Base64 encoded dest and return this dest in that case.
`protected void` | `putCache(String s, Destination d)`
`String` | `reverseLookup(Destination dest)` Reverse look up a destination
`String` | `reverseLookup(Hash h)` Deprecated. unused

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 String PROP_IMPL

  what classname should be used as the naming service impl?

  See Also:
    Constant Field Values

### CACHE_MAX_SIZE

    protected static final int CACHE_MAX_SIZE

See Also:
  Constant Field Values

### CACHE_MAX_AGE

    protected static final long CACHE_MAX_AGE

  Don't know why a dest would ever change but keep this short anyway

  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(String hostname)

  Look up a host name.

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

### reverseLookup

    public 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.

### reverseLookup

    public String reverseLookup(Hash h)

  Deprecated. unused

### lookupBase64

    protected Destination lookupBase64(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.

### putCache

    protected void putCache(String s,
                            Destination d)

### getCache

    protected Destination getCache(String s)

### clearCache

    public void clearCache()

  Since:
    0.8.1

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD