org.apache.felix.ipojo.parser
Class ManifestMetadataParser

java.lang.Object
  extended by org.apache.felix.ipojo.parser.ManifestMetadataParser

public class ManifestMetadataParser
extends Object

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

Author:
Felix Project Team

Constructor Summary
ManifestMetadataParser()
           
 
Method Summary
 Element[] getComponentsMetadata()
          Gets the array of component type metadata.
 Dictionary[] getInstances()
          Gets the array of instance configuration described in the metadata.
 void parse(Dictionary dict)
          Looks for the iPOJO-Components header in the given dictionary.
static Element parse(String metadata)
          Parses the metadata from the string given in argument.
 void parseHeader(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 Element parseHeaderMetadata(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 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 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(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(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 Element parse(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 Element parseHeaderMetadata(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


Copyright © 2011 Apache Software Foundation. All Rights Reserved.