/** * Add a webLinkedFile in the queue if it hasn't been already downloaded and if it respect the * good host or protocol * * @param uri the URI to add * @param depth the depth of the URI * @param parent the webHtmlFile parent */ public void addLinkedFile(URI uri, int depth, WebFile parent) { // creates the webLinkedFile according to the URI if (!isUriAlreadyDownloaded(uri)) { // verification if the depth is good if (depth <= maxDepth) { discoveredURI.add(Utils.getCompletePath(uri)); WebLinkedFile webLinkedFile = new WebLinkedFile(uri, depth, parent); String webFileHost = Utils.getCompleteHost(webLinkedFile.getURI()); // filter the linked files with the Filter RE r = new RE(regExp); if (r.match(webLinkedFile.getFileName())) { if (webFileHost.equals(defaultHost)) { linkedFileToDownload.add(webLinkedFile); // add the webHtmlFile in the treeModel DiscoveryTreeNode parentNode = (DiscoveryTreeNode) treeRoot.getChild(parent); DiscoveryTreeNode node = parentNode.add(webLinkedFile); treeModel.nodesWereInserted(parentNode, new int[] {parentNode.getIndex(node)}); // add the webHtmlFile in the detailledModel detailledModel.addElement(webLinkedFile); } else { // it is not the same web site or the same protocol System.err.println( webLinkedFile.getURI() + " / " + defaultHost + ": NOT THE SAME HOST OR THE SAME PROTOCOL"); } } } } }