Class TemplateLangModelUtility

java.lang.Object
net.ssehub.easy.dslCore.ModelUtility<LanguageUnit,net.ssehub.easy.instantiation.core.model.templateModel.Template>
de.uni_hildesheim.sse.vil.templatelang.TemplateLangModelUtility
All Implemented Interfaces:
net.ssehub.easy.basics.modelManagement.IModelLoader<net.ssehub.easy.instantiation.core.model.templateModel.Template>

public class TemplateLangModelUtility extends net.ssehub.easy.dslCore.ModelUtility<LanguageUnit,net.ssehub.easy.instantiation.core.model.templateModel.Template> implements net.ssehub.easy.basics.modelManagement.IModelLoader<net.ssehub.easy.instantiation.core.model.templateModel.Template>
Provides language-wide functionality.
Author:
Holger Eichelberger
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.ssehub.easy.dslCore.ModelUtility

    net.ssehub.easy.dslCore.ModelUtility.Rule

    Nested classes/interfaces inherited from interface net.ssehub.easy.basics.modelManagement.IModelLoader

    net.ssehub.easy.basics.modelManagement.IModelLoader.IModelInfoHolder<M extends net.ssehub.easy.basics.modelManagement.IModel>, net.ssehub.easy.basics.modelManagement.IModelLoader.LoadResult<M extends net.ssehub.easy.basics.modelManagement.IModel>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    private static final net.ssehub.easy.dslCore.ModelUtility.Rule[]
     

    Fields inherited from class net.ssehub.easy.dslCore.ModelUtility

    RULE_CONFLICT, RULE_IMPORT, RULE_VERSION
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Prevents external creation.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.ssehub.easy.instantiation.core.model.expressions.Expression
    createExpression(String text, net.ssehub.easy.instantiation.core.model.expressions.IRuntimeEnvironment environment)
     
    net.ssehub.easy.instantiation.core.model.expressions.Expression
    createExpression(String text, net.ssehub.easy.instantiation.core.model.templateModel.Resolver resolver, StringBuilder warnings)
    Parses text into an expression.
    net.ssehub.easy.instantiation.core.model.expressions.Expression
    createExpression(String text, net.ssehub.easy.instantiation.core.model.templateModel.Resolver resolver, StringBuilder warnings, de.uni_hildesheim.sse.vil.expressions.translation.IvmlMessageAdapter adapter)
    Parses text into an expression.
    net.ssehub.easy.dslCore.TranslationResult<net.ssehub.easy.instantiation.core.model.templateModel.Template>
    createModel(LanguageUnit root, URI uri, boolean registerSuccessful)
    Create the build language model from an EMF implementation unit.
     
    net.ssehub.easy.basics.modelManagement.ModelInfo<net.ssehub.easy.instantiation.core.model.templateModel.Template>
    getInfo(URI uri)
     
    protected ClassLoader
     
    protected String
     
    protected void
    Initializes instances which depend on ModelUtility.resourceInitializer.
    List<net.ssehub.easy.basics.modelManagement.ModelInfo<net.ssehub.easy.instantiation.core.model.templateModel.Template>>
    obtainInfo(org.eclipse.emf.common.util.URI uri)
    Obtains model information.
    net.ssehub.easy.dslCore.TranslationResult<net.ssehub.easy.instantiation.core.model.templateModel.Template>
    parse(org.eclipse.emf.common.util.URI uri, net.ssehub.easy.basics.modelManagement.ImportResolver<net.ssehub.easy.instantiation.core.model.templateModel.Template> resolver)
     
    parseLanguageUnit(org.eclipse.emf.common.util.URI uri, net.ssehub.easy.dslCore.translation.MessageReceiver receiver, net.ssehub.easy.dslCore.ModelUtility.Rule... rules)
    Parses an uri to obtain a LanguageUnit.
    void
    print(net.ssehub.easy.dslCore.TranslationResult<net.ssehub.easy.instantiation.core.model.templateModel.Template> result, Writer out, boolean emitComments, boolean emitImports)
    Prints the model stored in the result to the console output stream (for debugging / testing).

    Methods inherited from class net.ssehub.easy.dslCore.ModelUtility

    append, appendWithNewLine, createInputStream, cutLeadin, cutLeadin, forceUnloadOnParse, getGrammar, getInfo, getInjector, getResourceInitializer, getResourceSet, handles, instances, load, main, obtainInfo, parse, parse, parse, parse, parseFragment, parseFragment, scan, setInjector, setResourceInitializer, toNetUri, validate

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.ssehub.easy.basics.modelManagement.IModelLoader

    load, scan
  • Field Details

    • INSTANCE

      public static final TemplateLangModelUtility INSTANCE
    • LEADIN_RULES

      private static final net.ssehub.easy.dslCore.ModelUtility.Rule[] LEADIN_RULES
  • Constructor Details

    • TemplateLangModelUtility

      private TemplateLangModelUtility()
      Prevents external creation.
  • Method Details

    • initializeAfterResourceInitializer

      protected void initializeAfterResourceInitializer()
      Initializes instances which depend on ModelUtility.resourceInitializer.
      Specified by:
      initializeAfterResourceInitializer in class net.ssehub.easy.dslCore.ModelUtility<LanguageUnit,net.ssehub.easy.instantiation.core.model.templateModel.Template>
    • createModel

      public net.ssehub.easy.dslCore.TranslationResult<net.ssehub.easy.instantiation.core.model.templateModel.Template> createModel(LanguageUnit root, URI uri, boolean registerSuccessful)
      Create the build language model from an EMF implementation unit.
      Parameters:
      root - the root-level build unit
      uri - the URI of the project to resolve (in order to find the closest project, may be null)
      registerSuccessful - successfully created models shall be registered
      Returns:
      the created variability model including messages
    • parse

      public net.ssehub.easy.dslCore.TranslationResult<net.ssehub.easy.instantiation.core.model.templateModel.Template> parse(org.eclipse.emf.common.util.URI uri, net.ssehub.easy.basics.modelManagement.ImportResolver<net.ssehub.easy.instantiation.core.model.templateModel.Template> resolver) throws IOException
      Specified by:
      parse in class net.ssehub.easy.dslCore.ModelUtility<LanguageUnit,net.ssehub.easy.instantiation.core.model.templateModel.Template>
      Throws:
      IOException
    • print

      public void print(net.ssehub.easy.dslCore.TranslationResult<net.ssehub.easy.instantiation.core.model.templateModel.Template> result, Writer out, boolean emitComments, boolean emitImports)
      Prints the model stored in the result to the console output stream (for debugging / testing).
      Parameters:
      result - the result instance
      out - the output writer
      emitComments - whether comments shall be emitted
      emitImports - whether imports shall be emitted
    • getLanguageName

      protected String getLanguageName()
      Specified by:
      getLanguageName in class net.ssehub.easy.dslCore.ModelUtility<LanguageUnit,net.ssehub.easy.instantiation.core.model.templateModel.Template>
    • getLanguageClassLoader

      protected ClassLoader getLanguageClassLoader()
      Specified by:
      getLanguageClassLoader in class net.ssehub.easy.dslCore.ModelUtility<LanguageUnit,net.ssehub.easy.instantiation.core.model.templateModel.Template>
    • createExpression

      public net.ssehub.easy.instantiation.core.model.expressions.Expression createExpression(String text, net.ssehub.easy.instantiation.core.model.templateModel.Resolver resolver, StringBuilder warnings) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Parses text into an expression.
      Parameters:
      text - the text to be parsed
      environment - the runtime environment for resolving variables
      an - optional buffer to collect warnings
      Returns:
      the resulting expression
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case that parsing fails
    • createExpression

      public net.ssehub.easy.instantiation.core.model.expressions.Expression createExpression(String text, net.ssehub.easy.instantiation.core.model.templateModel.Resolver resolver, StringBuilder warnings, de.uni_hildesheim.sse.vil.expressions.translation.IvmlMessageAdapter adapter) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Parses text into an expression.
      Parameters:
      text - the text to be parsed
      adapter - optional message adapter (may be null for default)
      environment - the runtime environment for resolving variables
      an - optional buffer to collect warnings
      Returns:
      the resulting expression
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException - in case that parsing fails
    • createExpression

      public net.ssehub.easy.instantiation.core.model.expressions.Expression createExpression(String text, net.ssehub.easy.instantiation.core.model.expressions.IRuntimeEnvironment environment) throws net.ssehub.easy.instantiation.core.model.common.VilException
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException
    • getExtension

      public String getExtension()
      Specified by:
      getExtension in class net.ssehub.easy.dslCore.ModelUtility<LanguageUnit,net.ssehub.easy.instantiation.core.model.templateModel.Template>
    • parseLanguageUnit

      public LanguageUnit parseLanguageUnit(org.eclipse.emf.common.util.URI uri, net.ssehub.easy.dslCore.translation.MessageReceiver receiver, net.ssehub.easy.dslCore.ModelUtility.Rule... rules) throws IOException
      Parses an uri to obtain a LanguageUnit. Cuts the first rules if given, else parses the entire text.
      Parameters:
      uri - the URI to read
      receiver - the message receiver used for storing messages (may be null)
      rules - optional rules for cutting the header of the contents, removing the remainder for performance
      Returns:
      the variability unit (or null if not found)
      Throws:
      IOException - in case of any I/O and parsing problems
      See Also:
      • ModelUtility.cutLeadin(InputStream, Rule...)
    • obtainInfo

      public List<net.ssehub.easy.basics.modelManagement.ModelInfo<net.ssehub.easy.instantiation.core.model.templateModel.Template>> obtainInfo(org.eclipse.emf.common.util.URI uri) throws IOException
      Obtains model information.
      Specified by:
      obtainInfo in class net.ssehub.easy.dslCore.ModelUtility<LanguageUnit,net.ssehub.easy.instantiation.core.model.templateModel.Template>
      Parameters:
      uri - the URI to read the info from
      Returns:
      the project info instances related to uri
      Throws:
      IOException - in case that an I/O error happens during parsing
    • getInfo

      public net.ssehub.easy.basics.modelManagement.ModelInfo<net.ssehub.easy.instantiation.core.model.templateModel.Template> getInfo(URI uri)
      Specified by:
      getInfo in class net.ssehub.easy.dslCore.ModelUtility<LanguageUnit,net.ssehub.easy.instantiation.core.model.templateModel.Template>