public void delete(String name, ModuleType type) {
		ModuleDefinition definition = registry.findDefinition(name, type);
		if (definition == null) {
			throw new NoSuchModuleException(name, type);
		}
		Set<String> dependents = this.dependencyRepository.find(name, type);
		if (!dependents.isEmpty()) {
			throw new DependencyException("Cannot delete module %2$s:%1$s because it is used by %3$s", name, type,
					dependents);
		}

		boolean result = this.registry.delete(definition);
		Assert.isTrue(result, String.format("Could not delete module '%s:%s'", type, name));
	}
Throws an exception if either one of the following is true:<ul>
    <li>a module with the given name and type already exists and force is {@code false}</li>
    <li>force if {@true} but the module is in use (by a stream or composed module)</li>
</ul>

<p>Also, will actually delete the already existing definition in case of an update,
even though it would be overwritten by a registry, to cover the cases where a composed
module is being replaced by a simple uploaded module, and <i>vice versa</i>.</p>

@param name name of the module we're trying to update/create
@param type type of the module we're trying to update/create
@param force whether to attempt to force update if the module already exists
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/module/support/ModuleDefinitionService.java