package com.uas.report.axis;

import java.io.File;
import java.io.IOException;

import com.uas.report.util.FileUtils;

public class FolderHandler extends BasicResourceHandler {

	@Override
	public Class<?> getResourceType() {
		return Folder.class;
	}

	@Override
	public void delete(ResourceDescriptor descriptor) throws IOException {
		if (descriptor == null) {
			return;
		}
		File file = getFile(descriptor.getUriString());
		if (!file.isDirectory()) {
			throw new IOException("资源并非文件夹！");
		}
		FileUtils.deleteDir(file, true);
	}
}
