public class QuerySchemaLoader
extends java.lang.Object
Schemas should be specified as follows:
<schema>
<schemaName> name of the schema </schemaName>
<dataSchemaName> name of the data schema over which this query is run </dataSchemaName>
<selectorName> name of the element in the data schema that will be the selector </selectorName>
<elements>
<name> element name of element in the data schema to include in the query response; just
as with the data schema, the element name is case sensitive</name>
</elements>
<filter> (optional) name of the filter class to use to filter the data </filter>
<filterNames> (optional)
<name> element name of element in the data schema to apply pre-processing filters </name>
</filterNames>
<additional> (optional) additional fields for the query schema, in <key,value> pairs
<field>
<key> key corresponding the the field </key>
<value> value corresponding to the field </value>
</field>
</additional>
</schema>
TODO: Allow the schema to specify how many array elements to return per element, if the element is an array type
Constructor and Description |
---|
QuerySchemaLoader()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
initialize()
Initializes the static
QuerySchemaRegistry with a list of query schema names. |
static void |
initialize(boolean hdfs,
org.apache.hadoop.fs.FileSystem fs)
Initializes the static
QuerySchemaRegistry with a list of available query schema names. |
QuerySchema |
loadSchema(java.io.InputStream stream)
Returns the query schema as defined in XML format on the given stream.
|
public static void initialize() throws PIRException
QuerySchemaRegistry
with a list of query schema names.PIRException
- - failed to initializepublic static void initialize(boolean hdfs, org.apache.hadoop.fs.FileSystem fs) throws PIRException
QuerySchemaRegistry
with a list of available query schema names.hdfs
- If true, specifies that the query schema is an hdfs file; if false, that it is a regular file.fs
- Used only when hdfs
is true; the FileSystem
handle for the hdfs in which the query schema existsPIRException
- - failed to initialize the query schemas because they could not be read or are invalid.public QuerySchema loadSchema(java.io.InputStream stream) throws java.io.IOException, PIRException
stream
- The source of the XML query schema description.java.io.IOException
- A problem occurred reading from the given stream.PIRException
- The schema description is invalid.