Class AbstractDialogFactory<T extends Dialog>

java.lang.Object
org.gorpipe.querydialogs.factory.AbstractDialogFactory<T>
Type Parameters:
T - a Dialog type
Direct Known Subclasses:
PerspectiveDialogFactory

public abstract class AbstractDialogFactory<T extends Dialog>
extends java.lang.Object
A factory responsible for building Dialogs from a supplied YAML file.

Sample usage:

 AbstractDialogFactory<Dialog> f = new SomeDialogFactoryImplementation();
 f.registerArgumentBuilder(ArgumentType.STRING, new StringArgumentBuilder());
 List<Dialog> dialogs = f.buildDialogs(new File("/path/to/yaml/file"));
 
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.lang.String inputFileFirstReport  
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractDialogFactory​(org.gorpipe.gor.model.FileReader fr, org.gorpipe.gor.model.QueryEvaluator queryEval)
    Constructs a factory with no registered argument builders
  • Method Summary

    Modifier and Type Method Description
    protected Argument buildArgument​(java.lang.String name, java.util.Map<java.lang.String,​? extends java.lang.Object> attributes)  
    protected abstract T buildDialog​(java.lang.String name, java.util.Map<java.lang.String,​? extends java.lang.Object> attributes)  
    java.util.List<T> buildDialogs​(java.io.Reader reader, java.lang.String cacheDir)
    Attempts to read and parse the given file as a YAML file and convert the resulting data structure to a list of Dialogs
    java.util.List<T> buildDialogs​(java.lang.String resource)  
    java.util.List<T> buildDialogs​(java.lang.String resource, java.lang.String cacheDir)  
    java.util.List<T> buildDialogs​(java.nio.file.Path resource)  
    org.gorpipe.gor.model.FileReader getFileReader()
    Get the FileResolver for this factory
    java.lang.String getInputFileFirstReport()
    Get the name of the first report in the input file.
    org.gorpipe.gor.model.QueryEvaluator getQueryEval()  
    ArgumentBuilder registerArgumentBuilder​(ArgumentType type, ArgumentBuilder builder)
    Registers an ArgumentBuilder to use for the given ArgumentType.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AbstractDialogFactory

      public AbstractDialogFactory​(org.gorpipe.gor.model.FileReader fr, org.gorpipe.gor.model.QueryEvaluator queryEval)
      Constructs a factory with no registered argument builders
  • Method Details

    • registerArgumentBuilder

      public ArgumentBuilder registerArgumentBuilder​(ArgumentType type, ArgumentBuilder builder)
      Registers an ArgumentBuilder to use for the given ArgumentType.
      Parameters:
      type - - the type to register builder for
      builder - - the builder to use for given type
      Returns:
      the previously registered builder for that type, or null if there was none
    • getFileReader

      public org.gorpipe.gor.model.FileReader getFileReader()
      Get the FileResolver for this factory
      Returns:
      the file resolver for this factory
    • getQueryEval

      public org.gorpipe.gor.model.QueryEvaluator getQueryEval()
    • buildDialogs

      public java.util.List<T> buildDialogs​(java.lang.String resource, java.lang.String cacheDir) throws java.io.IOException, freemarker.template.TemplateException
      Parameters:
      resource - - the Yaml to read
      Returns:
      a List of Dialogs
      Throws:
      java.io.IOException
      freemarker.template.TemplateException
    • buildDialogs

      public java.util.List<T> buildDialogs​(java.lang.String resource) throws java.io.IOException, freemarker.template.TemplateException
      Parameters:
      resource - - the Yaml to read
      Returns:
      a List of Dialogs
      Throws:
      java.io.IOException
      freemarker.template.TemplateException
    • buildDialogs

      public java.util.List<T> buildDialogs​(java.nio.file.Path resource) throws java.io.IOException, freemarker.template.TemplateException
      Parameters:
      resource - - the Yaml to read
      Returns:
      a List of Dialogs
      Throws:
      java.io.IOException
      freemarker.template.TemplateException
    • buildDialogs

      public java.util.List<T> buildDialogs​(java.io.Reader reader, java.lang.String cacheDir) throws freemarker.template.TemplateException, java.io.IOException
      Attempts to read and parse the given file as a YAML file and convert the resulting data structure to a list of Dialogs
      Parameters:
      reader - - reader of the yaml content
      Returns:
      a List of Dialogs
      Throws:
      freemarker.template.TemplateException
      java.io.IOException
    • getInputFileFirstReport

      public java.lang.String getInputFileFirstReport()
      Get the name of the first report in the input file.
      Returns:
      the name of the first report in the input file
    • buildDialog

      protected abstract T buildDialog​(java.lang.String name, java.util.Map<java.lang.String,​? extends java.lang.Object> attributes) throws freemarker.template.TemplateException
      Throws:
      freemarker.template.TemplateException
    • buildArgument

      protected Argument buildArgument​(java.lang.String name, java.util.Map<java.lang.String,​? extends java.lang.Object> attributes)