|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.metatype.MetaDataReader
public class MetaDataReader
The MetaDataReader
provides two methods to read meta type
documents according to the MetaType schema (105.8 XML Schema). The
parse(URL)
and parse(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 AD
class to overwrite
the AD.validate(String)
method. In this case, the createAD()
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 | |
---|---|
MetaDataReader()
|
Method Summary | |
---|---|
protected AD |
createAD()
Creates a new AD object to hold the contents of the
AD element. |
protected Attribute |
createAttribute()
Creates a new Attribute object to hold the contents of the
Attribute element. |
protected Designate |
createDesignate()
Creates a new Designate object to hold the contents of the
Designate element. |
protected DesignateObject |
createDesignateObject()
Creates a new DesignateObject object to hold the contents of the
Object element. |
protected MetaData |
createMetaData()
Creates a new MetaData object to hold the contents of the
MetaData element. |
protected OCD |
createOCD()
Creates a new OCD object to hold the contents of the
OCD element. |
MetaData |
parse(java.io.InputStream ins)
Parses the XML document in the given input stream. |
MetaData |
parse(java.net.URL url)
Parses the XML document provided by the url . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MetaDataReader()
Method Detail |
---|
public MetaData parse(java.net.URL url) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
url
. 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.
url
- The URL
providing access to the XML document.
MetaData
providing access to the
raw contents of the XML document.
java.io.IOException
- If an I/O error occurrs accessing the stream.
org.xmlpull.v1.XmlPullParserException
- If an error occurrs parsing the XML
document.public MetaData parse(java.io.InputStream ins) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException
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.
ins
- The InputStream
providing the XML document
MetaData
providing access to the
raw contents of the XML document.
java.io.IOException
- If an I/O error occurrs accessing the stream.
org.xmlpull.v1.XmlPullParserException
- If an error occurrs parsing the XML
document.protected MetaData createMetaData()
MetaData
object to hold the contents of the
MetaData
element.
This method may be overwritten to return a customized extension.
protected OCD createOCD()
OCD
object to hold the contents of the
OCD
element.
This method may be overwritten to return a customized extension.
protected AD createAD()
AD
object to hold the contents of the
AD
element.
This method may be overwritten to return a customized extension.
protected DesignateObject createDesignateObject()
DesignateObject
object to hold the contents of the
Object
element.
This method may be overwritten to return a customized extension.
protected Attribute createAttribute()
Attribute
object to hold the contents of the
Attribute
element.
This method may be overwritten to return a customized extension.
protected Designate createDesignate()
Designate
object to hold the contents of the
Designate
element.
This method may be overwritten to return a customized extension.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |