private void checkLoaded() {
if ( loaded )
return;
Transaction tx = new Transaction();
try {
sysObj = collection.getSystemCollection().getCollection(SystemCollection.OBJECTS);
docKey = PREFIX + collection.getCanonicalName();
doc = (Document)sysObj.getDocument(tx, docKey);
if ( doc != null ) {
Element e = doc.getDocumentElement();
NodeList nl = e.getElementsByTagName(SEQUENCE);
for ( int i = 0; i < nl.getLength(); i++ ) {
Element elem = (Element)nl.item(i);
String name = elem.getAttribute(NAME);
long val = Long.parseLong(elem.getAttribute(VALUE));
values.put(name, new SequenceValue(elem, val));
}
}
else {
doc = DOMHelper.newDocument();
doc.appendChild(doc.createElement(SEQUENCES));
}
loaded = true;
}
catch ( Exception e ) {
try {
tx.cancel();
}
catch ( DBException ex ) {
e.printStackTrace(System.err);
}
}
finally {
if ( tx.getStatus() == Transaction.ACTIVE ) {
try {
tx.commit();
}
catch ( DBException e ) {
e.printStackTrace(System.err);
}
}