org.apache.felix.ipojo.parser

## Class ManifestMetadataParser

- java.lang.Object
- - org.apache.felix.ipojo.parser.ManifestMetadataParser

    public class ManifestMetadataParser
    extends java.lang.Object

The Manifest Metadata parser reads a manifest file and builds the iPOJO metadata (`Element` / `Attribute` ) structure.

Author:
  Felix Project Team

### Constructor Summary

Constructors
Constructor and Description
`ManifestMetadataParser()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`org.apache.felix.ipojo.metadata.Element[]` `getComponentsMetadata()` Gets the array of component type metadata.
`java.util.Dictionary[]` `getInstances()` Gets the array of instance configuration described in the metadata.
`void` `parse(java.util.Dictionary dict)` Looks for the `iPOJO-Components` header in the given dictionary.
`static org.apache.felix.ipojo.metadata.Element` `parse(java.lang.String metadata)` Parses the metadata from the string given in argument.
`void` `parseHeader(java.lang.String header)` Parses the given header, initialized the `m_elements` list (adds the `iPOJO` element) and parses contained component type declarations and instance configurations.
`static org.apache.felix.ipojo.metadata.Element` `parseHeaderMetadata(java.lang.String header)` Parses the metadata from the given header string.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ManifestMetadataParser

    public ManifestMetadataParser()

### Method Detail

#### getComponentsMetadata

    public org.apache.felix.ipojo.metadata.Element[] getComponentsMetadata()
                                                                    throws ParseException

Gets the array of component type metadata.

Returns:
  the component metadata (composite & component). An empty array is returned if no component type declaration.
Throws:
  `ParseException` - if a parsing error occurs

#### getInstances

    public java.util.Dictionary[] getInstances()
                                        throws ParseException

Gets the array of instance configuration described in the metadata.

Returns:
  the instances list or `null` if no instance configuration.
Throws:
  `ParseException` - if the metadata cannot be parsed successfully

#### parse

    public void parse(java.util.Dictionary dict)
               throws ParseException

Looks for the `iPOJO-Components` header in the given dictionary. Then, initializes the `m_elements` list (adds the `iPOJO` root element) and parses the contained component type declarations and instance configurations.

Parameters:
  `dict` - the given headers of the manifest file
Throws:
  `ParseException` - if any error occurs

#### parseHeader

    public void parseHeader(java.lang.String header)
                     throws ParseException

Parses the given header, initialized the `m_elements` list (adds the `iPOJO` element) and parses contained component type declarations and instance configurations.

Parameters:
  `header` - the given header of the manifest file
Throws:
  `ParseException` - if any error occurs

#### parse

    public static org.apache.felix.ipojo.metadata.Element parse(java.lang.String metadata)
                                                         throws ParseException

Parses the metadata from the string given in argument. This methods creates a new `ManifestMetadataParser` object and calls the `parseElements(String)` method. The parsing must result as a tree (only one root element).

Parameters:
  `metadata` - the metadata to parse
Returns:
  Element the root element resulting of the parsing
Throws:
  `ParseException` - if any error occurs

#### parseHeaderMetadata

    public static org.apache.felix.ipojo.metadata.Element parseHeaderMetadata(java.lang.String header)
                                                                       throws ParseException

Parses the metadata from the given header string. This method creates a new `ManifestMetadataParser` object and then creates the `iPOJO` root element, parses content elements (component types and instances declarations), and returns the resulting `Element` / `Attribute` structure. The parsed string must be a tree (only one root element).

Parameters:
  `header` - the header to parse
Returns:
  Element the root element resulting of the parsing
Throws:
  `ParseException` - if any error occurs