Package org.openstreetmap.osmosis.pgsimple.common

Examples of org.openstreetmap.osmosis.pgsimple.common.DatabaseContext


   */
  private void initialize() {
    if (dbCtx == null) {
      ActionDao actionDao;
     
      dbCtx = new DatabaseContext(loginCredentials);
     
      new SchemaVersionValidator(dbCtx, preferences).validateVersion(
          PostgreSqlVersionConstants.SCHEMA_VERSION);
     
      capabilityChecker = new DatabaseCapabilityChecker(dbCtx);
View Full Code Here


    /**
     * Reads all data from the database and send it to the sink.
     */
    public void run() {
      DatabaseContext dbCtx = new DatabaseContext(loginCredentials);
     
      try {
      IndexManager indexManager;
     
      new SchemaVersionValidator(dbCtx, preferences)
        .validateVersion(PostgreSqlVersionConstants.SCHEMA_VERSION);
       
        indexManager = new IndexManager(dbCtx, false, false);
       
      // Drop all constraints and indexes.
      indexManager.prepareForLoad();
       
        LOG.finer("Loading users.");
        loadCopyFile(dbCtx, copyFileset.getUserFile(), "users");
        LOG.finer("Loading nodes.");
        loadCopyFile(dbCtx, copyFileset.getNodeFile(), "nodes");
        LOG.finer("Loading node tags.");
        loadCopyFile(dbCtx, copyFileset.getNodeTagFile(), "node_tags");
        LOG.finer("Loading ways.");
        loadCopyFile(dbCtx, copyFileset.getWayFile(), "ways");
        LOG.finer("Loading way tags.");
        loadCopyFile(dbCtx, copyFileset.getWayTagFile(), "way_tags");
        LOG.finer("Loading way nodes.");
        loadCopyFile(dbCtx, copyFileset.getWayNodeFile(), "way_nodes");
        LOG.finer("Loading relations.");
        loadCopyFile(dbCtx, copyFileset.getRelationFile(), "relations");
        LOG.finer("Loading relation tags.");
        loadCopyFile(dbCtx, copyFileset.getRelationTagFile(), "relation_tags");
        LOG.finer("Loading relation members.");
        loadCopyFile(dbCtx, copyFileset.getRelationMemberFile(), "relation_members");
        LOG.finer("Committing changes.");
       
        LOG.fine("Data load complete.");
       
        // Add all constraints and indexes.
        indexManager.completeAfterLoad();
       
        LOG.fine("Committing changes.");
        dbCtx.commit();
       
        LOG.fine("Vacuuming database.");
        dbCtx.setAutoCommit(true);
        dbCtx.executeStatement("VACUUM ANALYZE");
       
        LOG.fine("Complete.");
       
      } finally {
        dbCtx.release();
      }
    }
View Full Code Here

   *            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);
  }
View Full Code Here

   *            The node location storage type used by the geometry builders.
   */
  public PostgreSqlWriter(
      DatabaseLoginCredentials loginCredentials, DatabasePreferences preferences,
      boolean enableBboxBuilder, boolean enableLinestringBuilder, NodeLocationStoreType storeType) {
    dbCtx = new DatabaseContext(loginCredentials);
   
    this.enableBboxBuilder = enableBboxBuilder;
    this.enableLinestringBuilder = enableLinestringBuilder;
   
    schemaVersionValidator = new SchemaVersionValidator(dbCtx, preferences);
View Full Code Here

  }
 
 
  private void initialize() {
    if (!initialized) {
      DatabaseContext dbCtx;
      DatabaseCapabilityChecker capabilityChecker;
     
      LOG.fine("Initializing the database and temporary processing files.");
     
      dbCtx = new DatabaseContext(loginCredentials);
     
      try {
        capabilityChecker = new DatabaseCapabilityChecker(dbCtx);

        populateBbox = capabilityChecker.isWayBboxSupported();
        populateLinestring = capabilityChecker.isWayLinestringSupported();       

        copyFilesetBuilder =
          new CopyFilesetBuilder(copyFileset, populateBbox, populateLinestring, storeType);
       
        copyFilesetLoader = new CopyFilesetLoader(loginCredentials, preferences, copyFileset);
       
        LOG.fine("Processing input data, building geometries and creating database load files.");
       
      } finally {
        dbCtx.release();
      }
     
      initialized = true;
    }
  }
View Full Code Here

   *            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));
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.pgsimple.common.DatabaseContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.