Class EglTemplateFactory

java.lang.Object
org.eclipse.epsilon.egl.EglTemplateFactory
Direct Known Subclasses:
EglFileGeneratingTemplateFactory

public class EglTemplateFactory extends Object
  • Field Details

  • Constructor Details

    • EglTemplateFactory

      public EglTemplateFactory()
    • EglTemplateFactory

      public EglTemplateFactory(IEglContext context)
  • Method Details

    • getTemplateExecutionListeners

      public Collection<ITemplateExecutionListener> getTemplateExecutionListeners()
    • getDefaultIncrementalitySettings

      public IncrementalitySettings getDefaultIncrementalitySettings()
    • setDefaultFormatter

      public void setDefaultFormatter(Formatter defaultFormatter)
    • setDefaultFormatters

      public void setDefaultFormatters(Formatter... defaultFormatters)
    • setDefaultFormatters

      public void setDefaultFormatters(Collection<Formatter> defaultFormatters)
    • getContext

      public IEglContext getContext()
    • setContext

      public void setContext(IEglContext context)
    • getImportManager

      public IImportManager getImportManager()
    • setImportManager

      public void setImportManager(IImportManager importManager)
    • initialiseRoot

      public boolean initialiseRoot(URI root)
      Sets the root of this template factory, unless it has already been set.
      Parameters:
      root - The new root.
      Returns:
      true if the root was set as a result of this call, false if the root had already been initialized.
    • setRoot

      public void setRoot(URI root)
    • getTemplateRoot

      public String getTemplateRoot()
    • setTemplateRoot

      public void setTemplateRoot(String path) throws EglRuntimeException
      Throws:
      EglRuntimeException
    • resolveRoot

      protected URI resolveRoot(String path) throws EglRuntimeException
      Throws:
      EglRuntimeException
    • resolveTemplate

      public URI resolveTemplate(String path) throws EglRuntimeException
      Throws:
      EglRuntimeException
    • name

      protected String name(String path)
    • load

      public EglTemplate load(File file) throws EglRuntimeException
      Loads an EglTemplate for the EGL code stored in the indicated file. Subclasses should override #createTemplate(String, URI), rather than this method, unless they wish to alter the way in which a file is transformed into an EglTemplateSpecification
      Throws:
      EglRuntimeException
    • load

      protected EglTemplate load(String code, File file) throws EglRuntimeException
      Loads an EglTemplate for the given EGL code as though it were contained in the given File. Used for parsing "dirty" code (which has not yet been saved to disk). Subclasses should override #createTemplate(String, URI), rather than this method, unless they wish to alter the way in which a dirty resource is transformed into an EglTemplateSpecification
      Throws:
      EglRuntimeException
    • load

      public EglTemplate load(String path) throws EglRuntimeException
      Loads an EglTemplate for the EGL code stored in the file at path. Subclasses should override #createTemplate(String, URI), rather than this method, unless they wish to alter the way in which a path is transformed into an EglTemplateSpecification
      Throws:
      EglRuntimeException
    • load

      public EglTemplate load(URI resource) throws EglRuntimeException
      Loads an EglTemplate for the EGL code stored in the given resource. Subclasses should override #createTemplate(String, URI), rather than this method, unless they wish to alter the way in which a resource is transformed into an EglTemplateSpecification
      Throws:
      EglRuntimeException
    • load

      protected EglTemplate load(String code, URI resource) throws EglRuntimeException
      Loads an EglTemplate for the given EGL code as though it were contained in the given URI. Used for parsing "dirty" code (which has not yet been saved to disk). Subclasses should override #createTemplate(String, URI), rather than this method, unless they wish to alter the way in which a dirty resource is transformed into an EglTemplateSpecification
      Throws:
      EglRuntimeException
    • load

      protected final EglTemplate load(EglTemplateSpecification spec) throws EglRuntimeException
      Loads an EglTemplate from the given EglTemplateSpecification. Subclasses should override #createTemplate(String, URI), rather than this method, unless they wish to alter the way in which IOExceptions are handled, in which case they should override handleFailedLoad(String, Exception).
      Throws:
      EglRuntimeException
    • handleFailedLoad

      protected EglTemplate handleFailedLoad(String name, Exception e) throws EglRuntimeException
      Throws:
      EglRuntimeException
    • prepare

      public final EglTemplate prepare(String code) throws Exception
      Prepares an EGL template that will execute the given EGL source code. Subclasses should override #createTemplate(String), rather than this method, as this method may, in the future, acquire additional responsibilities, such as exception handling.
      Throws:
      Exception
    • createTemplate

      protected EglTemplate createTemplate(EglTemplateSpecification spec) throws Exception
      Creates a template from the given specification. Subclasses may override to create different types of template.
      Throws:
      Exception
    • copyState

      public void copyState(IEolContext delegate)
    • getContextForNewTemplate

      protected IEglContext getContextForNewTemplate()
      This method should be called when creating a new template from createTemplate(EglTemplateSpecification). The rationale is that in some cases this factory's context is not safe to be used directly, so a proxy or modifications may be needed instead.
      Returns:
      An appropriate context to be used for a new EglTemplate instance.
      Since:
      1.6
    • toString

      public String toString()
      Overrides:
      toString in class Object