Class MongoDBExporter

  • All Implemented Interfaces:
    it.unibo.alchemist.boundary.Exporter

    
    public final class MongoDBExporter<T extends Object, P extends Position<P>>
    extends AbstractExporter<T, P>
                        

    Exports data to a MongoDB instance.

    • Constructor Detail

      • MongoDBExporter

        MongoDBExporter(String uri, String dbName, Double interval, Boolean appendTime)
        Parameters:
        uri - the connection URI of the database instance.
        dbName - the name the database to export data to.
        interval - the sampling time, defaults to AbstractExporter.DEFAULT_INTERVAL.
        appendTime - if true it will always generate a new Mongo document, false to overwrite.
      • MongoDBExporter

        MongoDBExporter(String uri, String dbName, Double interval)
        Parameters:
        uri - the connection URI of the database instance.
        dbName - the name the database to export data to.
        interval - the sampling time, defaults to AbstractExporter.DEFAULT_INTERVAL.
      • MongoDBExporter

        MongoDBExporter(String uri, String dbName)
        Parameters:
        uri - the connection URI of the database instance.
        dbName - the name the database to export data to.
      • MongoDBExporter

        MongoDBExporter(String uri)
        Parameters:
        uri - the connection URI of the database instance.
    • Method Detail

      • getCollectionName

         final String getCollectionName()

        The name of the collection related to the current simulation in execution.

      • setup

         Unit setup(Environment<T, P> environment)

        Prepare the export environment. This method is called only once upon simulation initialization.

      • exportData

         Unit exportData(Environment<T, P> environment, Actionable<T> reaction, Time time, Long step)

        Delegates the concrete implementation of this method to his subclasses.

      • close

         Unit close(Environment<T, P> environment, Time time, Long step)

        Close the export environment. This method is called when the simulation finishes.