public abstract class ResourceContainer extends Resource
Resource
derived objects that
can then be invoked upon request. The resource objects do not have to be of the same
type and it is their getInfo
or getValue
methods that are invoked.
A container might be initialised with a script that includes the details of the stored
resources.
MetaFactory.getFactoryData().createResourceContainerXML(containerType)
and then add to the element: containerXml.valueXml.addContent(MetaFactory.getFactoryData().createDataValueXML(dataType, infoData))
.
Modifier and Type | Field and Description |
---|---|
protected java.util.LinkedHashMap<java.lang.String,Resource> |
resourceList
The object-based information
|
dataType, INFOANYTYPE, INFOBINARYTYPE, INFOHTMLTYPE, INFOSTREAMXMLTYPE, INFOSTRINGTYPE, INFOTEXTTYPE, INFOURLTYPE, INFOXMLTYPE, LISTCONTAINERTYPE, QUERYCONTAINERTYPE, RANDOMCONTAINERTYPE, uuid
Constructor and Description |
---|
ResourceContainer(java.lang.String theDataType)
Create a new instance of ResourceContainer.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addResource(Resource resource)
Add a new resource.
|
static Resource |
createContainer(java.lang.String dataType,
org.licas_xml.abs.Element dataXml)
Create a resource container object and return.
|
Resource |
getResource(java.lang.String key)
Get the resource relating to the key identifier.
|
java.util.ArrayList<java.lang.String> |
getResourceIDs()
Get a list of IDs used to identify each resource in the container.
|
protected boolean |
parseInfo(org.licas_xml.abs.Element dataXml)
Parse the data description in the admin document to create the data object.
|
boolean |
removeResource(java.lang.String key)
Remove the resource relating to the key identifier.
|
createResource, dataFromResourceType, getDataType, getInfo, getUUID, getValue, parseValueElem, resourceTypeForDataType, setUUID, setUUID
protected java.util.LinkedHashMap<java.lang.String,Resource> resourceList
public ResourceContainer(java.lang.String theDataType) throws java.lang.Exception
theDataType
- the container type.java.lang.Exception
- any error.protected boolean parseInfo(org.licas_xml.abs.Element dataXml) throws java.lang.Exception
parseInfo
in class Resource
dataXml
- the Data
element of the admin document. This should include
the container DataType
element and a Value
element that stores
a list of child Data
elements that store information for each resource to create.
These are processed as defined in the individual resource object comments.java.lang.Exception
- any error.public java.util.ArrayList<java.lang.String> getResourceIDs()
public boolean addResource(Resource resource)
resource
- the resource to add.public Resource getResource(java.lang.String key)
key
- unique uuid identifier for the resource.public boolean removeResource(java.lang.String key)
key
- unique uuid identifier for the resource.public static Resource createContainer(java.lang.String dataType, org.licas_xml.abs.Element dataXml) throws java.lang.Exception
dataType
- the type of container to create, for example:
TypeConst
.IDCONTAINER
, RANDOMCONTAINER
or QUERYCONTAINER
.dataXml
- a description of the initialisation parameters. Can be null.java.lang.Exception
- any error.