wtanaka.praya.gale
Class LocationRecipient

java.lang.Object
  |
  +--wtanaka.praya.Recipient
        |
        +--wtanaka.praya.gale.LocationRecipient
All Implemented Interfaces:
java.io.Serializable

public class LocationRecipient
extends Recipient

A recipient targeted at a particular dangermouse location. This recipient is not "fully resolved." Call resolve() to get an instance of ResolvedLocationRecipient

Return to Sourceforge or the Praya Homepage

Version:
$Name: $ $Date: 2002/07/09 02:44:45 $
Author:
$Author: wtanaka $
See Also:
Location, ResolvedLocationRecipient, Serialized Form

Field Summary
private  java.util.Hashtable fields
           
private static java.lang.String ID_LABEL
           
private  Location[] m_ids
           
 
Fields inherited from class wtanaka.praya.Recipient
m_protocol, TYPE_BOOLEAN, TYPE_STRING
 
Constructor Summary
LocationRecipient(Protocol galeClient, Location[] ids)
          Constructor
 
Method Summary
 java.lang.String getDescription()
          A short string which describes where something addressed to this recipient will go, assuming that the caller is aware of the context of the recipient.
 java.util.Hashtable getFieldNames()
          Returns an table of names->field contents of fields for insertion into a field enabled editor.
 java.lang.String getFullDescription()
          A string which describes where something addressed to this recipient will go.
private  GaleClient getParent()
           
 ResolvedRecipient resolve()
          Looks up the keys associated with this Location in order to find which locations to actually send to.
 java.lang.String toString()
           
 Recipient withNewFields(java.util.Hashtable newFields)
          Returns a new recipient with the given fields.
 
Methods inherited from class wtanaka.praya.Recipient
equals, getProtocol, hashCode
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

m_ids

private Location[] m_ids

fields

private java.util.Hashtable fields

ID_LABEL

private static final java.lang.String ID_LABEL
Constructor Detail

LocationRecipient

public LocationRecipient(Protocol galeClient,
                         Location[] ids)
Constructor
Method Detail

getParent

private GaleClient getParent()

getDescription

public java.lang.String getDescription()
Description copied from class: Recipient
A short string which describes where something addressed to this recipient will go, assuming that the caller is aware of the context of the recipient. For example, this might reutrn "wtanaka@mili.eu.org" or "#dred"
Overrides:
getDescription in class Recipient

getFullDescription

public java.lang.String getFullDescription()
Description copied from class: Recipient
A string which describes where something addressed to this recipient will go. For example, this might reutrn "email to wtanaka@mili.eu.org" or "irc #dred"
Overrides:
getFullDescription in class Recipient

getFieldNames

public java.util.Hashtable getFieldNames()
Description copied from class: Recipient
Returns an table of names->field contents of fields for insertion into a field enabled editor. For instance, an email might have: "From", "To->wtanaka@mili.eu.org", "Cc", "Bcc", etc. This is a map from string to FilledField
Overrides:
getFieldNames in class Recipient

withNewFields

public Recipient withNewFields(java.util.Hashtable newFields)
Description copied from class: Recipient
Returns a new recipient with the given fields.
Overrides:
withNewFields in class Recipient
Following copied from class: wtanaka.praya.Recipient
Parameters:
newFields - this is the map from string to FilledField

resolve

public ResolvedRecipient resolve()
                          throws CannotResolveException
Looks up the keys associated with this Location in order to find which locations to actually send to.

(1) Given a location, e.g. "pub.gale@ofb.net", construct the list of candidate key names for this location: pub.gale@ofb.net pub.*@ofb.net *@ofb.net There will always be N+1 candidate key names for a location with N local parts (e.g., "pub" and "gale").

(2) In parallel, look up each of these candidate key names. Each candidate key will either return a positive reply, a negative reply, or no reply (timeout, treated equivalently to negative reply). If no positive replies are received, the location does not exist and an error should be reported. If more than one positive reply is received, one may be picked at random (alternatively an error may be reported).

(3) In this positive key reply, look for the key.redirect field. If it exists, its value must be merged with the key name and the original location to produce a new location. First, count the number of components in the local part of the key name, excluding any trailing '*'. Remove that many components from the beginning of the local part of the original location. Also remove the domain from the original location. You will be left with zero or more components from the end of the local part of the original location. Append this string to the local part of the location stored in the key.redirect fragment. The location thus produced is the merged location. Go to step (1) and repeat the process with the merged location. Use the merged location rather than the original location for all further purposes when dealing with this message (such as category generation, UI presentation, etc).

(4) If there is no key.redirect, then the key MUST contain either one or more key.member fields; or the three fields rsa.modulus, rsa.bits, and rsa.exponent; or both key.member and the rsa fields. If there is no key.member field present, then encrypt the puff using this public key. If both types of fields are present, the puff must be encrypted to this public key as well as the keys specified in the key.member field(s). If key.member is present but not the rsa fields, then encrypt only to the keys listed in the key.member fragments.

(5) Each key.member field has a value whose contents are another key name, or the empty string. If the empty string is found, this means that the puff should not be encrypted; processing may terminate here. Otherwise, construct the set of keys named in the key.member fields. Look up each of these keys in parallel, starting from step (2). Each request must terminate with either a valid public key, or the empty string. When the transitive closure is complete, the result will be either the empty string or a set of public keys. If it is the empty string, do not encrypt the puff; otherwise, encrypt the puff to this list of keys.

This is a graph traversal; there may be cycles and shared structures. If a key contains a key.redirect fragment, the fragment is to be ignored during this graph traversal.

Overrides:
resolve in class Recipient
Returns:
a ResolvedLocationRecipient representing the fully resolved location.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object