net.i2p.client.naming
Class ExecNamingService

java.lang.Object
  extended by net.i2p.client.naming.NamingService
      extended by net.i2p.client.naming.DummyNamingService
          extended by net.i2p.client.naming.ExecNamingService

public class ExecNamingService
extends DummyNamingService

An interface to an external naming service program, with in-memory caching. This can be used as a simple and flexible way to experiment with alternative naming systems. The external command takes a hostname argument and must return (only) the 516-byte Base64 destination, or hostname=dest, on stdout. A trailing \n or \r\n is acceptable. The command must exit 0 on success. Nonzero on failure is optional. The external command can do local and/or remote (via i2p or not) lookups. No timeouts are implemented here - the author of the external program must ensure that the program returns in a reasonable amount of time - (15 sec max suggested) Can be used from MetaNamingService, (e.g. after HostsTxtNamingService), or as the sole naming service. Supports caching, b32, and b64. Sample chained config to put in configadvanced.jsp (restart required): i2p.naming.impl=net.i2p.client.naming.MetaNamingService i2p.nameservicelist=net.i2p.client.naming.HostsTxtNamingService,net.i2p.client.naming.ExecNamingService i2p.naming.exec.command=/usr/local/bin/i2presolve Sample unchained config to put in configadvanced.jsp (restart required): i2p.naming.impl=net.i2p.client.naming.ExecNamingService i2p.naming.exec.command=/usr/local/bin/i2presolve


Field Summary
 
Fields inherited from class net.i2p.client.naming.DummyNamingService
BASE32_HASH_LENGTH, CACHE_MAX_SIZE, DEST_SIZE, PROP_B32
 
Fields inherited from class net.i2p.client.naming.NamingService
_context, _listeners, _log, _updaters, PROP_IMPL
 
Constructor Summary
ExecNamingService(I2PAppContext context)
          The naming service should only be constructed and accessed through the application context.
 
Method Summary
 Destination lookup(String hostname, Properties lookupOptions, Properties storedOptions)
          Same as lookup(hostname) but with in and out options Note that whether this (and lookup(hostname)) resolve B32 addresses is NamingService-specific.
 
Methods inherited from class net.i2p.client.naming.DummyNamingService
clearCache, getCache, putCache, removeCache
 
Methods inherited from class net.i2p.client.naming.NamingService
addNamingService, addNamingService, createInstance, getBase64Entries, getConfiguration, getEntries, getEntries, getName, getNames, getNames, getNamingServices, getParent, lookup, lookup, lookupBase32, lookupBase64, put, put, putAll, putIfAbsent, putIfAbsent, registerListener, registerUpdater, remove, remove, removeNamingService, requestUpdate, reverseLookup, reverseLookup, reverseLookup, setConfiguration, shutdown, size, size, start, toString, unregisterListener, unregisterUpdater, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExecNamingService

public ExecNamingService(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 Destination lookup(String hostname,
                          Properties lookupOptions,
                          Properties storedOptions)
Description copied from class: NamingService
Same as lookup(hostname) but with in and out options Note that whether this (and lookup(hostname)) resolve B32 addresses is NamingService-specific.

Overrides:
lookup in class DummyNamingService
Parameters:
hostname - mixed case as it could be a key
lookupOptions - input parameter, NamingService-specific, can be null
storedOptions - output parameter, NamingService-specific, any stored properties will be added if non-null
Returns:
dest or null