Class MetaDataReader
- java.lang.Object
-
- org.apache.felix.metatype.MetaDataReader
-
public class MetaDataReader extends java.lang.ObjectTheMetaDataReaderprovides two methods to read meta type documents according to the MetaType schema (105.8 XML Schema). Theparse(URL)andparse(InputStream)methods may be called multiple times to parse such documents.While reading the XML document java objects are created to hold the data. These objects are created by factory methods. Users of this may extend this class by overwriting the the factory methods to create specialized versions. One notable use of this is the extension of the
ADclass to overwrite theAD.validate(String)method. In this case, thecreateAD()method would be overwritten to return an instance of the extending class.This class is not thread safe. Using instances of this class in multiple threads concurrently is not supported and will fail.
-
-
Constructor Summary
Constructors Constructor Description MetaDataReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MetaDataparse(java.io.InputStream ins)Parses the XML document in the given input stream.MetaDataparse(java.net.URL url)Parses the XML document provided by theurl.
-
-
-
Method Detail
-
parse
public MetaData parse(java.net.URL url) throws java.io.IOException
Parses the XML document provided by theurl. The XML document must be at the beginning of the stream contents.This method is almost identical to
return parse(url.openStream());but also sets the string representation of the URL as a location helper for error messages.- Parameters:
url- TheURLproviding access to the XML document.- Returns:
- A
MetaDataproviding access to the raw contents of the XML document. - Throws:
java.io.IOException- If an I/O error occurs accessing the stream or parsing the XML document.
-
parse
public MetaData parse(java.io.InputStream ins) throws java.io.IOException
Parses the XML document in the given input stream.This method starts reading at the current position of the input stream and returns immediately after completely reading a single meta type document. The stream is not closed by this method.
- Parameters:
ins- TheInputStreamproviding the XML document- Returns:
- A
MetaDataproviding access to the raw contents of the XML document. - Throws:
java.io.IOException- If an I/O error occurs accessing the stream or parsing the XML document.
-
-