Search in sources :

Example 1 with MailManager

use of org.traccar.database.MailManager in project traccar by tananaev.

the class Context method init.

public static void init(String configFile) throws Exception {
    try {
        config = new Config(configFile);
        Log.setupLogger(config);
    } catch (Exception e) {
        config = new Config();
        Log.setupDefaultLogger();
        throw e;
    }
    objectMapper = new ObjectMapper();
    objectMapper.registerModule(new SanitizerModule());
    objectMapper.registerModule(new JSR353Module());
    objectMapper.setConfig(objectMapper.getSerializationConfig().without(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS));
    client = ClientBuilder.newClient().register(new ObjectMapperContextResolver());
    if (config.hasKey(Keys.DATABASE_URL)) {
        dataManager = new DataManager(config);
    }
    if (config.hasKey(Keys.LDAP_URL)) {
        ldapProvider = new LdapProvider(config);
    }
    mailManager = new MailManager();
    mediaManager = new MediaManager(config.getString(Keys.MEDIA_PATH));
    if (dataManager != null) {
        usersManager = new UsersManager(dataManager);
        groupsManager = new GroupsManager(dataManager);
        deviceManager = new DeviceManager(dataManager);
    }
    identityManager = deviceManager;
    if (config.hasKey(Keys.WEB_PORT)) {
        webServer = new WebServer(config);
    }
    permissionsManager = new PermissionsManager(dataManager, usersManager);
    connectionManager = new ConnectionManager();
    tripsConfig = initTripsConfig();
    if (config.hasKey(Keys.SMS_HTTP_URL)) {
        smsManager = new HttpSmsClient();
    } else if (config.hasKey(Keys.SMS_AWS_REGION)) {
        smsManager = new SnsSmsClient();
    }
    initEventsModule();
    serverManager = new ServerManager();
    scheduleManager = new ScheduleManager();
    if (config.hasKey(Keys.EVENT_FORWARD_URL)) {
        eventForwarder = new EventForwarder();
    }
    attributesManager = new AttributesManager(dataManager);
    driversManager = new DriversManager(dataManager);
    commandsManager = new CommandsManager(dataManager, config.getBoolean(Keys.COMMANDS_QUEUEING));
    orderManager = new OrderManager(dataManager);
}
Also used : JSR353Module(com.fasterxml.jackson.datatype.jsr353.JSR353Module) SnsSmsClient(org.traccar.sms.SnsSmsClient) TripsConfig(org.traccar.reports.model.TripsConfig) Config(org.traccar.config.Config) LdapProvider(org.traccar.database.LdapProvider) EventForwarder(org.traccar.notification.EventForwarder) ConnectionManager(org.traccar.database.ConnectionManager) SanitizerModule(org.traccar.helper.SanitizerModule) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) GroupsManager(org.traccar.database.GroupsManager) ScheduleManager(org.traccar.schedule.ScheduleManager) DriversManager(org.traccar.database.DriversManager) AttributesManager(org.traccar.database.AttributesManager) DataManager(org.traccar.database.DataManager) DeviceManager(org.traccar.database.DeviceManager) UnknownHostException(java.net.UnknownHostException) UsersManager(org.traccar.database.UsersManager) HttpSmsClient(org.traccar.sms.HttpSmsClient) WebServer(org.traccar.web.WebServer) MediaManager(org.traccar.database.MediaManager) MailManager(org.traccar.database.MailManager) PermissionsManager(org.traccar.database.PermissionsManager) CommandsManager(org.traccar.database.CommandsManager) OrderManager(org.traccar.database.OrderManager)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JSR353Module (com.fasterxml.jackson.datatype.jsr353.JSR353Module)1 UnknownHostException (java.net.UnknownHostException)1 Config (org.traccar.config.Config)1 AttributesManager (org.traccar.database.AttributesManager)1 CommandsManager (org.traccar.database.CommandsManager)1 ConnectionManager (org.traccar.database.ConnectionManager)1 DataManager (org.traccar.database.DataManager)1 DeviceManager (org.traccar.database.DeviceManager)1 DriversManager (org.traccar.database.DriversManager)1 GroupsManager (org.traccar.database.GroupsManager)1 LdapProvider (org.traccar.database.LdapProvider)1 MailManager (org.traccar.database.MailManager)1 MediaManager (org.traccar.database.MediaManager)1 OrderManager (org.traccar.database.OrderManager)1 PermissionsManager (org.traccar.database.PermissionsManager)1 UsersManager (org.traccar.database.UsersManager)1 SanitizerModule (org.traccar.helper.SanitizerModule)1 EventForwarder (org.traccar.notification.EventForwarder)1 TripsConfig (org.traccar.reports.model.TripsConfig)1