protected Program createProgram(ByteProvider provider, String domainFileName,
			Address imageBase, String executableFormatName, Language language,
			CompilerSpec compilerSpec, Object consumer) throws IOException {

		String programName = getProgramNameFromSourceData(provider, domainFileName);
		Program prog = new ProgramDB(programName, language, compilerSpec, consumer);
		prog.setEventsEnabled(false);
		int id = prog.startTransaction("Set program properties");
		boolean success = false;
		try {
			setProgramProperties(prog, provider, executableFormatName);
			try {
				if (shouldSetImageBase(prog, imageBase)) {
					prog.setImageBase(imageBase, true);
				}
				success = true;
				return prog;
			}
			catch (LockException | AddressOverflowException e) {
				// shouldn't ever happen here
				throw new IOException(e);
			}
		}
		finally {
			prog.endTransaction(id, true); // More efficient to commit when program will be discarded
			if (!success) {
				prog.release(consumer);
			}
		}
	}
Creates a {@link Program} with the specified attributes.

@param provider The bytes that will make up the {@link Program}.
@param domainFileName The name for the DomainFile that will store the {@link Program}.
@param imageBase  The image base address of the {@link Program}.
@param executableFormatName The file format name of the {@link Program}.  Typically this will
  be the {@link Loader} name.
@param language The {@link Language} of the {@link Program}.
@param compilerSpec The {@link CompilerSpec} of the {@link Program}.
@param consumer A consumer object for the {@link Program} generated.
@return The newly created {@link Program}.
@throws IOException if there was an IO-related problem with creating the {@link Program}.
Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractProgramLoader.java