@Override
	public void setProgram(ProgramDB program) {
		if (this.program != null) {
			throw new AssertException();
		}
		this.program = program;

		try {
			if (upgrade) {
				upgradeOldBookmarks(program);
			}
			else if (bookmarkTypeAdapter instanceof BookmarkTypeDBAdapterNoTable &&
				bookmarkAdapter instanceof BookmarkDBAdapterV0) {
				// Old bookmarks were stored as user properties
				OldBookmarkManager oldMgr = new OldBookmarkManager(program);
				((BookmarkTypeDBAdapterNoTable) bookmarkTypeAdapter).setOldBookmarkManager(oldMgr);
				((BookmarkDBAdapterV0) bookmarkAdapter).setOldBookmarkManager(oldMgr, addrMap,
					TaskMonitor.DUMMY);
			}

			DBRecord[] typeRecords = bookmarkTypeAdapter.getRecords();
			for (DBRecord rec : typeRecords) {
				int typeId = (int) rec.getKey();
				BookmarkTypeDB type =
					new BookmarkTypeDB(typeId, rec.getString(BookmarkTypeDBAdapter.TYPE_NAME_COL));
				type.setHasBookmarks(true);
				typesByName.put(type.getTypeString(), type);
				typesArray.put(typeId, type);
			}
		}
		catch (IOException e) {
			dbError(e);
		}
	}
Constructs a new CodeManager for a program.
@param handle handle to database
@param addrMap addressMap to convert between addresses and long values.
@param openMode either READ_ONLY, UPDATE, or UPGRADE
@param lock the program synchronization lock
@param monitor the task monitor use while upgrading.
@throws VersionException if the database is incompatible with the current
schema
@throws IOException if there is a problem accessing the database.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/bookmark/BookmarkDBManager.java