org.ocd.dcf
Class DCContainer

java.lang.Object
  |
  +--org.ocd.dcf.DCContainer

public class DCContainer
extends java.lang.Object

DCContainer Basic Container for IXMLPersistable Components or Objects. This class doesnot implement IXMLPersistable However it can be used by Persistable Objects that wish to contain IXMLPersistable Objects.


Field Summary
protected static ICompFactory componentFactory
           
static java.lang.String CONTAINER_NODE_NAME
          Name of the node that will contain Container data
static java.lang.String CONTAINER_TYPE_ATTR
          attribute name for the container type MAP or LIST
static java.lang.String ITEM_ID_ATTR
           
static java.lang.String ITEM_INDEX_ATTR
           
static java.lang.String ITEM_NODE_NAME
          Name of the node that will contain each item
static int LIST
           
static java.lang.String LIST_STR
           
static int MAP
           
static java.lang.String MAP_STR
           
protected  java.util.ArrayList objectList
           
protected  java.util.HashMap objectMap
           
protected  java.util.HashSet objectSet
           
static int SET
           
static java.lang.String SET_STR
           
protected  int type
           
protected static IXMLParser xmlParser
           
 
Constructor Summary
DCContainer()
          Create a new DCContainer based on a MAP
DCContainer(int pType)
          Create a new DCContainer based on a Map
 
Method Summary
 void addDCContainerListener(DCContainerListener pListener)
          Add a Container Listener
 void addManagedObject(int index, IXMLPersistable pObject)
          Add an Object to this Container.
 void addManagedObject(java.lang.String id, IXMLPersistable pObject)
          Add an Object to this Container.
 boolean contains(IXMLPersistable pObject)
          return true if this container contains the Object
protected  void fireManagedObjectAdded(java.lang.Object pObject, int index)
          Fire object added Event
protected  void fireManagedObjectAdded(java.lang.Object pObject, java.lang.String id)
          Fire object added Event
protected  void fireManagedObjectRemoved(java.lang.Object pObject)
          Fire object Removed Event
 IXMLPersistable getManagedObject(int pIndex)
          Get the persistable Component by Index
 IXMLPersistable getManagedObject(java.lang.String pID)
          Get the persistable Component for an ID Map type Container only
 int getManagedObjectIndex(IXMLPersistable pObject)
          Get the Index of an Object
 IXMLPersistable[] getManagedObjects()
          Get the persistable Components that this Container contains
 org.w3c.dom.Document getObjectDocument(IXMLPersistable pObject)
          Get an XML Document for a Single IXMLPersistable object
 java.util.List getObjectList()
          Get the Map of Components
 java.util.Map getObjectMap()
          Get the Map of Components
 java.util.Set getObjectSet()
          Get the Set of Components
 int getType()
          Get Type MAP or LIST
 org.w3c.dom.Element getXMLElement(java.lang.String HREFPrefix)
          Get an XML Container Element that contains all managed Objects
 void removeDCContainerListener(DCContainerListener pListener)
          Remove a Container Listener
 void removeManagedObject(IXMLPersistable pObject)
          remove an Object from this Container
 void removeManagedObject(java.lang.String pID)
          remove an Object from this Container Map Type Containers Only
 boolean setXMLElement(org.w3c.dom.Element containerE, java.net.URL relativeURL)
          Set an XML Container Element that contains all managed Objects
 int size()
          The number of elements this Container is managing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTAINER_NODE_NAME

public static final java.lang.String CONTAINER_NODE_NAME
Name of the node that will contain Container data

CONTAINER_TYPE_ATTR

public static final java.lang.String CONTAINER_TYPE_ATTR
attribute name for the container type MAP or LIST

ITEM_NODE_NAME

public static final java.lang.String ITEM_NODE_NAME
Name of the node that will contain each item

ITEM_ID_ATTR

public static final java.lang.String ITEM_ID_ATTR

ITEM_INDEX_ATTR

