public class DataSchemaLoader
extends java.lang.Object
Schemas should be specified as follows:
<schema>
<schemaName> name of the schema </schemaName>
<element>
<name> element name; note that element names are case sensitive </name>
<type> class name or type name (if Java primitive type) of the element </type>
<isArray> whether or not the schema element is an array within the data.
Set to true by including this tag with no text or the string "true" (comparison is case-insensitive).
Omitting this tag or using any other text indicates this element is not an array.</isArray>
<partitioner> optional - Partitioner class for the element; defaults to primitive java type partitioner </partitioner>
</element>
</schema>
Primitive types must be one of the following: "byte", "short", "int", "long", "float", "double", "char", "string"
Constructor and Description |
---|
DataSchemaLoader()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
initialize()
Initializes the static
DataSchemaRegistry with a list of available data schema names. |
static void |
initialize(boolean hdfs,
org.apache.hadoop.fs.FileSystem fs)
Initializes the static
DataSchemaRegistry with a list of available data schema names. |
DataSchema |
loadSchema(java.io.InputStream stream)
Returns the data schema as defined in XML format on the given stream.
|
public static void initialize() throws PIRException
DataSchemaRegistry
with a list of available data schema names.PIRException
- - failed to initializepublic static void initialize(boolean hdfs, org.apache.hadoop.fs.FileSystem fs) throws PIRException
DataSchemaRegistry
with a list of available data schema names.hdfs
- If true, specifies that the data 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 data schema existsPIRException
- - failed to initialize the data schemas because they could not be read or are invalid.public DataSchema loadSchema(java.io.InputStream stream) throws java.io.IOException, PIRException
stream
- The source of the XML data schema description.java.io.IOException
- A problem occurred reading from the given stream.PIRException
- The schema description is invalid.