public class QueryContainer extends ResourceContainer
Resource
derived objects and
return the details of any of them that match a query specification. To do this,
the container uses a QueryDef derived query engine to evaluate the query expression,
of type QueryMediator
.
It uses the definition's executeQueryModel
method on the contents of each resource.
The query itself is sent as an XML-script that is a parsed version of the licas_text
package QueryModel
. You can use the related QueryParser
to parse to or from XML.
Alternatively, you can write your own query engine, that implements QueryDef
, pass
the class name as part of the constructor script Value
element and it will be created instead.
If you then add your own parser for a new query model, or still use the existing one,
you can perform your own evaluations.
resourceList
dataType, INFOANYTYPE, INFOBINARYTYPE, INFOHTMLTYPE, INFOSTREAMXMLTYPE, INFOSTRINGTYPE, INFOTEXTTYPE, INFOURLTYPE, INFOXMLTYPE, LISTCONTAINERTYPE, QUERYCONTAINERTYPE, RANDOMCONTAINERTYPE, uuid
Constructor and Description |
---|
QueryContainer(java.lang.String theDataType)
Create a new instance of QueryContainer.
|
QueryContainer(java.lang.String theDataType,
org.licas_xml.abs.Element dataXml)
Create a new instance of QueryContainer.
|
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 QueryContainer(java.lang.String theDataType) throws java.lang.Exception
theDataType
- the container type.java.lang.Exception
- any error.public QueryContainer(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 a different query engine type.
This would be the class name and is assumed to be from a local jar file.
It would be stored in another Value
element that could be created using
MetaFactory.addXML(adminData, (MetaFactory.createMetaValueXML(Const.VALUE, query-engine-class),
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
public java.lang.Object getValue(org.licas_xml.abs.Element infoDescr) throws java.lang.Exception
getInfo
and returns
the same query reply Element
.