Class PrecomputeTemplatesTask


  • public class PrecomputeTemplatesTask
    extends org.apache.tools.ant.Task
    A Task that reads a list of queries from a properties file (eg. testmodel_precompute.properties) and calls ObjectStoreInterMineImpl.precompute() using the Query.
    Author:
    Kim Rutherford
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String alias  
      protected boolean doSummarise  
      protected java.lang.String ignore  
      protected java.util.Set<java.lang.String> ignoreNames  
      protected int minRows  
      protected ObjectStore os  
      static java.lang.String PRECOMPUTE_CATEGORY_TEMPLATE
      The precompute category to use for templates.
      protected java.lang.String username  
      protected java.lang.String userProfileAlias  
      protected ObjectStoreWriter userProfileOS  
      • Fields inherited from class org.apache.tools.ant.Task

        description, location, target, taskName, taskType, wrapper
      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        project
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute()
      protected java.util.Map<java.lang.String,​ApiTemplate> getPrecomputeTemplateQueries()
      Get the super user's public templates
      protected void precompute​(Query query, java.util.Collection<QueryNode> indexes, java.lang.String name)
      Call ObjectStoreInterMineImpl.precompute() with the given Query.
      protected void precomputeTemplates()
      Create precomputed tables for all template queries in the given ObjectStore.
      void setAlias​(java.lang.String alias)
      Set the ObjectStore alias
      void setIgnore​(java.lang.String ignore)
      Set a comma separated list of template names to ignore - i.e.
      void setMinRows​(java.lang.Integer minRows)
      Set the minimum row count for precomputed queries.
      void setSummarise​(java.lang.String summarise)
      Set the summarise flag.
      void setUsername​(java.lang.String user)
      Set the account name to laod template to.
      void setUserProfileAlias​(java.lang.String userProfileAlias)
      Set the alias of the userprofile object store.
      • Methods inherited from class org.apache.tools.ant.Task

        getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
      • Methods inherited from class org.apache.tools.ant.ProjectComponent

        getProject, setProject
      • Methods inherited from class java.lang.Object

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

      • PRECOMPUTE_CATEGORY_TEMPLATE

        public static final java.lang.String PRECOMPUTE_CATEGORY_TEMPLATE
        The precompute category to use for templates.
        See Also:
        Constant Field Values
      • alias

        protected java.lang.String alias
      • minRows

        protected int minRows
      • userProfileAlias

        protected java.lang.String userProfileAlias
      • username

        protected java.lang.String username
      • ignore

        protected java.lang.String ignore
      • ignoreNames

        protected java.util.Set<java.lang.String> ignoreNames
      • doSummarise

        protected boolean doSummarise
    • Constructor Detail

      • PrecomputeTemplatesTask

        public PrecomputeTemplatesTask()
    • Method Detail

      • setAlias

        public void setAlias​(java.lang.String alias)
        Set the ObjectStore alias
        Parameters:
        alias - the ObjectStore alias
      • setIgnore

        public void setIgnore​(java.lang.String ignore)
        Set a comma separated list of template names to ignore - i.e. not precompute.
        Parameters:
        ignore - the list to ignore
      • setUserProfileAlias

        public void setUserProfileAlias​(java.lang.String userProfileAlias)
        Set the alias of the userprofile object store.
        Parameters:
        userProfileAlias - the object store alias of the userprofile database
      • setMinRows

        public void setMinRows​(java.lang.Integer minRows)
        Set the minimum row count for precomputed queries. Queries that are estimated to have less than this number of rows will not be precomputed.
        Parameters:
        minRows - the minimum row count
      • setUsername

        public void setUsername​(java.lang.String user)
        Set the account name to laod template to.
        Parameters:
        user - username to load templates into
      • setSummarise

        public void setSummarise​(java.lang.String summarise)
        Set the summarise flag.
        Parameters:
        summarise - if true, summarise while precomputing
      • execute

        public void execute()
        Overrides:
        execute in class org.apache.tools.ant.Task
      • precomputeTemplates

        protected void precomputeTemplates()
        Create precomputed tables for all template queries in the given ObjectStore.
      • precompute

        protected void precompute​(Query query,
                                  java.util.Collection<QueryNode> indexes,
                                  java.lang.String name)
        Call ObjectStoreInterMineImpl.precompute() with the given Query.
        Parameters:
        query - the query to precompute
        indexes - the index QueryNodes
        name - the name of the query we are precomputing (used for documentation is an exception is thrown
        Throws:
        org.apache.tools.ant.BuildException - if the query cannot be precomputed.
      • getPrecomputeTemplateQueries

        protected java.util.Map<java.lang.String,​ApiTemplate> getPrecomputeTemplateQueries()
        Get the super user's public templates
        Returns:
        Map from template name to TemplateQuery
        Throws:
        org.apache.tools.ant.BuildException - if an IO error occurs loading the template queries