org.archive.crawler.datamodel
Class CredentialStore

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.CredentialStore
All Implemented Interfaces:
java.io.Serializable, javax.management.DynamicMBean

public class CredentialStore
extends ModuleType

Front door to the credential store. Come here to get at credentials.

See Credential Store Design.

Version:
$Revision: 4656 $, $Date: 2006-09-25 21:34:50 +0000 (Mon, 25 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
static java.lang.String ATTR_CREDENTIALS
          Name of the contained credentials map type.
static java.lang.String ATTR_NAME
           
 
Fields inherited from class org.archive.crawler.settings.ComplexType
definition, definitionMap
 
Constructor Summary
CredentialStore(java.lang.String name)
          Constructor.
 
Method Summary
 Credential create(CrawlerSettings context, java.lang.String name, java.lang.Class type)
          Create and add to the list a credential of the passed type giving the credential the passed name.
protected  MapType get(java.lang.Object context)
           
 Credential get(java.lang.Object context, java.lang.String name)
           
static CredentialStore getCredentialStore(SettingsHandler context)
          Get a credential store reference.
static java.util.List getCredentialTypes()
           
 java.util.Iterator iterator(java.lang.Object context)
          Get an Iterator over all the attributes in this ComplexType.
 void remove(CrawlerSettings context, Credential credential)
          Delete the credential name.
 void remove(CrawlerSettings context, java.lang.String name)
          Delete the credential name.
 java.util.Set subset(CrawlURI context, java.lang.Class type)
          Return set made up of all credentials of the passed type.
 java.util.Set<Credential> subset(CrawlURI context, java.lang.Class type, java.lang.String rootUri)
          Return set made up of all credentials of the passed type.
 
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, 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
 

Field Detail

ATTR_NAME

public static final java.lang.String ATTR_NAME
See Also:
Constant Field Values

ATTR_CREDENTIALS

public static final java.lang.String ATTR_CREDENTIALS
Name of the contained credentials map type.

See Also:
Constant Field Values
Constructor Detail

CredentialStore

public CredentialStore(java.lang.String name)
Constructor.

Parameters:
name - for this credential store.
Method Detail

getCredentialTypes

public static java.util.List getCredentialTypes()
Returns:
Unmodifable list of credential types.

getCredentialStore

public static CredentialStore getCredentialStore(SettingsHandler context)
Get a credential store reference.

Parameters:
context - A settingshandler object.
Returns:
A credential store or null if we failed getting one.

get

protected MapType get(java.lang.Object context)
               throws javax.management.AttributeNotFoundException
Parameters:
context - Pass a CrawlURI, CrawlerSettings or UURI. Used to set context. If null, we use global context.
Returns:
A map of all credentials from passed context.
Throws:
javax.management.AttributeNotFoundException

iterator

public java.util.Iterator iterator(java.lang.Object context)
Description copied from class: ComplexType
Get an Iterator over all the attributes in this ComplexType.

Overrides:
iterator in class ComplexType
Parameters:
context - Pass a CrawlURI, CrawlerSettings or UURI. Used to set context. If null, we use global context.
Returns:
An iterator or null.

get

public Credential get(java.lang.Object context,
                      java.lang.String name)
               throws javax.management.AttributeNotFoundException,
                      javax.management.MBeanException,
                      javax.management.ReflectionException
Parameters:
context - Pass a CrawlURI, CrawlerSettings or UURI. Used to set context. If null, we use global context.
name - Name to give the manufactured credential. Should be unique else the add of the credential to the list of credentials will fail.
Returns:
Returns name'd credential.
Throws:
javax.management.AttributeNotFoundException
javax.management.MBeanException
javax.management.ReflectionException

create

public Credential create(CrawlerSettings context,
                         java.lang.String name,
                         java.lang.Class type)
                  throws java.lang.IllegalArgumentException,
                         java.lang.reflect.InvocationTargetException,
                         javax.management.InvalidAttributeValueException,
                         javax.management.AttributeNotFoundException
Create and add to the list a credential of the passed type giving the credential the passed name.

Parameters:
context - Pass a CrawlerSettings. Used to set context. If null, we use global context.
name - Name to give the manufactured credential. Should be unique else the add of the credential to the list of credentials will fail.
type - Type of credentials to get.
Returns:
The credential created and added to the list of credentials.
Throws:
java.lang.IllegalArgumentException
javax.management.AttributeNotFoundException
java.lang.reflect.InvocationTargetException
javax.management.InvalidAttributeValueException

remove

public void remove(CrawlerSettings context,
                   Credential credential)
            throws javax.management.AttributeNotFoundException,
                   java.lang.IllegalArgumentException
Delete the credential name.

Parameters:
context - Pass a CrawlerSettings. Used to set context. If null, we use global context.
credential - Credential to delete.
Throws:
java.lang.IllegalArgumentException
javax.management.AttributeNotFoundException

remove

public void remove(CrawlerSettings context,
                   java.lang.String name)
            throws java.lang.IllegalArgumentException,
                   javax.management.AttributeNotFoundException
Delete the credential name.

Parameters:
context - Pass a CrawlerSettings. Used to set context. If null, we use global context.
name - Name of credential to delete.
Throws:
java.lang.IllegalArgumentException
javax.management.AttributeNotFoundException

subset

public java.util.Set subset(CrawlURI context,
                            java.lang.Class type)
Return set made up of all credentials of the passed type.

Parameters:
context - Pass a CrawlURI or a CrawlerSettings. Used to set context. If null, we use global context.
type - Type of the list to return. Type is some superclass of credentials.
Returns:
Unmodifable sublist of all elements of passed type.

subset

public java.util.Set<Credential> subset(CrawlURI context,
                                        java.lang.Class type,
                                        java.lang.String rootUri)
Return set made up of all credentials of the passed type.

Parameters:
context - Pass a CrawlURI or a CrawlerSettings. Used to set context. If null, we use global context.
type - Type of the list to return. Type is some superclass of credentials.
rootUri - RootUri to match. May be null. In this case we return all. Currently we expect the CrawlServer name to equate to root Uri. Its not. Currently it doesn't distingush between servers of same name but different ports (e.g. http and https).
Returns:
Unmodifable sublist of all elements of passed type.


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