org.archive.crawler.settings
Class MapType

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

public class MapType
extends ComplexType

This class represents a container of settings. This class is usually used to make it possible to have a dynamic number of ModuleTypes like for instance a list of filters of different type. When this type is overridden on a per domain basis, the following restrictions apply:

Author:
John Erik Halse
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.archive.crawler.settings.ComplexType
ComplexType.Context, ComplexType.MBeanAttributeInfoIterator
 
Field Summary
 
Fields inherited from class org.archive.crawler.settings.ComplexType
definitionMap
 
Constructor Summary
MapType(java.lang.String name, java.lang.String description)
          Construct a new MapType object.
MapType(java.lang.String name, java.lang.String description, java.lang.Class type)
          Construct a new MapType object.
 
Method Summary
 void addConstraint(Constraint constraint)
          Add a constraint to this type.
 Type addElement(CrawlerSettings settings, Type element)
          Add a new element to this map.
(package private)  Constraint.FailedCheck checkValue(CrawlerSettings settings, java.lang.String attributeName, Type definition, java.lang.Object value)
           
 java.util.List getConstraints()
          Returns a list of constraints for the value of this type.
 java.lang.Class getContentType()
          Get the content type allowed for this map.
(package private)  Type getDefinition(java.lang.String attributeName)
          Get the content type definition for attributes of this map.
 boolean isEmpty(java.lang.Object context)
          Returns true if this map is empty.
 boolean moveElementDown(CrawlerSettings settings, java.lang.String name)
          Move an attribute down one place in the list.
 boolean moveElementUp(CrawlerSettings settings, java.lang.String name)
          Move an attribute up one place in the list.
 java.lang.Object removeElement(CrawlerSettings settings, java.lang.String name)
          Remove an attribute from the map.
 int size(java.lang.Object context)
          Get the number of elements in this map.
 
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, getSettingsFromObject, getSettingsFromObject, 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
equals, 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

MapType

public MapType(java.lang.String name,
               java.lang.String description)
Construct a new MapType object.

Parameters:
name - the name of this element.
description - the description of the attribute.

MapType

public MapType(java.lang.String name,
               java.lang.String description,
               java.lang.Class type)
Construct a new MapType object.

Parameters:
name - the name of this element.
description - the description of the attribute.
type - the type allowed for this map
Method Detail

addElement

public Type addElement(CrawlerSettings settings,
                       Type element)
                throws javax.management.InvalidAttributeValueException
Add a new element to this map.

Overrides:
addElement in class ComplexType
Parameters:
settings - the settings object for this method to have effect.
element - the element to be added.
Returns:
Element added.
Throws:
javax.management.InvalidAttributeValueException

removeElement

public java.lang.Object removeElement(CrawlerSettings settings,
                                      java.lang.String name)
                               throws javax.management.AttributeNotFoundException
Remove an attribute from the map.

Parameters:
settings - the settings object for which this method has effect.
name - name of the attribute to remove.
Returns:
the element that was removed.
Throws:
javax.management.AttributeNotFoundException - is thrown if there is no attribute with the submitted name.

moveElementUp

public boolean moveElementUp(CrawlerSettings settings,
                             java.lang.String name)
                      throws javax.management.AttributeNotFoundException
Move an attribute up one place in the list.

Parameters:
settings - the settings object for which this method has effect.
name - name of attribute to move.
Returns:
true if attribute was moved, false if attribute was already at the top.
Throws:
javax.management.AttributeNotFoundException - is thrown if there is no attribute with the submitted name.

moveElementDown

public boolean moveElementDown(CrawlerSettings settings,
                               java.lang.String name)
                        throws javax.management.AttributeNotFoundException
Move an attribute down one place in the list.

Parameters:
settings - the settings object for which this method has effect.
name - name of attribute to move.
Returns:
true if attribute was moved, false if attribute was already at bottom.
Throws:
javax.management.AttributeNotFoundException - is thrown if there is no attribute with the submitted name.

isEmpty

public boolean isEmpty(java.lang.Object context)
Returns true if this map is empty.

Parameters:
context - the settings object for which this set of elements are valid.
Returns:
true if this map is empty.

size

public int size(java.lang.Object context)
Get the number of elements in this map.

Parameters:
context - the settings object for which this set of elements are valid.
Returns:
the number of elements in this map.

getDefinition

Type getDefinition(java.lang.String attributeName)
Get the content type definition for attributes of this map.

Overrides:
getDefinition in class ComplexType
Parameters:
attributeName - since all attributes of a map are of the same type, this value is not used.
Returns:
the content type definition for attributes of this map.

getContentType

public java.lang.Class getContentType()
Get the content type allowed for this map.

Returns:
the content type allowed for this map.

checkValue

Constraint.FailedCheck checkValue(CrawlerSettings settings,
                                  java.lang.String attributeName,
                                  Type definition,
                                  java.lang.Object value)
Overrides:
checkValue in class ComplexType

addConstraint

public void addConstraint(Constraint constraint)
Description copied from class: Type
Add a constraint to this type. Every constraint must be fulfilled for a value of this type to be valid.

Overrides:
addConstraint in class Type
Parameters:
constraint - the constraint to add.

getConstraints

public java.util.List getConstraints()
Description copied from class: Type
Returns a list of constraints for the value of this type.

Overrides:
getConstraints in class Type
Returns:
Returns the constraints or null if there aren't any.


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