org.archive.crawler.datamodel.credential
Class Credential

java.lang.Object
  extended by javax.management.Attribute
      extended by org.archive.crawler.settings.Type
          extended by org.archive.crawler.settings.ComplexType
              extended by org.archive.crawler.settings.ModuleType
                  extended by org.archive.crawler.datamodel.credential.Credential
All Implemented Interfaces:
java.io.Serializable, javax.management.DynamicMBean
Direct Known Subclasses:
HtmlFormCredential, Rfc2617Credential

public abstract class Credential
extends ModuleType

Credential type. Let this be also a credential in the JAAS sense to in that this is what gets added to a subject on successful authentication since it contains data needed to authenticate (realm, login, password, etc.).

Settings system assumes that subclasses implement a constructor that takes a name only.

Version:
$Revision: 5826 $, $Date: 2008-05-22 01:39:28 +0000 (Thu, 22 May 2008) $
Author:
stack
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.archive.crawler.settings.ComplexType
ComplexType.MBeanAttributeInfoIterator
 
Field Summary
 
Fields inherited from class org.archive.crawler.settings.ComplexType
definition, definitionMap
 
Constructor Summary
Credential(java.lang.String name, java.lang.String description)
          Constructor.
 
Method Summary
 void attach(CrawlURI curi)
          Attach this credentials avatar to the passed curi .
 void attach(CrawlURI curi, java.lang.String payload)
          Attach this credentials avatar to the passed curi .
 boolean detach(CrawlURI curi)
          Detach this credential from passed curi.
 boolean detachAll(CrawlURI curi)
          Detach all credentials of this type from passed curi.
 java.lang.String getCredentialDomain(CrawlURI context)
           
abstract  java.lang.String getKey(CrawlURI context)
           
abstract  java.lang.String getPrerequisite(CrawlURI curi)
          Return the authentication URI, either absolute or relative, that serves as prerequisite the passed curi.
abstract  boolean hasPrerequisite(CrawlURI curi)
           
abstract  boolean isEveryTime()
           
abstract  boolean isPost(CrawlURI curi)
           
abstract  boolean isPrerequisite(CrawlURI curi)
           
abstract  boolean populate(CrawlURI curi, org.apache.commons.httpclient.HttpClient http, org.apache.commons.httpclient.HttpMethod method, java.lang.String payload)
           
 boolean rootUriMatch(CrawlController controller, CrawlURI curi)
          Test passed curi matches this credentials rootUri.
 void setCredentialDomain(CrawlerSettings context, java.lang.String domain)
           
 
Methods inherited from class org.archive.crawler.settings.ModuleType
addElement, listUsedFiles
 
Methods inherited from class org.archive.crawler.settings.ComplexType
addElementToDefinition, checkValue, earlyInitialize, getAbsoluteName, getAttribute, getAttribute, getAttribute, getAttributeInfo, getAttributeInfo, getAttributeInfoIterator, getAttributes, getDataContainerRecursive, getDataContainerRecursive, getDefaultValue, getDescription, getElementFromDefinition, getLegalValues, getLocalAttribute, getMBeanInfo, getMBeanInfo, getParent, getPreservedFields, getSettingsHandler, getUncheckedAttribute, getValue, globalSettings, invoke, isInitialized, isOverridden, iterator, removeElementFromDefinition, setAsOrder, setAttribute, setAttribute, setAttributes, setDescription, setPreservedFields, toString, unsetAttribute
 
Methods inherited from class org.archive.crawler.settings.Type
addConstraint, equals, getConstraints, getLegalValueType, isExpertSetting, isOverrideable, isTransient, setExpertSetting, setLegalValueType, setOverrideable, setTransient
 
Methods inherited from class javax.management.Attribute
getName, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Credential

public Credential(java.lang.String name,
                  java.lang.String description)
Constructor.

Parameters:
name - Name of this credential.
description - Descrtiption of this particular credential.
Method Detail

getCredentialDomain

public java.lang.String getCredentialDomain(CrawlURI context)
                                     throws javax.management.AttributeNotFoundException
Parameters:
context - Context to use when searching for credential domain.
Returns:
The domain/root URI this credential is to go against.
Throws:
javax.management.AttributeNotFoundException - If attribute not found.

setCredentialDomain

public void setCredentialDomain(CrawlerSettings context,
                                java.lang.String domain)
                         throws javax.management.InvalidAttributeValueException,
                                javax.management.AttributeNotFoundException
Parameters:
context - Context to use when searching for credential domain.
domain - New domain.
Throws:
javax.management.AttributeNotFoundException
javax.management.InvalidAttributeValueException

attach

public void attach(CrawlURI curi)
Attach this credentials avatar to the passed curi . Override if credential knows internally what it wants to attach as payload. Otherwise, if payload is external, use the below attach(CrawlURI, String).

Parameters:
curi - CrawlURI to load with credentials.

attach

public void attach(CrawlURI curi,
                   java.lang.String payload)
Attach this credentials avatar to the passed curi .

Parameters:
curi - CrawlURI to load with credentials.
payload - Payload to carry in avatar. Usually credentials.

detach

public boolean detach(CrawlURI curi)
Detach this credential from passed curi.

Parameters:
curi -
Returns:
True if we detached a Credential reference.

detachAll

public boolean detachAll(CrawlURI curi)
Detach all credentials of this type from passed curi.

Parameters:
curi -
Returns:
True if we detached references.

isPrerequisite

public abstract boolean isPrerequisite(CrawlURI curi)
Parameters:
curi - CrawlURI to look at.
Returns:
True if this credential IS a prerequisite for passed CrawlURI.

hasPrerequisite

public abstract boolean hasPrerequisite(CrawlURI curi)
Parameters:
curi - CrawlURI to look at.
Returns:
True if this credential HAS a prerequisite for passed CrawlURI.

getPrerequisite

public abstract java.lang.String getPrerequisite(CrawlURI curi)
Return the authentication URI, either absolute or relative, that serves as prerequisite the passed curi.

Parameters:
curi - CrawlURI to look at.
Returns:
Prerequisite URI for the passed curi.

getKey

public abstract java.lang.String getKey(CrawlURI context)
                                 throws javax.management.AttributeNotFoundException
Parameters:
context - Context to use when searching for credential domain.
Returns:
Key that is unique to this credential type.
Throws:
javax.management.AttributeNotFoundException

isEveryTime

public abstract boolean isEveryTime()
Returns:
True if this credential is of the type that needs to be offered on each visit to the server (e.g. Rfc2617 is such a type).

populate

public abstract boolean populate(CrawlURI curi,
                                 org.apache.commons.httpclient.HttpClient http,
                                 org.apache.commons.httpclient.HttpMethod method,
                                 java.lang.String payload)
Parameters:
curi - CrawlURI to as for context.
http - Instance of httpclient.
method - Method to populate.
payload - Avatar payload to use populating the method.
Returns:
True if added a credentials.

isPost

public abstract boolean isPost(CrawlURI curi)
Parameters:
curi - CrawlURI to look at.
Returns:
True if this credential is to be posted. Return false if the credential is to be GET'd or if POST'd or GET'd are not pretinent to this credential type.

rootUriMatch

public boolean rootUriMatch(CrawlController controller,
                            CrawlURI curi)
Test passed curi matches this credentials rootUri.

Parameters:
controller -
curi - CrawlURI to test.
Returns:
True if domain for credential matches that of the passed curi.


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