|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.handle.hdllib.HandleResolver
public class HandleResolver
Responsible for locating and retrieving the value of handles using a caching server, or on the internet.
Field Summary | |
---|---|
boolean |
delegationEnabled
|
boolean |
traceMessages
|
Constructor Summary | |
---|---|
HandleResolver()
|
Method Summary | |
---|---|
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 |
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)
Find the NA handle for a handle |
byte[] |
getNAHandle(ResolutionRequest resReq)
|
NamespaceInfo |
getNamespaceInfo(byte[] handle)
Find the namespace info for a handle |
NamespaceInfo |
getNamespaceInfo(ResolutionRequest resReq)
|
ClientSessionTracker |
getSessionTracker()
Returns the current default session tracker. |
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. |
AbstractResponse |
processRequest(AbstractRequest req)
Shortcut to processRequest(req, null); |
AbstractResponse |
processRequest(AbstractRequest req,
ResponseMessageCallback callback)
This method sends the given request to the handle system 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(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. |
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 |
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 |
sendRequestToServerByProtocol(AbstractRequest req,
ServerInfo server,
int protocolToUse,
ResponseMessageCallback callback)
Sends the given request to the specified server by the given protocol, if supported. |
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)
|
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 |
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 |
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(AuthenticationInfo authInfo,
SessionSetupInfo sessionOptions,
ServerInfo server,
ClientSideSessionInfo currSession,
ResponseMessageCallback callback)
Initiates and returns a session with the given server using the given authentication information. |
ClientSideSessionInfo |
setupSessionWithServer(AuthenticationInfo authInfo,
SessionSetupInfo sessionOptions,
ServerInfo server,
ResponseMessageCallback callback)
Create a new session. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public boolean traceMessages
public boolean delegationEnabled
Constructor Detail |
---|
public HandleResolver()
Method Detail |
---|
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 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(java.lang.String sHandle) throws HandleException
HandleException
public AbstractResponse processRequest(AbstractRequest req, ResponseMessageCallback callback) throws HandleException
HandleResolver resolver = new HandleResolver(); AbstractResponse aResponse = resolver.resolveHandle("10.1000/12", 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
- Throws:
HandleException
public AbstractResponse processRequest(AbstractRequest req) throws HandleException
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
public byte[] getNAHandle(byte[] handle) throws HandleException
HandleException
public byte[] getNAHandle(ResolutionRequest resReq) throws HandleException
HandleException
public NamespaceInfo getNamespaceInfo(byte[] handle) throws HandleException
HandleException
public 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) 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 sendRequestToServer(AbstractRequest req, ServerInfo server) throws HandleException
HandleException
public AbstractResponse sendRequestToServer(AbstractRequest req, ServerInfo server, ResponseMessageCallback callback) throws HandleException
HandleException
public AbstractResponse sendRequestToServerByProtocol(AbstractRequest req, ServerInfo server, int protocolToUse, ResponseMessageCallback callback) throws HandleException
HandleException
public ClientSideSessionInfo setupSessionWithServer(AuthenticationInfo authInfo, SessionSetupInfo sessionOptions, ServerInfo server, ResponseMessageCallback callback) throws java.lang.Exception
java.lang.Exception
public ClientSideSessionInfo setupSessionWithServer(AuthenticationInfo authInfo, SessionSetupInfo sessionOptions, ServerInfo server, ClientSideSessionInfo currSession, ResponseMessageCallback callback) throws java.lang.Exception
currSession
- If non null, that session will be modified.
Note: Security check! Since session information is stored in the handle
resolve, users of this code must be _very_ careful not to pass the
HandleResolver object around to untrusted code. A better way to do
this might be to make the session stuff not happen automatically and
have public methods for starting, finishing, and using sessions.
AbstractRequest objects should have session objects associated with
them just like regular authentication information.
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |