public class RandomContainer extends ResourceContainer
Resource
derived objects and
randomly return the details of one of them upon request.resourceList
dataType, INFOANYTYPE, INFOBINARYTYPE, INFOHTMLTYPE, INFOSTREAMXMLTYPE, INFOSTRINGTYPE, INFOTEXTTYPE, INFOURLTYPE, INFOXMLTYPE, LISTCONTAINERTYPE, QUERYCONTAINERTYPE, RANDOMCONTAINERTYPE, uuid
Constructor and Description |
---|
RandomContainer(java.lang.String theDataType)
Create a new instance of RandomContainer.
|
RandomContainer(java.lang.String theDataType,
org.licas_xml.abs.Element dataXml)
Create a new instance of RandomContainer.
|
Modifier and Type | Method and Description |
---|---|
org.licas_xml.abs.Element |
getInfo(org.licas_xml.abs.Element infoDescr)
Get the source information wrapped in an XML element.
|
java.lang.Object |
getValue(org.licas_xml.abs.Element infoDescr)
Get the currently selected value itself and not a wrapped description.
|
protected boolean |
parseInfo(org.licas_xml.abs.Element dataXml)
Parse the data description in the admin document to create the data object.
|
addResource, createContainer, getResource, getResourceIDs, removeResource
createResource, dataFromResourceType, getDataType, getUUID, parseValueElem, resourceTypeForDataType, setUUID, setUUID
public RandomContainer(java.lang.String theDataType) throws java.lang.Exception
theDataType
- the container type.java.lang.Exception
- any error.public RandomContainer(java.lang.String theDataType, org.licas_xml.abs.Element dataXml) throws java.lang.Exception
theDataType
- the container type.dataXml
- a description of the initialisation parameters.java.lang.Exception
- any error.protected boolean parseInfo(org.licas_xml.abs.Element dataXml) throws java.lang.Exception
parseInfo
in class ResourceContainer
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.
The Value
element can also optionally store the random number generator
initialisation value (of type long). If this is missing, then the current date is used.
This would be another Value
element that could be created using
MetaFactory.addXML(adminData, (MetaFactory.createMetaValueXML(Const.VALUE, rnd-init),
Const.VALUE)
, for example.java.lang.Exception
- any error.public org.licas_xml.abs.Element getInfo(org.licas_xml.abs.Element infoDescr) throws java.lang.Exception
getInfo
in class Resource
infoDescr
- a description of the info resource value that should be retrieved.java.lang.Exception
- any error.public java.lang.Object getValue(org.licas_xml.abs.Element infoDescr) throws java.lang.Exception