Package org.openstreetmap.osmosis.core

Examples of org.openstreetmap.osmosis.core.OsmosisRuntimeException


      separateField();
     
      writer.write(escapeString(data.getValue()));
     
    } catch (IOException e) {
      throw new OsmosisRuntimeException("Unable to write value (" + data + ")", e);
    }
  }
View Full Code Here


        writer.write(Long.toString(data.get(i)));
      }
      writer.write("}");
     
    } catch (IOException e) {
      throw new OsmosisRuntimeException("Unable to write value (" + data + ")", e);
    }
  }
View Full Code Here

    try {
      writer.newLine();
      midRecord = false;
     
    } catch (IOException e) {
      throw new OsmosisRuntimeException("Unable to end record.", e);
    }
  }
View Full Code Here

            new OutputStreamWriter(new BufferedOutputStream(outStream, 65536), "UTF-8"));
       
        outStream = null;
       
      } catch (IOException e) {
        throw new OsmosisRuntimeException("Unable to open file for writing.", e);
      } finally {
        if (outStream != null) {
          try {
            outStream.close();
          } catch (Exception e) {
View Full Code Here

  public void complete() {
    initialize();
   
    try {
      if (midRecord) {
        throw new OsmosisRuntimeException("The current record has not been ended.");
      }
     
      if (writer != null) {
        writer.close();
      }
     
    } catch (IOException e) {
      throw new OsmosisRuntimeException("Unable to complete writing to the data stream.", e);
    } finally {
      initialized = false;
      writer = null;
    }
  }
View Full Code Here

        break;
      } else {
        try {
          Thread.sleep(remainingInterval);
        } catch (InterruptedException e) {
          throw new OsmosisRuntimeException("Unable to sleep until next replication iteration.", e);
        }
      }
    }

    // Wait until either data becomes available or the maximum interval is reached.
    while (true) {
      // Update our view of the current database transaction state.
      obtainNewSnapshot(state);
     
      // Continue onto next step if data is available.
      if (state.getTxnMaxQueried() != state.getTxnMax() || state.getTxnReady().size() > 0) {
        break;
      }
     
      systemTimestamp = systemTimeLoader.getSystemTime();
      if (LOG.isLoggable(Level.FINER)) {
        LOG.finer("Loaded system time " + systemTimestamp + " from the database.");
      }
     
      // Continue onto next step if we've reached the maximum interval or
      // if our remaining interval exceeds the maximum (clock skew).
      long remainingInterval = state.getTimestamp().getTime() + maxInterval - systemTimestamp.getTime();
      if (remainingInterval <= 0 || remainingInterval > maxInterval) {
        break;
      } else {
        long sleepInterval = remainingInterval;
        if (sleepInterval > minInterval) {
          sleepInterval = minInterval;
        }
        try {
          Thread.sleep(sleepInterval);
        } catch (InterruptedException e) {
          throw new OsmosisRuntimeException("Unable to sleep until data becomes available.", e);
        }
      }
    }

    LOG.fine("Processing replication sequence.");
View Full Code Here

     
      // Merge all readers into a single result iterator and return.     
      return new MultipleSourceIterator<EntityContainer>(resultSets);
     
    } catch (SQLException e) {
      throw new OsmosisRuntimeException("Unable to perform bounding box queries.", e);
    } finally {
      if (preparedStatement != null) {
        try {
          preparedStatement.close();
        } catch (SQLException e) {
View Full Code Here

      pbfDecoder.run();

      sink.complete();

    } catch (IOException e) {
      throw new OsmosisRuntimeException("Unable to read PBF file " + file + ".", e);
    } finally {
      sink.release();

      executorService.shutdownNow();
View Full Code Here

   * Begins a new database transaction. This is not required if
   * executeWithinTransaction is being used.
   */
    public void beginTransaction() {
      if (transaction != null) {
        throw new OsmosisRuntimeException("A transaction is already active.");
      }
     
      transaction = txnManager.getTransaction(new DefaultTransactionDefinition());
    }
View Full Code Here

    /**
     * Commits an existing database transaction.
     */
    public void commitTransaction() {
      if (transaction == null) {
        throw new OsmosisRuntimeException("No transaction is currently active.");
      }
     
      try {
        txnManager.commit(transaction);
      } finally {
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.core.OsmosisRuntimeException

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.