Class MOFParser

java.lang.Object
net.aifusion.metamodel.MOFParser
All Implemented Interfaces:
Parser

public class MOFParser extends Object implements Parser
Recursive descent parser implementing CIM Version 3 Metamodel as described in DSP0004 and DSP0221
Author:
Sharad Singhal
  • Constructor Details

    • MOFParser

      public MOFParser()
      Create a MOF Parser with a default in-memory repository
    • MOFParser

      public MOFParser(Repository repository)
      Create a MOF Parser with the given repository
      Parameters:
      repository - - CIM Repository to use for the parser
    • MOFParser

      public MOFParser(Repository repository, Repository definitions)
      Create a MOF parser with a definition repository
      Parameters:
      repository - - repository to parse new input
      definitions - - repository containing pre-existing definitions (not modified)
  • Method Details

    • parse

      public void parse(String fileName, NameSpacePath path)
      Parse a file
      Specified by:
      parse in interface Parser
      Parameters:
      fileName - - name of the file to parse
      path - - default namespace path to use during parsing
    • parse

      public void parse(InputStream in, NameSpacePath path)
      Description copied from interface: Parser
      Parse the specification given in an inputstream into the parser repository
      Specified by:
      parse in interface Parser
      Parameters:
      in - - input stream
      path - - optional name space. if non-null, the parser will initialize to the name space before parsing the input
    • parse

      public void parse(BufferedReader in, NameSpacePath path)
      Parse model constructs from a buffered reader
      Specified by:
      parse in interface Parser
      Parameters:
      in - - reader to parse
      path - - optional name space. if non-null, the parser will initialize to the name space before parsing the input
    • parseValue

      public StructureValue parseValue(String indication, NameSpacePath path)
      Description copied from interface: Parser
      Parse a structure value from an incoming indication
      Specified by:
      parseValue in interface Parser
      Parameters:
      indication - - value of the indication
      path - - optional name space. if non-null, the parser will initialize to the name space before parsing the input
      Returns:
      - incoming structure value; null if none found
    • parsePropertyValue

      public DataValue parsePropertyValue(ObjectPath path, String propertyName, InputStream inputStream)
      Parse a property value from the input stream
      Parameters:
      path - - path of the element to use for the property
      propertyName - - name of the property to parse
      inputStream - - input stream containing property value
      Returns:
      - data value for the property
    • parseParameters

      public void parseParameters(List<CimParameter> params, InputStream in)
      Parse a list of comma separated parameter values from the input stream
      Parameters:
      params - - expected parameters. At return values are set in the parameters
      in - - input stream to parse
    • parseValue

      public StructureValue parseValue(InputStream in, NameSpacePath path)
      Parse values from an input stream
      Parameters:
      in - - input stream to parse values from
      path - - namespace path to be used as initial path for the incoming values
      Returns:
      - list of structure values
    • getRepository

      public Repository getRepository()
      Description copied from interface: Parser
      Get the repository being used by the parser
      Specified by:
      getRepository in interface Parser
      Returns:
      - repository being used by the parser
    • main

      public static void main(String[] args)
      Parse one or more files into a repository
      Parameters:
      args - - program arguments in the form [options] fileName [fileName ...] The parser accepts the following options (defaults in [ ]):
      • -r repository : name of a directory in the file system where the parsed files will be added [repository]
      • -n nameSpace : default namespace for the classes [/root/local]
      • -l logLevel : logging level for parser messages [finest]
      • -h : (must be first argument) print a usage message (also printed if no arguments are given)