org.archive.crawler.settings
Class DataContainer

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<java.lang.String,java.lang.Object>
          extended by org.archive.crawler.settings.DataContainer
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.Object>

public class DataContainer
extends java.util.HashMap<java.lang.String,java.lang.Object>

This class holds the data for a ComplexType for a settings object.

Author:
John Erik Halse
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
DataContainer(CrawlerSettings settings, ComplexType module)
          Create a data container for a module.
 
Method Summary
 void addElementType(Type type)
          Appends the specified element to the end of this data container.
 void addElementType(Type type, int index)
          Add a new element to the data container.
protected  boolean copyAttribute(java.lang.String name, DataContainer destination)
           
protected  void copyAttributeInfo(java.lang.String name, DataContainer destination)
           
 java.lang.Object get(java.lang.Object key)
           
 java.lang.Object get(java.lang.String key)
           
protected  javax.management.MBeanAttributeInfo getAttributeInfo(java.lang.String name)
           
protected  ComplexType getComplexType()
          Get the ComplexType for which this DataContainer keeps data.
protected  java.util.List<javax.management.MBeanAttributeInfo> getLocalAttributeInfoList()
           
 javax.management.MBeanInfo getMBeanInfo()
           
protected  CrawlerSettings getSettings()
          Get the settings object for which this DataContainers data are valid.
protected  boolean hasAttributes()
           
protected  boolean moveElementDown(java.lang.String key)
          Move an attribute down one place in the list.
protected  boolean moveElementUp(java.lang.String key)
          Move an attribute up one place in the list.
protected  java.lang.Object put(java.lang.String key, javax.management.MBeanAttributeInfo info, java.lang.Object value)
           
 java.lang.Object put(java.lang.String key, java.lang.Object value)
           
protected  java.lang.Object removeElement(java.lang.String key)
          Remove an attribute from the DataContainer.
 int size()
           
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, remove, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

DataContainer

public DataContainer(CrawlerSettings settings,
                     ComplexType module)
Create a data container for a module.

Parameters:
settings - Settings to use.
module - the module to create the data container for.
Method Detail

addElementType

public void addElementType(Type type,
                           int index)
                    throws javax.management.InvalidAttributeValueException
Add a new element to the data container.

Parameters:
type - the element to add.
index - index at which the specified element is to be inserted.
Throws:
javax.management.InvalidAttributeValueException

addElementType

public void addElementType(Type type)
                    throws javax.management.InvalidAttributeValueException
Appends the specified element to the end of this data container.

Parameters:
type - the element to add.
Throws:
javax.management.InvalidAttributeValueException

getMBeanInfo

public javax.management.MBeanInfo getMBeanInfo()

getLocalAttributeInfoList

protected java.util.List<javax.management.MBeanAttributeInfo> getLocalAttributeInfoList()

hasAttributes

protected boolean hasAttributes()

size

public int size()
Specified by:
size in interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
size in class java.util.HashMap<java.lang.String,java.lang.Object>

getAttributeInfo

protected javax.management.MBeanAttributeInfo getAttributeInfo(java.lang.String name)

copyAttributeInfo

protected void copyAttributeInfo(java.lang.String name,
                                 DataContainer destination)

copyAttribute

protected boolean copyAttribute(java.lang.String name,
                                DataContainer destination)
                         throws javax.management.InvalidAttributeValueException,
                                javax.management.AttributeNotFoundException
Throws:
javax.management.InvalidAttributeValueException
javax.management.AttributeNotFoundException

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
put in class java.util.HashMap<java.lang.String,java.lang.Object>

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
get in class java.util.HashMap<java.lang.String,java.lang.Object>

put

protected java.lang.Object put(java.lang.String key,
                               javax.management.MBeanAttributeInfo info,
                               java.lang.Object value)
                        throws javax.management.InvalidAttributeValueException,
                               javax.management.AttributeNotFoundException
Throws:
javax.management.InvalidAttributeValueException
javax.management.AttributeNotFoundException

get

public java.lang.Object get(java.lang.String key)
                     throws javax.management.AttributeNotFoundException
Throws:
javax.management.AttributeNotFoundException

moveElementUp

protected boolean moveElementUp(java.lang.String key)
                         throws javax.management.AttributeNotFoundException
Move an attribute up one place in the list.

Parameters:
key - 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 key.

moveElementDown

protected boolean moveElementDown(java.lang.String key)
                           throws javax.management.AttributeNotFoundException
Move an attribute down one place in the list.

Parameters:
key - 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 key.

removeElement

protected java.lang.Object removeElement(java.lang.String key)
                                  throws javax.management.AttributeNotFoundException
Remove an attribute from the DataContainer.

Parameters:
key - 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 key.

getComplexType

protected ComplexType getComplexType()
Get the ComplexType for which this DataContainer keeps data.

Returns:
the ComplexType for which this DataContainer keeps data.

getSettings

protected CrawlerSettings getSettings()
Get the settings object for which this DataContainers data are valid.

Returns:
the settings object for which this DataContainers data are valid.


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