/** * Creates a new instance. * * @param loginCredentials * Contains all information required to connect to the database. * @param preferences * Contains preferences configuring database behaviour. */ public PostgreSqlTruncator(DatabaseLoginCredentials loginCredentials, DatabasePreferences preferences) { dbCtx = new DatabaseContext(loginCredentials); schemaVersionValidator = new SchemaVersionValidator(dbCtx, preferences); }
/** * Creates a new instance. * * @param loginCredentials * Contains all information required to connect to the database. * @param preferences * Contains preferences configuring database behaviour. */ public PostgreSqlChangeWriter(DatabaseLoginCredentials loginCredentials, DatabasePreferences preferences) { dbCtx = new DatabaseContext(loginCredentials); changeWriter = new ChangeWriter(dbCtx); actionWriterMap = new HashMap<ChangeAction, ActionChangeWriter>(); actionWriterMap.put(ChangeAction.Create, new ActionChangeWriter(changeWriter, ChangeAction.Create)); actionWriterMap.put(ChangeAction.Modify, new ActionChangeWriter(changeWriter, ChangeAction.Modify)); actionWriterMap.put(ChangeAction.Delete, new ActionChangeWriter(changeWriter, ChangeAction.Delete)); schemaVersionValidator = new SchemaVersionValidator(dbCtx, preferences); }
IndexManager indexManager; new SchemaVersionValidator(dbCtx, preferences) .validateVersion(PostgreSqlVersionConstants.SCHEMA_VERSION);
this.enableLinestringBuilder = enableLinestringBuilder; schemaVersionValidator = new SchemaVersionValidator(dbCtx, preferences); indexManager = new IndexManager(dbCtx, !enableBboxBuilder, !enableLinestringBuilder);
/** * Initialises the database connection and associated data access objects. */ private void initialize() { if (dbCtx == null) { ActionDao actionDao; dbCtx = new DatabaseContext(loginCredentials); new SchemaVersionValidator(dbCtx, preferences).validateVersion( PostgreSqlVersionConstants.SCHEMA_VERSION); capabilityChecker = new DatabaseCapabilityChecker(dbCtx); actionDao = releasableContainer.add(new ActionDao(dbCtx)); userDao = releasableContainer.add(new UserDao(dbCtx, actionDao)); nodeDao = releasableContainer.add(new NodeDao(dbCtx, actionDao)); wayDao = releasableContainer.add(new WayDao(dbCtx, actionDao)); relationDao = releasableContainer.add(new RelationDao(dbCtx, actionDao)); nodeManager = new PostgreSqlEntityManager<Node>(nodeDao, userDao); wayManager = new PostgreSqlEntityManager<Way>(wayDao, userDao); relationManager = new PostgreSqlEntityManager<Relation>(relationDao, userDao); } initialized = true; }