/** * Ensures that the object is writeable. If not an exception will be thrown. * This is intended to be called within all update methods. */ protected void assertWriteable() { if (readOnly) { throw new OsmosisRuntimeException( "The object has been marked as read-only. It must be cloned to make changes."); } }
/** * This is called by the input thread to validate that no errors have * occurred on the output thread. */ private void checkForOutputErrors() { // Check for reading thread error. if (!outputOkay) { throw new OsmosisRuntimeException("An output error has occurred, aborting."); } }
/** * {@inheritDoc} */ public DataType next() { throw new OsmosisRuntimeException("This iterator contains no data."); }
/** * {@inheritDoc} */ public Sink getSink(int instance) { if (instance != 0) { throw new OsmosisRuntimeException("Sink instance " + instance + " is not valid."); } return sortedEntityValidator; }
/** * {@inheritDoc} */ public Sink getSink(int instance) { if (instance != 0) { throw new OsmosisRuntimeException("Sink instance " + instance + " is not valid."); } return sortedEntityValidator; }
/** * This is called by the input thread to validate that no errors have * occurred on the output thread. */ private void checkForOutputErrors() { // Check for reading thread error. if (!outputOkay) { throw new OsmosisRuntimeException("An output error has occurred, aborting."); } }
/** * {@inheritDoc} */ public ChangeSink getChangeSink(int instance) { if (instance != 0) { throw new OsmosisRuntimeException("Change sink instance " + instance + " is not valid."); } return sortedChangeValidator; }
/** * This is called by the output thread to validate that no errors have * occurred on the input thread. */ private void checkForInputErrors() { // Check for writing thread error. if (!inputOkay) { throw new OsmosisRuntimeException("An input error has occurred, aborting."); } }
/** * Ensures that the object is writeable. If not an exception will be thrown. * This is intended to be called within all update methods. */ protected void assertWriteable() { if (readOnly) { throw new OsmosisRuntimeException( "The object has been marked as read-only. It must be cloned to make changes."); } }
/** * Commits any outstanding transaction. */ public void commit() { if (connection != null) { try { connection.commit(); } catch (SQLException e) { throw new OsmosisRuntimeException("Unable to commit changes.", e); } } }
/** * {@inheritDoc} */ public void writeByte(byte value) { try { output.writeByte(value); } catch (IOException e) { throw new OsmosisRuntimeException("Unable to write byte " + value + " to the store.", e); } }
/** * {@inheritDoc} */ public void writeString(String value) { try { output.writeUTF(value); } catch (IOException e) { throw new OsmosisRuntimeException("Unable to write String (" + value + ") to the store.", e); } } }
/** * Writes a new line in the output file. */ public void endRecord() { try { writer.newLine(); midRecord = false; } catch (IOException e) { throw new OsmosisRuntimeException("Unable to end record.", e); } }
/** * {@inheritDoc} */ public void writeDouble(double value) { try { output.writeDouble(value); } catch (IOException e) { throw new OsmosisRuntimeException("Unable to write double " + value + " to the store.", e); } }
private String getProperty(String propertyName) { String value; value = properties.getProperty(propertyName); if (value == null) { throw new OsmosisRuntimeException("Property " + propertyName + " cannot be found."); } return value; }
/** * Writes a new line in the output file. */ private void writeNewLine() { try { writer.newLine(); } catch (IOException e) { throw new OsmosisRuntimeException("Unable to write data.", e); } }
/** * Writes a new line in the output file. */ public void endRecord() { try { writer.newLine(); midRecord = false; } catch (IOException e) { throw new OsmosisRuntimeException("Unable to end record.", e); } }
/** * Either thread can call this method when they wish to wait until an update * has been performed by the other thread. */ private void waitForUpdate() { try { dataWaitCondition.await(); } catch (InterruptedException e) { throw new OsmosisRuntimeException("Thread was interrupted.", e); } }
/** * Writes a new line in the output file. */ private void writeNewLine() { try { writer.newLine(); } catch (IOException e) { throw new OsmosisRuntimeException("Unable to write data.", e); } }
/** * Commits any outstanding transaction. */ public void commit() { if (connection != null) { try { connection.commit(); } catch (SQLException e) { throw new OsmosisRuntimeException("Unable to commit changes.", e); } } }