Package org.gorpipe.querydialogs.factory
Class AbstractDialogFactory<T extends Dialog>
java.lang.Object
org.gorpipe.querydialogs.factory.AbstractDialogFactory<T>
- Type Parameters:
T- a Dialog type
- Direct Known Subclasses:
PerspectiveDialogFactory
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 -
Constructor Summary
ConstructorsConstructorDescriptionAbstractDialogFactory(org.gorpipe.gor.model.FileReader fr, org.gorpipe.gor.model.QueryEvaluator queryEval, boolean ignoreAllowedMismatch) Constructs a factory with no registered argument builders -
Method Summary
Modifier and TypeMethodDescriptionprotected ArgumentbuildArgument(String name, Map<String, ? extends Object> attributes) protected abstract TbuildDialog(String name, Map<String, ? extends Object> attributes) buildDialogs(Reader reader, String cacheDir) Attempts to read and parse the given file as a YAML file and convert the resulting data structure to a list ofDialogsbuildDialogs(String resource) buildDialogs(String resource, String cacheDir) buildDialogs(Path resource) org.gorpipe.gor.model.FileReaderGet the FileResolver for this factoryGet the name of the first report in the input file.org.gorpipe.gor.model.QueryEvaluatorregisterArgumentBuilder(ArgumentType type, ArgumentBuilder builder) Registers anArgumentBuilderto use for the givenArgumentType.
-
Field Details
-
inputFileFirstReport
-
-
Constructor Details
-
AbstractDialogFactory
public AbstractDialogFactory(org.gorpipe.gor.model.FileReader fr, org.gorpipe.gor.model.QueryEvaluator queryEval, boolean ignoreAllowedMismatch) Constructs a factory with no registered argument builders
-
-
Method Details
-
registerArgumentBuilder
Registers anArgumentBuilderto use for the givenArgumentType.- Parameters:
type- - the type to register builder forbuilder- - 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 List<T> buildDialogs(String resource, String cacheDir) throws IOException, freemarker.template.TemplateException - Parameters:
resource- - the Yaml to read- Returns:
- a
ListofDialogs - Throws:
IOExceptionfreemarker.template.TemplateException
-
buildDialogs
public List<T> buildDialogs(String resource) throws IOException, freemarker.template.TemplateException - Parameters:
resource- - the Yaml to read- Returns:
- a
ListofDialogs - Throws:
IOExceptionfreemarker.template.TemplateException
-
buildDialogs
public List<T> buildDialogs(Path resource) throws IOException, freemarker.template.TemplateException - Parameters:
resource- - the Yaml to read- Returns:
- a
ListofDialogs - Throws:
IOExceptionfreemarker.template.TemplateException
-
buildDialogs
public List<T> buildDialogs(Reader reader, String cacheDir) throws freemarker.template.TemplateException, IOException Attempts to read and parse the given file as a YAML file and convert the resulting data structure to a list ofDialogs- Parameters:
reader- - reader of the yaml content- Returns:
- a
ListofDialogs - Throws:
freemarker.template.TemplateExceptionIOException
-
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(String name, Map<String, ? extends Object> attributes) throws freemarker.template.TemplateException- Throws:
freemarker.template.TemplateException
-
buildArgument
-