*/
public NodeRevisionDescriptor retrieveRevisionDescriptor
(Connection connection,Uri uri, NodeRevisionNumber revisionNumber)
throws ServiceAccessException, RevisionDescriptorNotFoundException {
NodeRevisionDescriptor revisionDescriptor = null;
PreparedStatement statement = null;
if(revisionNumber == null)
throw new RevisionDescriptorNotFoundException(uri.toString());
try {
ResultSet res = null;
String branchName = null;
Vector labels = new Vector();
Hashtable properties = new Hashtable();
// Retrieving branch name (and also check that revision
// does indeed exist)
statement = connection.prepareStatement
("select * from revision where uri= ? and xnumber = ?");
statement.setString(1, uri.toString());
statement.setString(2, revisionNumber.toString());
res = statement.executeQuery();
if (res.next()) {
branchName = res.getString(REVISION_BRANCHNAME);
} else {
throw new RevisionDescriptorNotFoundException(uri.toString());
}
closeStatement(statement);
// Retrieve labels
statement = connection.prepareStatement
("select * from label where uri= ? and xnumber = ?");
statement.setString(1, uri.toString());
statement.setString(2, revisionNumber.toString());
res = statement.executeQuery();
while (res.next()) {
labels.addElement(res.getString(LABEL_LABEL));
}
closeStatement(statement);
// Retrieve properties
statement = connection.prepareStatement
("select * from property where uri= ? and xnumber = ?");
statement.setString(1, uri.toString());
statement.setString(2, revisionNumber.toString());
res = statement.executeQuery();
while (res.next()) {
String propertyName = res.getString(PROPERTY_NAME);
String propertyNamespace = res.getString(PROPERTY_NAMESPACE);
NodeProperty property =
new NodeProperty(propertyName,
res.getString(PROPERTY_VALUE),
propertyNamespace,
res.getString(PROPERTY_TYPE),
(res.getInt(PROPERTY_PROTECTED) == 1));
properties.put(propertyNamespace + propertyName, property);
}
revisionDescriptor =
new NodeRevisionDescriptor(revisionNumber, branchName,
labels, properties);
} catch (SQLException e) {
throw createException(e,uri);
} finally {