public class HandleResolver extends java.lang.Object implements RequestProcessor
Modifier and Type | Field and Description |
---|---|
boolean |
traceMessages |
Constructor and Description |
---|
HandleResolver() |
Modifier and Type | Method and Description |
---|---|
void |
clearCaches()
Clear any caches being used by this resolver
|
SiteInfo[] |
findLocalSites(AbstractRequest req)
Get the site information for the service that is responsible for
this handle while at the same time populating the namespace
|
SiteInfo[] |
findLocalSitesForNA(byte[] naHandle) |
Configuration |
getConfiguration()
Get the resolution configuration
|
java.util.concurrent.ExecutorService |
getExecutorService() |
int |
getMaxUDPDataSize()
Return the maximum size of the data part of a message before it is
split into multiple messages when using UDP.
|
byte[] |
getNAHandle(byte[] handle)
Deprecated.
Legacy of slash-based delegation; use Util.getZeroNAHandle
|
byte[] |
getNAHandle(ResolutionRequest resReq)
Deprecated.
|
net.handle.hdllib.NamespaceInfo |
getNamespaceInfo(byte[] handle)
Find the namespace info for a handle
|
net.handle.hdllib.NamespaceInfo |
getNamespaceInfo(ResolutionRequest resReq) |
ClientSessionTracker |
getSessionTracker()
Returns the current default session tracker.
|
SiteFilter |
getSiteFilter() |
int |
getTcpTimeout()
Get how long to wait for responses to TCP requests.
|
int[] |
getUdpRetryScheme()
Get the array that specifies how long to wait for responses to
each UDP request.
|
boolean |
isUseIPv6FastFallback() |
void |
listHandlesUnderPrefix(java.lang.String prefixHandle,
AuthenticationInfo authInfo,
ScanCallback callback) |
void |
listHandlesUnderPrefixAtSite(java.lang.String prefixHandle,
SiteInfo site,
AuthenticationInfo authInfo,
ScanCallback callback) |
AbstractResponse |
processRequest(AbstractRequest req)
Shortcut to processRequest(req, null);
|
AbstractResponse |
processRequest(AbstractRequest req,
java.net.InetAddress caller) |
void |
processRequest(AbstractRequest req,
java.net.InetAddress caller,
ResponseMessageCallback callback) |
AbstractResponse |
processRequest(AbstractRequest req,
ResponseMessageCallback callback)
This method processes the given request using
the currently configured method (global resolution, resolution
against a caching server, etc), and returns the response.
|
AbstractResponse |
processRequestGlobally(AbstractRequest req)
Shortcut to processRequestGlobally(req, null);
|
int[] |
protocolsByPreference()
Return a copy of preferredProtocols[], wherein protocols are listed in
order of preference.
|
HandleValue[] |
resolveHandle(byte[] handle) |
HandleValue[] |
resolveHandle(byte[] handle,
byte[][] types,
int[] indexes) |
HandleValue[] |
resolveHandle(java.lang.String sHandle) |
HandleValue[] |
resolveHandle(java.lang.String sHandle,
java.lang.String[] sTypes,
int[] indexes)
Locate and return the values of the given handle that have the
specified types or indexes.
|
HandleValue |
resolveValueReference(ValueReference valueReference) |
byte[] |
retrieveHandleIndexData(byte[] handle,
int index)
this method will retrieve the handle values by the given handle/index pair
Now only used to retrieve public key data in veryfying the session setup
data.
|
AbstractResponse |
sendHdlTcpRequest(AbstractRequest req,
java.net.InetAddress addr,
int port)
Shortcut to sendHdlTcpRequest(req, addr, port, null);
|
AbstractResponse |
sendHdlTcpRequest(AbstractRequest req,
java.net.InetAddress addr,
int port,
ResponseMessageCallback callback) |
AbstractResponse |
sendHdlUdpRequest(AbstractRequest req,
java.net.InetAddress addr,
int port)
Shortcut to sendHdlUdpRequest(req, addr, port, null);
|
AbstractResponse |
sendHdlUdpRequest(AbstractRequest req,
java.net.InetAddress addr,
int port,
ResponseMessageCallback callback) |
AbstractResponse |
sendHttpRequest(AbstractRequest req,
java.net.InetAddress addr,
int port)
Shortcut to sendHttpRequest(req, addr, port, null);
|
AbstractResponse |
sendHttpRequest(AbstractRequest req,
java.net.InetAddress addr,
int port,
ResponseMessageCallback callback) |
AbstractResponse |
sendHttpsRequest(AbstractRequest req,
java.net.InetAddress addr,
int port,
ResponseMessageCallback callback) |
AbstractResponse |
sendRequestToInterface(AbstractRequest req,
ServerInfo server,
Interface interfce)
Shortcut to sendRequestToInterface(AbstractRequest, ServerInfo,
Interface, null);
|
AbstractResponse |
sendRequestToInterface(AbstractRequest req,
ServerInfo server,
Interface interfce,
ResponseMessageCallback callback) |
AbstractResponse |
sendRequestToServer(AbstractRequest req,
ServerInfo server)
Shortcut to sendRequestToServer(AbstractRequest, ServerInfo, null);
|
AbstractResponse |
sendRequestToServer(AbstractRequest req,
ServerInfo server,
ResponseMessageCallback callback)
Wrapper around sendRequestToServerByProtocol(), which used to have this
name and signature.
|
AbstractResponse |
sendRequestToServer(AbstractRequest req,
SiteInfo site,
ServerInfo server) |
AbstractResponse |
sendRequestToServer(AbstractRequest req,
SiteInfo site,
ServerInfo server,
ResponseMessageCallback callback) |
AbstractResponse |
sendRequestToServerByProtocol(AbstractRequest req,
ServerInfo server,
int protocolToUse,
ResponseMessageCallback callback)
Sends the given request to the specified server by the given protocol,
if supported.
|
AbstractResponse |
sendRequestToServerInSiteByProtocol(AbstractRequest req,
SiteInfo site,
ServerInfo server,
int protocol,
ResponseMessageCallback callback) |
AbstractResponse |
sendRequestToService(AbstractRequest req,
SiteInfo[] sites)
Shortcut to sendRequestToService(AbstractRequest, SiteInfo[], null);
|
AbstractResponse |
sendRequestToService(AbstractRequest req,
SiteInfo[] sites,
ResponseMessageCallback callback) |
AbstractResponse |
sendRequestToSite(AbstractRequest req,
SiteInfo site)
Sends the given request to the appropriate server in the given site and
returns the response.
|
AbstractResponse |
sendRequestToSite(AbstractRequest req,
SiteInfo site,
int protocol)
Shortcut to sendRequestToSite(AbstractRequest, site, protocol, null);
|
AbstractResponse |
sendRequestToSite(AbstractRequest req,
SiteInfo site,
int protocol,
ResponseMessageCallback callback) |
AbstractResponse |
sendRequestToSite(AbstractRequest req,
SiteInfo site,
ResponseMessageCallback callback)
Sends the given request to the appropriate server in the given site and
returns the response.
|
void |
setCache(Cache cache)
Gives the resolver a Cache object to use when resolving.
|
void |
setCertifiedCache(Cache cache)
Gives the resolver a Cache object to use for certified resolutions.
|
void |
setCheckSignatures(boolean checkSigs)
Set whether or not this object should check the signatures
of server responses to certified requests.
|
void |
setConfiguration(Configuration config)
Set the configuration used for resolution.
|
void |
setExecutorService(java.util.concurrent.ExecutorService execServ) |
void |
setMaxUDPDataSize(int newMaxUDPDataSize)
Set the maximum size of the data part of a message before it is
split into multiple messages when using UDP.
|
void |
setPreferredProtocols(int[] prefProtocols)
Set the protocols and the order of preference used for resolution
For every server that this resolver talks to, it attempts to
communicate via the given protocols either until it succeeds or
all attempts to communicate fail.
|
void |
setSessionTracker(ClientSessionTracker sessionTracker)
Gives the resolver a session tracker object to use when
resolving.
|
void |
setSiteFilter(SiteFilter siteFilter) |
void |
setTcpTimeout(int newTcpTimeout)
Set how long to wait for responses to TCP and HTTP requests.
|
void |
setUdpRetryScheme(int[] newudpRetryScheme)
Set the array that specifies how long to wait for responses to
each UDP request.
|
ClientSideSessionInfo |
setupSessionWithServer(AbstractRequest req,
SessionSetupInfo sessionOptions,
ServerInfo server,
ClientSideSessionInfo currSession,
ResponseMessageCallback callback)
Initiates and returns a session with the given server for the given request.
|
ClientSideSessionInfo |
setupSessionWithServer(AbstractRequest req,
SessionSetupInfo sessionOptions,
ServerInfo server,
ResponseMessageCallback callback)
Create a new session to handle the given request.
|
ClientSideSessionInfo |
setupSessionWithServer(AuthenticationInfo authInfo,
SessionSetupInfo sessionOptions,
ServerInfo server,
ClientSideSessionInfo currSession,
ResponseMessageCallback callback,
int majorProtocolVersion,
int minorProtocolVersion)
Initiates and returns a session with the given server using the
given authentication information.
|
void |
setUseIPv6FastFallback(boolean useIPv6FastFallback) |
public java.util.concurrent.ExecutorService getExecutorService()
public void setExecutorService(java.util.concurrent.ExecutorService execServ)
public int[] protocolsByPreference()
public byte[] retrieveHandleIndexData(byte[] handle, int index) throws java.lang.Exception
java.lang.Exception
public void setCache(Cache cache)
public void setCertifiedCache(Cache cache)
public void clearCaches() throws java.lang.Exception
java.lang.Exception
public void setSessionTracker(ClientSessionTracker sessionTracker)
public ClientSessionTracker getSessionTracker()
public void setConfiguration(Configuration config)
public void setPreferredProtocols(int[] prefProtocols)
public void setMaxUDPDataSize(int newMaxUDPDataSize)
public int getMaxUDPDataSize()
public Configuration getConfiguration()
public void setTcpTimeout(int newTcpTimeout)
public int getTcpTimeout()
public boolean isUseIPv6FastFallback()
public void setUseIPv6FastFallback(boolean useIPv6FastFallback)
public SiteFilter getSiteFilter()
public void setSiteFilter(SiteFilter siteFilter)
public int[] getUdpRetryScheme()
public void setUdpRetryScheme(int[] newudpRetryScheme)
public void setCheckSignatures(boolean checkSigs)
public HandleValue[] resolveHandle(java.lang.String sHandle, java.lang.String[] sTypes, int[] indexes) throws HandleException
Type-List Index List Returns [ URL ] [ 0, 12 ] Any URL values, as well as values with indexes 0 and 12 if they exist. [ ] [ 1 ] The value with index one only [ EMAIL ] [ ] Any values with type EMAIL [ ] [ ] All of the values associated with the given handle
HandleException
public HandleValue[] resolveHandle(byte[] handle, byte[][] types, int[] indexes) throws HandleException
HandleException
public HandleValue[] resolveHandle(java.lang.String sHandle) throws HandleException
HandleException
public HandleValue[] resolveHandle(byte[] handle) throws HandleException
HandleException
public HandleValue resolveValueReference(ValueReference valueReference) throws HandleException
HandleException
public void listHandlesUnderPrefix(java.lang.String prefixHandle, AuthenticationInfo authInfo, ScanCallback callback) throws HandleException
HandleException
public void listHandlesUnderPrefixAtSite(java.lang.String prefixHandle, SiteInfo site, AuthenticationInfo authInfo, ScanCallback callback) throws HandleException
HandleException
public AbstractResponse processRequest(AbstractRequest req, ResponseMessageCallback callback) throws HandleException
HandleResolver resolver = new HandleResolver(); AbstractResponse aResponse = resolver.resolveHandle("123/abc", new String[]{"URL"}, null); if(aResponse.responseCode==AbstractMessage.RC_SUCCESS) { ResolutionResponse response = (ResolutionResponse)aResponse; HandleValue values[] = response.getHandleValues(); System.out.println("Received values: "); for(int i=0; i
HandleException
public AbstractResponse processRequest(AbstractRequest req) throws HandleException
HandleException
public AbstractResponse processRequest(AbstractRequest req, java.net.InetAddress caller) throws HandleException
processRequest
in interface RequestProcessor
HandleException
public void processRequest(AbstractRequest req, java.net.InetAddress caller, ResponseMessageCallback callback) throws HandleException
processRequest
in interface RequestProcessor
HandleException
public AbstractResponse processRequestGlobally(AbstractRequest req) throws HandleException
HandleException
public SiteInfo[] findLocalSitesForNA(byte[] naHandle) throws HandleException
HandleException
public SiteInfo[] findLocalSites(AbstractRequest req) throws HandleException
HandleException
@Deprecated public byte[] getNAHandle(byte[] handle) throws HandleException
HandleException
@Deprecated public byte[] getNAHandle(ResolutionRequest resReq) throws HandleException
HandleException
public net.handle.hdllib.NamespaceInfo getNamespaceInfo(byte[] handle) throws HandleException
HandleException
public net.handle.hdllib.NamespaceInfo getNamespaceInfo(ResolutionRequest resReq) throws HandleException
HandleException
public final AbstractResponse sendRequestToService(AbstractRequest req, SiteInfo[] sites, ResponseMessageCallback callback) throws HandleException
HandleException
public AbstractResponse sendRequestToService(AbstractRequest req, SiteInfo[] sites) throws HandleException
HandleException
public AbstractResponse sendRequestToSite(AbstractRequest req, SiteInfo site, int protocol) throws HandleException
HandleException
public AbstractResponse sendRequestToSite(AbstractRequest req, SiteInfo site, int protocol, ResponseMessageCallback callback) throws HandleException
HandleException
public AbstractResponse sendRequestToServerInSiteByProtocol(AbstractRequest req, SiteInfo site, ServerInfo server, int protocol, ResponseMessageCallback callback) throws HandleException
HandleException
public AbstractResponse sendRequestToServer(AbstractRequest req, ServerInfo server) throws HandleException
HandleException
public AbstractResponse sendRequestToServer(AbstractRequest req, SiteInfo site, ServerInfo server) throws HandleException
HandleException
public AbstractResponse sendRequestToServer(AbstractRequest req, ServerInfo server, ResponseMessageCallback callback) throws HandleException
HandleException
public AbstractResponse sendRequestToServer(AbstractRequest req, SiteInfo site, ServerInfo server, ResponseMessageCallback callback) throws HandleException
HandleException
public AbstractResponse sendRequestToSite(AbstractRequest req, SiteInfo site) throws HandleException
HandleException
public AbstractResponse sendRequestToSite(AbstractRequest req, SiteInfo site, ResponseMessageCallback callback) throws HandleException
HandleException
public AbstractResponse sendRequestToServerByProtocol(AbstractRequest req, ServerInfo server, int protocolToUse, ResponseMessageCallback callback) throws HandleException
HandleException
public ClientSideSessionInfo setupSessionWithServer(AbstractRequest req, SessionSetupInfo sessionOptions, ServerInfo server, ResponseMessageCallback callback) throws java.lang.Exception
java.lang.Exception
public ClientSideSessionInfo setupSessionWithServer(AbstractRequest req, SessionSetupInfo sessionOptions, ServerInfo server, ClientSideSessionInfo currSession, ResponseMessageCallback callback) throws java.lang.Exception
currSession
- If non null, that session will be modified.java.lang.Exception
public ClientSideSessionInfo setupSessionWithServer(AuthenticationInfo authInfo, SessionSetupInfo sessionOptions, ServerInfo server, ClientSideSessionInfo currSession, ResponseMessageCallback callback, int majorProtocolVersion, int minorProtocolVersion) throws java.lang.Exception
currSession
- If non null, that session will be modified.java.lang.Exception
public AbstractResponse sendRequestToInterface(AbstractRequest req, ServerInfo server, Interface interfce) throws HandleException
HandleException
public AbstractResponse sendRequestToInterface(AbstractRequest req, ServerInfo server, Interface interfce, ResponseMessageCallback callback) throws HandleException
HandleException
public AbstractResponse sendHdlUdpRequest(AbstractRequest req, java.net.InetAddress addr, int port) throws HandleException
HandleException
public AbstractResponse sendHdlUdpRequest(AbstractRequest req, java.net.InetAddress addr, int port, ResponseMessageCallback callback) throws HandleException
HandleException
public AbstractResponse sendHdlTcpRequest(AbstractRequest req, java.net.InetAddress addr, int port) throws HandleException
HandleException
public AbstractResponse sendHdlTcpRequest(AbstractRequest req, java.net.InetAddress addr, int port, ResponseMessageCallback callback) throws HandleException
HandleException
public AbstractResponse sendHttpRequest(AbstractRequest req, java.net.InetAddress addr, int port) throws HandleException
HandleException
public AbstractResponse sendHttpRequest(AbstractRequest req, java.net.InetAddress addr, int port, ResponseMessageCallback callback) throws HandleException
HandleException
public AbstractResponse sendHttpsRequest(AbstractRequest req, java.net.InetAddress addr, int port, ResponseMessageCallback callback) throws HandleException
HandleException