Configuration conf = OjbConfigurator.getInstance().getConfigurationFor(null);
Class lockMapClass = conf.getClass("LockMapClass", Object.class);
Class lockManagerClass = conf.getClass("LockManagerClass", null);
if(lockManagerClass == null)
{
throw new OJBRuntimeException(buildErrorMsg(lockMapClass, lockManagerClass));
}
if(!lockMapClass.equals(Object.class))
{
// use the deprecated old odmg locking stuff
log.info("Setup *deprecated* odmg-locking api.");
log.info("Used LockManagerClass=" + lockManagerClass);
log.info("Used LockMapClass=" + lockMapClass);
if(!org.apache.ojb.odmg.locking.LockManager.class.isAssignableFrom(lockManagerClass))
{
throw new OJBRuntimeException(buildErrorMsg(lockMapClass, lockManagerClass));
}
setupLockManager(lockManagerClass);
}
else
{
// use the kernel locking api
log.info("Setup odmg-locking api.");
log.info("Used LockManagerClass=" + lockManagerClass);
if(org.apache.ojb.odmg.locking.LockManager.class.isAssignableFrom(lockManagerClass))
{
throw new OJBRuntimeException(buildErrorMsg(lockMapClass, lockManagerClass));
}
setupLockManager(conf, lockManagerClass);
}
}