@Override
	public boolean registerNew(ModuleDefinition definition) {
		if (!(definition instanceof UploadedModuleDefinition)) {
			return false;
		}
		UploadedModuleDefinition uploadedModuleDefinition = (UploadedModuleDefinition) definition;
		try {
			Resource archive = getResources(definition.getType().name(), definition.getName(),
					ARCHIVE_AS_FILE_EXTENSION).iterator().next();
			if (archive instanceof WritableResource) {
				WritableResource writableResource = (WritableResource) archive;
				Assert.isTrue(!writableResource.exists(), "Could not install " + uploadedModuleDefinition
						+ " at location " + writableResource + " as that file already exists");

				MessageDigest md = MessageDigest.getInstance("MD5");
				DigestInputStream dis = new DigestInputStream(uploadedModuleDefinition.getInputStream(), md);
				FileCopyUtils.copy(dis, writableResource.getOutputStream());
				WritableResource hashResource = (WritableResource) hashResource(writableResource);
				// Write hash last
				FileCopyUtils.copy(bytesToHex(md.digest()), hashResource.getOutputStream());

				return true;
			}
			else {
				return false;
			}
		}
		catch (IOException | NoSuchAlgorithmException e) {
			throw new RuntimeException("Error trying to save " + uploadedModuleDefinition, e);
		}
	}
Whether to attempt to create the directory structure at startup (disable for read-only implementations).
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/module/WritableResourceModuleRegistry.java