if (obj.hasContentModel(Models.SERVICE_DEPLOYMENT_3_0)){
updateDeploymentMap(obj, conn);
}
} catch (SQLException sqle) {
throw new StorageDeviceException("Unexpected error from SQL database while registering object: "
+ sqle.getMessage(), sqle);
} finally {
try {
if (s1 != null) {
s1.close();
}
} catch (Exception sqle) {
throw new StorageDeviceException("Unexpected error from SQL database while registering object: "
+ sqle.getMessage(), sqle);
} finally {
s1 = null;
}
}
PreparedStatement s2 = null;
ResultSet results = null;
try {
// REGISTRY:
// update systemVersion in doRegistry (add one)
logger.debug("COMMIT: Updating registry...");
String query =
"SELECT systemVersion FROM doRegistry WHERE doPID=?";
s2 = conn.prepareStatement(query);
s2.setString(1, pid);
results = s2.executeQuery();
if (!results.next()) {
throw new ObjectNotFoundException("Error creating replication job: The requested object doesn't exist in the registry.");
}
int systemVersion = results.getInt("systemVersion");
systemVersion++;
query = "UPDATE doRegistry SET systemVersion=? WHERE doPID=?";
s2 = conn.prepareStatement(query);
s2.setInt(1, systemVersion);
s2.setString(2,pid);
s2.executeUpdate();
} catch (SQLException sqle) {
throw new StorageDeviceException("Error creating replication job: "
+ sqle.getMessage());
} catch (ObjectNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if (results != null) {
results.close();
}
if (s2 != null) {
s2.close();
}
if (conn != null) {
m_connectionPool.free(conn);
}
} catch (SQLException sqle) {
throw new StorageDeviceException("Unexpected error from SQL database: "
+ sqle.getMessage());
} finally {
results = null;
s2 = null;
}