org.archive.crawler.datamodel.credential
Class Rfc2617Credential

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
                      extended by org.archive.crawler.datamodel.credential.Rfc2617Credential
All Implemented Interfaces:
java.io.Serializable, javax.management.DynamicMBean

public class Rfc2617Credential
extends Credential

A Basic/Digest auth RFC2617 credential.

Version:
$Revision: 4668 $, $Date: 2006-09-26 21:49:01 +0000 (Tue, 26 Sep 2006) $
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
Rfc2617Credential(java.lang.String name)
          Constructor.
 
Method Summary
static Rfc2617Credential getByRealm(java.util.Set rfc2617Credentials, java.lang.String realm, CrawlURI context)
          Convenience method that does look up on passed set using realm for key.
 java.lang.String getKey(CrawlURI context)
           
 java.lang.String getLogin(CrawlURI context)
           
 java.lang.String getPassword(CrawlURI context)
           
 java.lang.String getPrerequisite(CrawlURI curi)
          Return the authentication URI, either absolute or relative, that serves as prerequisite the passed curi.
 java.lang.String getRealm(CrawlURI context)
           
 boolean hasPrerequisite(CrawlURI curi)
           
 boolean isEveryTime()
           
 boolean isPost(CrawlURI curi)
           
 boolean isPrerequisite(CrawlURI curi)
           
 boolean populate(CrawlURI curi, org.apache.commons.httpclient.HttpClient http, org.apache.commons.httpclient.HttpMethod method, java.lang.String payload)
           
 
Methods inherited from class org.archive.crawler.datamodel.credential.Credential
attach, attach, detach, detachAll, getCredentialDomain, rootUriMatch, setCredentialDomain
 
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

Rfc2617Credential

public Rfc2617Credential(java.lang.String name)
Constructor. A constructor that takes name of the credential is required by settings framework.

Parameters:
name - Name of this credential.
Method Detail

getRealm

public java.lang.String getRealm(CrawlURI context)
                          throws javax.management.AttributeNotFoundException
Parameters:
context - Context to use when searching the realm.
Returns:
Realm using set context.
Throws:
javax.management.AttributeNotFoundException

getLogin

public java.lang.String getLogin(CrawlURI context)
                          throws javax.management.AttributeNotFoundException
Parameters:
context - CrawlURI ontext to use.
Returns:
login to use doing credential.
Throws:
javax.management.AttributeNotFoundException

getPassword

public java.lang.String getPassword(CrawlURI context)
                             throws javax.management.AttributeNotFoundException
Parameters:
context - CrawlURI ontext to use.
Returns:
Password to use doing credential.
Throws:
javax.management.AttributeNotFoundException

isPrerequisite

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

hasPrerequisite

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

getPrerequisite

public java.lang.String getPrerequisite(CrawlURI curi)
Description copied from class: Credential
Return the authentication URI, either absolute or relative, that serves as prerequisite the passed curi.

Specified by:
getPrerequisite in class Credential
Parameters:
curi - CrawlURI to look at.
Returns:
Prerequisite URI for the passed curi.

getKey

public java.lang.String getKey(CrawlURI context)
                        throws javax.management.AttributeNotFoundException
Specified by:
getKey in class Credential
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 boolean isEveryTime()
Specified by:
isEveryTime in class Credential
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 boolean populate(CrawlURI curi,
                        org.apache.commons.httpclient.HttpClient http,
                        org.apache.commons.httpclient.HttpMethod method,
                        java.lang.String payload)
Specified by:
populate in class Credential
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 boolean isPost(CrawlURI curi)
Specified by:
isPost in class Credential
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.

getByRealm

public static Rfc2617Credential getByRealm(java.util.Set rfc2617Credentials,
                                           java.lang.String realm,
                                           CrawlURI context)
Convenience method that does look up on passed set using realm for key.

Parameters:
rfc2617Credentials - Set of Rfc2617 credentials. If passed set is not pure Rfc2617Credentials then will be ClassCastExceptions.
realm - Realm to find in passed set.
context - Context to use when searching the realm.
Returns:
Credential of passed realm name else null. If more than one credential w/ passed realm name, and there shouldn't be, we return first found.


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