Class EventProducerCollectorTask

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class EventProducerCollectorTask
    extends org.apache.tools.ant.Task
    Ant task which inspects a file set for Java interfaces which extend the EventProducer interface. For all such interfaces an event model file and a translation file for the human-readable messages generated by the events is created and/or updated.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.File destDir  
      private java.util.List<org.apache.tools.ant.types.FileSet> filesets  
      private static java.lang.String MERGETRANSLATION  
      private static java.lang.String MODEL2TRANSLATION  
      private java.io.File translationFile  
      • Fields inherited from class org.apache.tools.ant.Task

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

        description, location, project
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFileset​(org.apache.tools.ant.types.FileSet set)
      Adds a file set.
      void execute()
      private java.io.File getParentDir​(EventModel model)  
      java.io.File getTranslationFile()
      Returns the translation file for the event producer methods.
      static void main​(java.lang.String[] args)
      Command-line interface for testing purposes.
      protected long processFileSets​(EventProducerCollector collector)
      Processes the file sets defined for the task.
      void setDestDir​(java.io.File destDir)
      Sets the destination directory for the event models.
      void setTranslationFile​(java.io.File f)
      Sets the translation file for the event producer methods.
      protected void updateTranslationFile​(java.io.File modelFile)
      Updates the translation file with new entries for newly found event producer methods.
      • Methods inherited from class org.apache.tools.ant.Task

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

        clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
      • Methods inherited from class java.lang.Object

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

      • filesets

        private java.util.List<org.apache.tools.ant.types.FileSet> filesets
      • destDir

        private java.io.File destDir
      • translationFile

        private java.io.File translationFile
      • MODEL2TRANSLATION

        private static final java.lang.String MODEL2TRANSLATION
        See Also:
        Constant Field Values
      • MERGETRANSLATION

        private static final java.lang.String MERGETRANSLATION
        See Also:
        Constant Field Values
    • Constructor Detail

      • EventProducerCollectorTask

        public EventProducerCollectorTask()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.tools.ant.BuildException
        Overrides:
        execute in class org.apache.tools.ant.Task
        Throws:
        org.apache.tools.ant.BuildException
      • getParentDir

        private java.io.File getParentDir​(EventModel model)
      • updateTranslationFile

        protected void updateTranslationFile​(java.io.File modelFile)
                                      throws java.io.IOException
        Updates the translation file with new entries for newly found event producer methods.
        Parameters:
        modelFile - the model file to use
        Throws:
        java.io.IOException - if an I/O error occurs
      • processFileSets

        protected long processFileSets​(EventProducerCollector collector)
                                throws java.io.IOException,
                                       EventConventionException,
                                       java.lang.ClassNotFoundException
        Processes the file sets defined for the task.
        Parameters:
        collector - the collector to use for collecting the event producers
        Returns:
        the time of the latest modification of any of the files inspected
        Throws:
        java.io.IOException - if an I/O error occurs
        EventConventionException - if the EventProducer conventions are violated
        java.lang.ClassNotFoundException - if a required class cannot be found
      • addFileset

        public void addFileset​(org.apache.tools.ant.types.FileSet set)
        Adds a file set.
        Parameters:
        set - the file set
      • setDestDir

        public void setDestDir​(java.io.File destDir)
        Sets the destination directory for the event models.
        Parameters:
        destDir - the destination directory
      • setTranslationFile

        public void setTranslationFile​(java.io.File f)
        Sets the translation file for the event producer methods.
        Parameters:
        f - the translation file
      • getTranslationFile

        public java.io.File getTranslationFile()
        Returns the translation file for the event producer methods.
        Returns:
        the translation file
      • main

        public static void main​(java.lang.String[] args)
        Command-line interface for testing purposes.
        Parameters:
        args - the command-line arguments