protected UUID makeDatabaseID(boolean create, Properties startParams)
throws StandardException
{
TransactionController tc = af.getTransaction(
ContextService.getFactory().getCurrentContextManager());
String upgradeID = null;
UUID databaseID;
if ((databaseID = (UUID) tc.getProperty(DataDictionary.DATABASE_ID)) == null) {
// no property defined in the Transaction set
// this could be an upgrade, see if it's stored in the service set
UUIDFactory uuidFactory = Monitor.getMonitor().getUUIDFactory();
upgradeID = startParams.getProperty(DataDictionary.DATABASE_ID);
if (upgradeID == null )
{
// just create one
databaseID = uuidFactory.createUUID();
} else {
databaseID = uuidFactory.recreateUUID(upgradeID);
}
tc.setProperty(DataDictionary.DATABASE_ID, databaseID, true);
}
// Remove the database identifier from the service.properties
// file only if we upgraded it to be stored in the transactional
// property set.
if (upgradeID != null)
startParams.remove(DataDictionary.DATABASE_ID);
tc.commit();
tc.destroy();
return databaseID;
}