use of org.apache.qpid.server.store.StoreException in project qpid-broker-j by apache.
the class JDBCLinkStore method doDeleteLink.
@Override
protected void doDeleteLink(final LinkDefinition<Source, Target> link) throws StoreException {
try (Connection connection = getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(String.format("DELETE FROM %s WHERE link_key = ?", getLinksTableName()))) {
preparedStatement.setString(1, generateLinkKey(link));
preparedStatement.execute();
} catch (SQLException e) {
throw new StoreException(String.format("Cannot delete link %s", new LinkKey(link)), e);
}
}
use of org.apache.qpid.server.store.StoreException in project qpid-broker-j by apache.
the class BDBConfigurationStore method closeEnvironment.
private void closeEnvironment() {
if (_environmentFacade != null) {
try {
_environmentFacade.close();
_environmentFacade = null;
} catch (RuntimeException e) {
throw new StoreException("Exception occurred on message store close", e);
}
}
}
use of org.apache.qpid.server.store.StoreException in project qpid-broker-j by apache.
the class BDBConfigurationStore method update.
private void update(boolean createIfNecessary, ConfiguredObjectRecord record, com.sleepycat.je.Transaction txn) throws StoreException {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Updating, creating " + createIfNecessary + " : " + record);
}
DatabaseEntry key = new DatabaseEntry();
UUIDTupleBinding keyBinding = UUIDTupleBinding.getInstance();
keyBinding.objectToEntry(record.getId(), key);
DatabaseEntry value = new DatabaseEntry();
DatabaseEntry newValue = new DatabaseEntry();
ConfiguredObjectBinding configuredObjectBinding = ConfiguredObjectBinding.getInstance();
OperationStatus status = getConfiguredObjectsDb().get(txn, key, value, LockMode.DEFAULT);
final boolean isNewRecord = status == OperationStatus.NOTFOUND;
if (status == OperationStatus.SUCCESS || (createIfNecessary && isNewRecord)) {
// write the updated entry to the store
configuredObjectBinding.objectToEntry(record, newValue);
status = getConfiguredObjectsDb().put(txn, key, newValue);
if (status != OperationStatus.SUCCESS) {
throw new StoreException("Error updating configuration details within the store: " + status);
}
if (isNewRecord) {
writeHierarchyRecords(txn, record);
}
} else if (status != OperationStatus.NOTFOUND) {
throw new StoreException("Error finding configuration details within the store: " + status);
}
}
use of org.apache.qpid.server.store.StoreException in project qpid-broker-j by apache.
the class BDBMessageStore method doClose.
@Override
protected void doClose() {
if (_environmentFacade != null) {
try {
_environmentFacade.close();
_environmentFacade = null;
} catch (RuntimeException e) {
throw new StoreException("Exception occurred on message store close", e);
}
}
}
use of org.apache.qpid.server.store.StoreException in project qpid-broker-j by apache.
the class ConfiguredObjectBinding method entryToObject.
@Override
public BDBConfiguredObjectRecord entryToObject(TupleInput tupleInput) {
String type = tupleInput.readString();
String json = tupleInput.readString();
ObjectMapper mapper = new ObjectMapper();
try {
Map<String, Object> value = mapper.readValue(json, Map.class);
BDBConfiguredObjectRecord configuredObject = new BDBConfiguredObjectRecord(_uuid, type, value);
return configuredObject;
} catch (IOException e) {
// should never happen
throw new StoreException(e);
}
}
Aggregations