public class SingleFileNamingService extends NamingService
_context, _listeners, _log, _updaters, PROP_IMPL| Constructor and Description |
|---|
SingleFileNamingService(I2PAppContext context,
String filename)Application context. |
| Modifier and Type | Method and Description |
|---|---|
void | export(Writer out,
Properties options)Overridden for efficiency. |
Map<String,String> | getBase64Entries(Properties options)Overridden since we store base64 natively. |
Map<String,Destination> | getEntries(Properties options)Return all entries matching the options. |
String | getName()Return the file's absolute path. |
Set<String> | getNames(Properties options)Return all known host names. |
Destination | lookup(String hostname,
Properties lookupOptions,
Properties storedOptions)Will strip a "www." prefix and retry if lookup fails |
boolean | put(String hostname,
Destination d,
Properties options)Store a hostname-destination mapping. |
boolean | putIfAbsent(String hostname,
Destination d,
Properties options)Store a hostname-destination mapping if not already present. |
boolean | remove(String hostname,
Properties options)Remove a hostname from the naming service. |
String | reverseLookup(Destination dest,
Properties options)Reverse lookup a destination to a hostname. |
void | shutdown()Parent will call when removed. |
int | size(Properties options)Return the number of entries. |
static void | writeOptions(Properties options,
Writer out)Write the subscription options part of the line (including the #!). |
addDestination, addDestination, addNamingService, addNamingService, createInstance, export, getConfiguration, getEntries, getNames, getNamingServices, getParent, isB32Host, isBlindedHost, isI2PHost, lookup, lookup, lookupAll, lookupAll, lookupBase32, lookupBase64, put, putAll, putIfAbsent, registerListener, registerUpdater, remove, remove, remove, removeNamingService, requestUpdate, reverseLookup, reverseLookup, reverseLookupAll, reverseLookupAll, reverseLookupAll, setConfiguration, size, start, toString, unregisterListener, unregisterUpdater, updatepublic SingleFileNamingService(I2PAppContext context, String filename)
context - the application contextfilename - the hosts file namepublic void export(Writer out, Properties options) throws IOException
export in class NamingServiceoptions - unused, may be nullout - the writer to export toIOException - if an I/O error occurspublic Map<String,String> getBase64Entries(Properties options)
getBase64Entries in class NamingServiceoptions - null OK, or as follows:
Key "search": return only those matching substring
Key "startsWith": return only those starting with
("[0-9]" allowed)public Map<String,Destination> getEntries(Properties options)
getEntries in class NamingServiceoptions - null OK, or as follows:
Key "search": return only those matching substring
Key "startsWith": return only those starting with
("[0-9]" allowed)public String getName()
getName in class NamingServicepublic Set<String> getNames(Properties options)
getNames in class NamingServiceoptions - unused, may be nullpublic Destination lookup(String hostname, Properties lookupOptions, Properties storedOptions)
lookup in class NamingServicehostname - case-sensitive; caller should convert to lower caselookupOptions - unused, may be nullstoredOptions - unused, may be nullpublic boolean put(String hostname, Destination d, Properties options)
put in class NamingServicehostname - case-sensitive; caller should convert to lower caseoptions - if non-null, any prefixed with '=' will be appended
in subscription formatd - the destination for the hostnamepublic boolean putIfAbsent(String hostname, Destination d, Properties options)
putIfAbsent in class NamingServicehostname - case-sensitive; caller should convert to lower caseoptions - if non-null, any prefixed with '=' will be appended
in subscription formatd - the destination for the hostnamepublic boolean remove(String hostname, Properties options)
remove in class NamingServicehostname - case-sensitive; caller should convert to lower caseoptions - unused, may be nullpublic String reverseLookup(Destination dest, Properties options)
reverseLookup in class NamingServiceoptions - unused, may be nulldest - non-null destination to look uppublic void shutdown()
NamingServiceshutdown in class NamingServicepublic int size(Properties options)
size in class NamingServiceoptions - unused, may be nullpublic static void writeOptions(Properties options, Writer out) throws IOException
options - non-nullout - the writer to write toIOException