static ModuleDBAdapter getAdapter(ModuleManager moduleMgr, OpenMode openMode,
			TaskMonitor monitor) throws VersionException, IOException, CancelledException {
		long treeID = moduleMgr.getTreeID();
		DBHandle handle = moduleMgr.getDatabaseHandle();
		try {
			return new ModuleDBAdapterV1(handle, openMode == OpenMode.CREATE, treeID);
		}
		catch (VersionException e) {
			// V0 read-only is slow - force upgrade
			if (!e.isUpgradable() || openMode != OpenMode.UPGRADE) {
				throw e;
			}
			ModuleDBAdapter adapter = findReadOnlyAdapter(moduleMgr);
			return upgrade(moduleMgr, adapter, monitor);
		}
	}
Gets an adapter for working with the  program tree module database table.
@param moduleMgr module manager for corresponding program tree.
@param openMode the mode this adapter is to be opened for (CREATE, UPDATE, READ_ONLY, UPGRADE).
@param monitor task monitor
@return module table adapter
@throws VersionException if the database handle's version doesn't match the expected version.
@throws IOException if there is a problem accessing the database.
@throws CancelledException if task cancelled
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/module/ModuleDBAdapter.java