org.archive.crawler.datamodel.credential
Class CredentialAvatar

java.lang.Object
  extended by org.archive.crawler.datamodel.credential.CredentialAvatar
All Implemented Interfaces:
java.io.Serializable

public class CredentialAvatar
extends java.lang.Object
implements java.io.Serializable

A credential representation. Added to the CrawlServer upon successful authentication. Used as a marker of successful authentication event and for carrying credential payload to be used subsequently doing preemptive authentications (e.g. For case of RFC2617, needs to be offered everytime we're accessing inside a protected area). Also carried by the CrawlURI when cycling through processing chain trying a credential to see if it will authenticate.

This class exists because its not safe to keep references to the settings derived Credential classes so instead of keeping references to credential classes, we carry around this avatar.

Scope for avatars is crawlserver. Only used within a CrawlServer scope.

Immutable.

Version:
$Revision: 4668 $, $Date: 2006-09-26 21:49:01 +0000 (Tue, 26 Sep 2006) $
Author:
stack
See Also:
Serialized Form

Constructor Summary
CredentialAvatar(java.lang.Class type, java.lang.String key)
          Constructor.
CredentialAvatar(java.lang.Class type, java.lang.String key, java.lang.String payload)
          Constructor.
 
Method Summary
protected  boolean checkType(java.lang.Class candidateType)
           
 Credential getCredential(SettingsHandler handler, CrawlURI curi)
           
 java.lang.String getKey()
           
 java.lang.String getPayload()
           
 java.lang.Class getType()
           
 boolean match(java.lang.Class otherType)
           
 boolean match(java.lang.Class otherType, java.lang.String otherKey)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CredentialAvatar

public CredentialAvatar(java.lang.Class type,
                        java.lang.String key)
Constructor.

Parameters:
type - Type for this credential avatar.
key - Key for this credential avatar.

CredentialAvatar

public CredentialAvatar(java.lang.Class type,
                        java.lang.String key,
                        java.lang.String payload)
Constructor.

Parameters:
type - Type for this credential avatar.
key - Key for this credential avatar.
payload - Data credential needs rerunning or preempting. May be null and then just the presence is used as signifier of successful auth.
Method Detail

checkType

protected boolean checkType(java.lang.Class candidateType)
Parameters:
candidateType - Type to check.
Returns:
True if this is a known credential type.

getPayload

public java.lang.String getPayload()
Returns:
Returns the payload. May be null.

getKey

public java.lang.String getKey()
Returns:
Returns the key.

getType

public java.lang.Class getType()
Returns:
Type represented by this avatar.

match

public boolean match(java.lang.Class otherType)
Parameters:
otherType - Class to match.
Returns:
True if this credential avatar is of same type.

match

public boolean match(java.lang.Class otherType,
                     java.lang.String otherKey)
Parameters:
otherType - Credential to match.
otherKey - Key to test.
Returns:
True if this is avatar for passed credential.

toString

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

getCredential

public Credential getCredential(SettingsHandler handler,
                                CrawlURI curi)
Parameters:
handler - Settings handler.
curi - CrawlURI to use for context.
Returns:
The credential this avatar represents.


Copyright © 2003-2011 Internet Archive. All Rights Reserved.