public static final java.lang.String ITEM_INDEX_ATTR

LIST_STR

public static final java.lang.String LIST_STR

MAP_STR

public static final java.lang.String MAP_STR

SET_STR

public static final java.lang.String SET_STR

LIST

public static final int LIST

MAP

public static final int MAP

SET

public static final int SET

xmlParser

protected static IXMLParser xmlParser

componentFactory

protected static ICompFactory componentFactory

objectMap

protected java.util.HashMap objectMap

objectList

protected java.util.ArrayList objectList

objectSet

protected java.util.HashSet objectSet

type

protected int type
Constructor Detail

DCContainer

public DCContainer(int pType)
Create a new DCContainer based on a Map
Parameters:
pType - LIST, MAP, SET

DCContainer

public DCContainer()
Create a new DCContainer based on a MAP
Method Detail

addDCContainerListener

public void addDCContainerListener(DCContainerListener pListener)
Add a Container Listener

removeDCContainerListener

public void removeDCContainerListener(DCContainerListener pListener)
Remove a Container Listener

getManagedObjects

public IXMLPersistable[] getManagedObjects()
Get the persistable Components that this Container contains

getManagedObject

public IXMLPersistable getManagedObject(int pIndex)
Get the persistable Component by Index

getManagedObject

public IXMLPersistable getManagedObject(java.lang.String pID)
Get the persistable Component for an ID Map type Container only

addManagedObject

public void addManagedObject(java.lang.String id,
                             IXMLPersistable pObject)
Add an Object to this Container. ID is ignored for List or Set type Containers
Parameters:
id - of the Object
pObject - to add

addManagedObject

public void addManagedObject(int index,
                             IXMLPersistable pObject)
Add an Object to this Container. Index is used as the ID for a MAP type container. Index is ignored for Set Types
Parameters:
index - of the Object
pObject - to add

removeManagedObject

public void removeManagedObject(IXMLPersistable pObject)
remove an Object from this Container
Parameters:
pObject - to remove

removeManagedObject

public void removeManagedObject(java.lang.String pID)
remove an Object from this Container Map Type Containers Only
Parameters:
pObject - to remove

getObjectMap

public java.util.Map getObjectMap()
Get the Map of Components

getObjectList

public java.util.List getObjectList()
Get the Map of Components

getObjectSet

public java.util.Set getObjectSet()
Get the Set of Components

getType

public int getType()
Get Type MAP or LIST

fireManagedObjectAdded

protected void fireManagedObjectAdded(java.lang.Object pObject,
                                      java.lang.String id)
Fire object added Event

fireManagedObjectAdded

protected void fireManagedObjectAdded(java.lang.Object pObject,
                                      int index)
Fire object added Event

fireManagedObjectRemoved

protected void fireManagedObjectRemoved(java.lang.Object pObject)
Fire object Removed Event

getObjectDocument

public org.w3c.dom.Document getObjectDocument(IXMLPersistable pObject)
Get an XML Document for a Single IXMLPersistable object
Parameters:
pObject - to get Document For
Returns:
Document

getManagedObjectIndex

public int getManagedObjectIndex(IXMLPersistable pObject)
Get the Index of an Object

contains

public boolean contains(IXMLPersistable pObject)
return true if this container contains the Object

size

public int size()
The number of elements this Container is managing

getXMLElement

public org.w3c.dom.Element getXMLElement(java.lang.String HREFPrefix)
Get an XML Container Element that contains all managed Objects
Parameters:
HREFPrefix - the href that the id.dcf will be appended to as an Href for the Data location for each Component Node

setXMLElement

public boolean setXMLElement(org.w3c.dom.Element containerE,
                             java.net.URL relativeURL)
Set an XML Container Element that contains all managed Objects
Parameters:
containerE - the element for this container
relativeURL - the href that the id.blx will be appended to as an Href for the Data location for each Component Node
Returns:
true if successful or false if there where Errors