Interface TransformerModule


  • public interface TransformerModule

    Defines the interface to be implemented by a Java Transformer module.

    This is the main interface that the developer of a Java Transformer module needs to be aware of.

    Any class that implements this interface must define a default constructor. This will be constructed automatically by the Transformer core at startup. The constructor should not perform any initialisation or startup, instead this should be performed when the initialise method is called. Before this time, it is unsafe to perform any operations.

    The TransformerModule requires a version 1.7 (or higher) Virtual Machine (VM).

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void initialise​(java.lang.String moduleName, TransformerAccessor transformerAccessor)
      This method is invoked when the Transformer core has started up the module.
      void setFileReading​(boolean readingFile)
      Invoked when the Transformer core starts or stops reading its state from file.
      void shutdown()
      Invoked when the Transformer is shutdown, or when the module is unloaded.
    • Method Detail

      • initialise

        void initialise​(java.lang.String moduleName,
                        TransformerAccessor transformerAccessor)

        This method is invoked when the Transformer core has started up the module. This method should be used for the initialisation of the required resources (e.g. reading in a configuration file, or reconstructing the modules state from a file) and the required connections (e.g. connecting to a database or other external application).

        The module may also use the passed in TransformerAccessor to start interacting with the Transformer core. Subscriptions can now be made, providers can now be registered, the Transformer cache can be accessed, UDP command listeners can be added, and UDP commands can be sent.

        Parameters:
        moduleName - The module's name, as specified in the Transformer configuration file.
        transformerAccessor - The Transformer accessor that enables the module to interact with the Transformer core. A reference to this object should be kept.
      • setFileReading

        void setFileReading​(boolean readingFile)

        Invoked when the Transformer core starts or stops reading its state from file. On startup, the Transformer core reads in a memory file, and plays it through the modules so that they can regain their state (for example, calculating the order of the top ten stocks). If a module does not have any state information, or has its own way of regaining its state, then it will probably want to ignore any updates it receives whilst the file is still being read in. A module may also want to stop itself from publishing data back out whilst the file is being read.

        Parameters:
        readingFile - true if the file has started to be read in by the core, false if it has stopped being read in.
      • shutdown

        void shutdown()

        Invoked when the Transformer is shutdown, or when the module is unloaded.

        Allows clean shutdown of connections, files and resources by the Transformer module. It could also be used to save the module's current state to disk.