ilog.rules.brl.semantic

Class IlrBRLSemanticCheckerFactory

  • java.lang.Object
    • ilog.rules.brl.semantic.IlrBRLSemanticCheckerFactory


  • public abstract class IlrBRLSemanticCheckerFactory
    extends java.lang.Object
    Retrieves a semantic action and semantic filter using a unique key that represents the semantic checkers.

    The semantic checker factory is a hierarchy of factory. By default, the root factory tries to interpret the key as a class name and to load and instantiate the class defined by the key. The class must have a public constructor with one parameter. The class of the parameter must be String[]. The default factory can be extended to load semantic checkers in a different way.

    See Also:
    IlrBRLSemanticAction, IlrBRLSemanticFilter, IlrBRLLeadingSemanticFilter
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      protected static IlrBRLLeadingSemanticFilter createLeadingSemanticFilter(java.lang.String key, java.lang.String[] args, java.lang.Class descClass)
      Creates a leading semantic filter.
      protected static IlrBRLSemanticAction createSemanticAction(java.lang.String key, java.lang.String[] args, java.lang.Class descClass)
      Creates a semantic action.
      protected static IlrBRLSemanticFilter createSemanticFilter(java.lang.String key, java.lang.String[] args, java.lang.Class descClass)
      Creates a semantic filter.
      static IlrBRLLeadingSemanticFilter findLeadingSemanticFilter(java.lang.String key, java.lang.ClassLoader classLoader)
      Loads a leading semantic filter into the hierarchy according to the key that defines the leading semantic filter.
      static IlrBRLLeadingSemanticFilter findLeadingSemanticFilter(java.lang.String key, java.lang.ClassLoader classLoader, boolean logError)
      Loads a leading semantic filter into the hierarchy according to the key that defines the leading semantic filter.
      static IlrBRLSemanticAction findSemanticAction(java.lang.String key, java.lang.ClassLoader classLoader)
      Loads a semantic action into the hierarchy according to the key that defines the semantic action.
      static IlrBRLSemanticAction findSemanticAction(java.lang.String key, java.lang.ClassLoader classLoader, boolean logError)
      Loads a semantic action into the hierarchy according to the key that defines the semantic action.
      static IlrBRLSemanticFilter findSemanticFilter(java.lang.String key, java.lang.ClassLoader classLoader)
      Loads a semantic filter into the hierarchy according to the key that defines the semantic filter.
      static IlrBRLSemanticFilter findSemanticFilter(java.lang.String key, java.lang.ClassLoader classLoader, boolean logError)
      Loads a semantic filter into the hierarchy according to the key that defines the semantic filter.
      static IlrBRLSemanticCheckerFactory getFactory()
      Returns the current semantic checker factory.
      static IlrBRLLogger getLogger()
      This method retrieves a logger that may have been assigned to this factory.
      protected static java.lang.Class loadClass(java.lang.String className, java.lang.ClassLoader classLoader)
      Loads a class in the class loader given in a parameter (before) and (after) in the class loader IlrBRLSemanticCheckerFactory.
      protected abstract IlrBRLLeadingSemanticFilter loadLeadingSemanticFilter(java.lang.String key, java.lang.String[] args, java.lang.ClassLoader classLoader)
      Loads a leading semantic filter according to the key that defines the leading semantic filter.
      protected abstract IlrBRLSemanticAction loadSemanticAction(java.lang.String key, java.lang.String[] args, java.lang.ClassLoader classLoader)
      Loads a semantic action according to the key that defines that semantic action.
      protected abstract IlrBRLSemanticFilter loadSemanticFilter(java.lang.String key, java.lang.String[] args, java.lang.ClassLoader classLoader)
      Loads a semantic filter according to the key that defines the semantic filter.
      static void setFactory(IlrBRLSemanticCheckerFactory factory)
      Sets the new current semantic checker factory.
      static void setLogger(IlrBRLLogger log)
      This method allows setting a logger to this factory.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IlrBRLSemanticCheckerFactory

        protected IlrBRLSemanticCheckerFactory(IlrBRLSemanticCheckerFactory parent)
        Constructs a semantic checker factory, with its parent factory.
        Parameters:
        parent - The parent factory.
    • Method Detail

      • getLogger

        public static IlrBRLLogger getLogger()
        This method retrieves a logger that may have been assigned to this factory. The logger is used to report errors while loading and instantiating semantic checker classes.
        Returns:
        a logger associated to this factory
      • setLogger

        public static void setLogger(IlrBRLLogger log)
        This method allows setting a logger to this factory.
        Parameters:
        log - the logger to be associated to this factory.
      • getFactory

        public static IlrBRLSemanticCheckerFactory getFactory()
        Returns the current semantic checker factory.
        Returns:
        The current semantic checker factory.
      • setFactory

        public static void setFactory(IlrBRLSemanticCheckerFactory factory)
        Sets the new current semantic checker factory.
        Parameters:
        factory - The semantic checker factory.
      • createSemanticAction

        protected static IlrBRLSemanticAction createSemanticAction(java.lang.String key,
                                                java.lang.String[] args,
                                                java.lang.Class descClass)
        Creates a semantic action. By default, instantiates the class and throws a constructor with one parameter of class String[].
        Parameters:
        key - The key of the semantic action.
        args - The arguments to instantiate the semantic action.
        descClass - The class to instantiate.
        Returns:
        The semantic action defined by the key.
      • createSemanticFilter

        protected static IlrBRLSemanticFilter createSemanticFilter(java.lang.String key,
                                                java.lang.String[] args,
                                                java.lang.Class descClass)
        Creates a semantic filter. By default, instantiates the class and throws a constructor with one parameter of class String[].
        Parameters:
        key - The key of the semantic filter.
        args - The arguments to instantiate the semantic filter.
        descClass - The class to instantiate.
        Returns:
        The semantic filter defined by the key.
      • createLeadingSemanticFilter

        protected static IlrBRLLeadingSemanticFilter createLeadingSemanticFilter(java.lang.String key,
                                                              java.lang.String[] args,
                                                              java.lang.Class descClass)
        Creates a leading semantic filter. By default, instantiates the class and throws a constructor with one parameter of class String[].
        Parameters:
        key - The key of the leading semantic filter.
        args - The arguments to instantiate the leading semantic filter.
        descClass - The class to instantiate.
        Returns:
        The leading semantic filter defined by the key.
      • loadClass

        protected static java.lang.Class loadClass(java.lang.String className,
                                java.lang.ClassLoader classLoader)
        Loads a class in the class loader given in a parameter (before) and (after) in the class loader IlrBRLSemanticCheckerFactory.
        Parameters:
        className - The class name.
        classLoader - The class loader into which the class is loaded.
        Returns:
        The class according to the class name or null if the class does not exist.
      • loadSemanticAction

        protected abstract IlrBRLSemanticAction loadSemanticAction(java.lang.String key,
                                              java.lang.String[] args,
                                              java.lang.ClassLoader classLoader)
        Loads a semantic action according to the key that defines that semantic action. According to the factory implementation.
        Parameters:
        key - The key that represents the semantic action.
        args - The arguments.
        classLoader - The class loader.
        Returns:
        The instance of the semantic action defined by the key.
      • loadSemanticFilter

        protected abstract IlrBRLSemanticFilter loadSemanticFilter(java.lang.String key,
                                              java.lang.String[] args,
                                              java.lang.ClassLoader classLoader)
        Loads a semantic filter according to the key that defines the semantic filter. According to the factory implementation.
        Parameters:
        key - The key that represents the semantic filter.
        args - The arguments.
        classLoader - The class loader.
        Returns:
        The instance of the semantic filter defined by the key.
      • loadLeadingSemanticFilter

        protected abstract IlrBRLLeadingSemanticFilter loadLeadingSemanticFilter(java.lang.String key,
                                                            java.lang.String[] args,
                                                            java.lang.ClassLoader classLoader)
        Loads a leading semantic filter according to the key that defines the leading semantic filter. According to the factory implementation.
        Parameters:
        key - The key that represents the leading semantic filter.
        args - The arguments.
        classLoader - The class loader.
        Returns:
        The instance of the leading semantic filter defined by the key.
      • findSemanticAction

        public static IlrBRLSemanticAction findSemanticAction(java.lang.String key,
                                              java.lang.ClassLoader classLoader)
        Loads a semantic action into the hierarchy according to the key that defines the semantic action. An error is logged if the semantic action is not found.
        Parameters:
        key - The key that represents the semantic action.
        classLoader - The class loader.
        Returns:
        The instance of the semantic action defined by the key.
      • findSemanticAction

        public static IlrBRLSemanticAction findSemanticAction(java.lang.String key,
                                              java.lang.ClassLoader classLoader,
                                              boolean logError)
        Loads a semantic action into the hierarchy according to the key that defines the semantic action.
        Parameters:
        key - The key that represents the semantic action.
        classLoader - The class loader.
        logError - true to log an error if the semantic action is not found in the factory hierarchy
        Returns:
        The instance of the semantic action defined by the key.
      • findSemanticFilter

        public static IlrBRLSemanticFilter findSemanticFilter(java.lang.String key,
                                              java.lang.ClassLoader classLoader)
        Loads a semantic filter into the hierarchy according to the key that defines the semantic filter. An error is logged if the semantic filter is not found.
        Parameters:
        key - The key that represents the semantic filter.
        classLoader - The class loader.
        Returns:
        The instance of the semantic filter defined by the key.
      • findSemanticFilter

        public static IlrBRLSemanticFilter findSemanticFilter(java.lang.String key,
                                              java.lang.ClassLoader classLoader,
                                              boolean logError)
        Loads a semantic filter into the hierarchy according to the key that defines the semantic filter.
        Parameters:
        key - The key that represents the semantic filter.
        classLoader - The class loader.
        logError - true to log an error if the semantic filter is not found in the factory hierarchy
        Returns:
        The instance of the semantic filter defined by the key.
      • findLeadingSemanticFilter

        public static IlrBRLLeadingSemanticFilter findLeadingSemanticFilter(java.lang.String key,
                                                            java.lang.ClassLoader classLoader)
        Loads a leading semantic filter into the hierarchy according to the key that defines the leading semantic filter. An error is logged if the leading semantic filter is not found.
        Parameters:
        key - The key that represents the leading semantic filter.
        classLoader - The class loader.
        Returns:
        The instance of the leading semantic filter defined by the key.
      • findLeadingSemanticFilter

        public static IlrBRLLeadingSemanticFilter findLeadingSemanticFilter(java.lang.String key,
                                                            java.lang.ClassLoader classLoader,
                                                            boolean logError)
        Loads a leading semantic filter into the hierarchy according to the key that defines the leading semantic filter.
        Parameters:
        key - The key that represents the leading semantic filter.
        classLoader - The class loader.
        logError - true to log an error if the leading semantic filter is not found in the factory hierarchy
        Returns:
        The instance of the leading semantic filter defined by the key.

© Copyright IBM Corp. 1987, 2017