use of org.traccar.database.DataManager in project traccar by tananaev.
the class Context method init.
public static void init(String[] arguments) throws Exception {
config = new Config();
if (arguments.length <= 0) {
throw new RuntimeException("Configuration file is not provided");
}
config.load(arguments[0]);
loggerEnabled = config.getBoolean("logger.enable");
if (loggerEnabled) {
Log.setupLogger(config);
}
objectMapper = new ObjectMapper();
objectMapper.setConfig(objectMapper.getSerializationConfig().without(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS));
if (Context.getConfig().getBoolean("mapper.prettyPrintedJson")) {
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
}
if (config.hasKey("database.url")) {
dataManager = new DataManager(config);
}
if (config.getBoolean("ldap.enable")) {
ldapProvider = new LdapProvider(config);
}
mediaManager = new MediaManager(config.getString("media.path"));
if (dataManager != null) {
usersManager = new UsersManager(dataManager);
groupsManager = new GroupsManager(dataManager);
deviceManager = new DeviceManager(dataManager);
}
identityManager = deviceManager;
if (config.getBoolean("geocoder.enable")) {
geocoder = initGeocoder();
}
if (config.getBoolean("geolocation.enable")) {
initGeolocationModule();
}
if (config.getBoolean("web.enable")) {
webServer = new WebServer(config, dataManager.getDataSource());
}
permissionsManager = new PermissionsManager(dataManager, usersManager);
connectionManager = new ConnectionManager();
tripsConfig = initTripsConfig();
if (config.getBoolean("event.enable")) {
initEventsModule();
}
serverManager = new ServerManager();
if (config.getBoolean("event.forward.enable")) {
if (Context.getConfig().getBoolean("event.forward.payloadAsParamMode")) {
eventForwarder = new MultiPartEventForwarder();
} else {
eventForwarder = new JsonTypeEventForwarder();
}
}
attributesManager = new AttributesManager(dataManager);
driversManager = new DriversManager(dataManager);
commandsManager = new CommandsManager(dataManager);
statisticsManager = new StatisticsManager();
if (config.getBoolean("sms.smpp.enable")) {
smppClient = new SmppClient();
}
}
Aggregations