Search in sources :

Example 1 with OverspeedEventHandler

use of org.traccar.events.OverspeedEventHandler in project traccar by tananaev.

the class Context method initEventsModule.

private static void initEventsModule() {
    geofenceManager = new GeofenceManager(dataManager);
    calendarManager = new CalendarManager(dataManager);
    notificationManager = new NotificationManager(dataManager);
    Properties velocityProperties = new Properties();
    velocityProperties.setProperty("file.resource.loader.path", Context.getConfig().getString("templates.rootPath", "templates") + "/");
    velocityProperties.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogChute");
    String address;
    try {
        address = config.getString("web.address", InetAddress.getLocalHost().getHostAddress());
    } catch (UnknownHostException e) {
        address = "localhost";
    }
    String webUrl = URIUtil.newURI("http", address, config.getInteger("web.port", 8082), "", "");
    webUrl = Context.getConfig().getString("web.url", webUrl);
    velocityProperties.setProperty("web.url", webUrl);
    velocityEngine = new VelocityEngine();
    velocityEngine.init(velocityProperties);
    motionEventHandler = new MotionEventHandler(tripsConfig);
    overspeedEventHandler = new OverspeedEventHandler(Context.getConfig().getLong("event.overspeed.minimalDuration") * 1000, Context.getConfig().getBoolean("event.overspeed.notRepeat"));
}
Also used : VelocityEngine(org.apache.velocity.app.VelocityEngine) CalendarManager(org.traccar.database.CalendarManager) NotificationManager(org.traccar.database.NotificationManager) UnknownHostException(java.net.UnknownHostException) GeofenceManager(org.traccar.database.GeofenceManager) MotionEventHandler(org.traccar.events.MotionEventHandler) OverspeedEventHandler(org.traccar.events.OverspeedEventHandler) Properties(java.util.Properties)

Aggregations

UnknownHostException (java.net.UnknownHostException)1 Properties (java.util.Properties)1 VelocityEngine (org.apache.velocity.app.VelocityEngine)1 CalendarManager (org.traccar.database.CalendarManager)1 GeofenceManager (org.traccar.database.GeofenceManager)1 NotificationManager (org.traccar.database.NotificationManager)1 MotionEventHandler (org.traccar.events.MotionEventHandler)1 OverspeedEventHandler (org.traccar.events.OverspeedEventHandler)1