res = collection.createResource(file.getName(), "XMLResource");
resourceType = type.equals("binary") ? "BinaryResource" : "XMLResource"; res = collection.createResource(file.getName(), resourceType);
	public void execute() throws BuildException {		if (uri == null)			throw new BuildException("you have to specify an XMLDB collection URI");		if (fileSet == null)			throw new BuildException("no file set specified");		registerDatabase();		int p = uri.indexOf("/db");		if (p < 0)			throw new BuildException("invalid uri: " + uri);		try {			String baseURI = uri.substring(0, p);			String path;			if (p == uri.length() - 3)				path = "";			else				path = uri.substring(p + 3);			Collection root = null;			if (createCollection) {				root = DatabaseManager.getCollection(baseURI + "/db");				root = mkcol(root, baseURI, "/db", path);			} else				root = DatabaseManager.getCollection(uri, user, password);			if (root == null)				throw new BuildException("collection " + uri + " not found");			DirectoryScanner scanner =				fileSet.getDirectoryScanner(getProject());			scanner.scan();			String[] files = scanner.getIncludedFiles();			log("Found " + files.length + " files.\n");			Collection collection = root;			Resource res;			File file;			String relDir, prevDir = null;			for (int i = 0; i < files.length; i++) {				file =					new File(scanner.getBasedir() + File.separator + files[i]);				log("Storing " + files[i] + " ...\n");				p = files[i].lastIndexOf(File.separatorChar);				if (p > -1) {					relDir = files[i].substring(0, p);					if (createSubcollections && (prevDir == null || (!relDir.equals(prevDir)))) {						collection = mkcol(root, baseURI, "/db" + path, relDir);						prevDir = relDir;					}				}				res = collection.createResource(file.getName(), "XMLResource");				res.setContent(file);				collection.storeResource(res);			}		} catch (XMLDBException e) {			throw new BuildException(				"XMLDB exception caught: " + e.getMessage(),				e);		}	}