Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
removed rpm parser - no-one used that thing - loading huge rpm files bay be causes for crashes
orbitereea4c17ef265
diff --git a/.classpath b/.classpathindex 10fe6dcd2..0f0590b67 100644--- a/.classpath+++ b/.classpath@@ -33,7 +33,6 @@<classpathentry kind="lib" path="lib/poi-scratchpad-3.2-FINAL-20081019.jar"/><classpathentry kind="lib" path="lib/webcat-0.1-swf.jar"/><classpathentry kind="lib" path="lib/odf_utils_05_11_29.jar"/>- <classpathentry kind="lib" path="lib/jrpm-SNAPSHOT.jar"/><classpathentry kind="lib" path="lib/activation.jar"/><classpathentry kind="lib" path="lib/commons-jxpath-1.3.jar"/><classpathentry kind="output" path="gen"/>diff --git a/build.xml b/build.xmlindex 4c7352e47..5028333a0 100644--- a/build.xml+++ b/build.xml@@ -175,7 +175,6 @@<pathelement location="${lib}/commons-jxpath-1.3.jar" /><pathelement location="${lib}/commons-logging-1.1.1.jar" /><pathelement location="${lib}/jakarta-oro-2.0.7.jar" />- <pathelement location="${lib}/jrpm-SNAPSHOT.jar" /><pathelement location="${lib}/jsch-0.1.21.jar" /><pathelement location="${lib}/log4j-1.2.9.jar" /><pathelement location="${lib}/mysql-connector-java-5.1.7-bin.jar" />@@ -814,20 +813,6 @@</jar></target>-<!--- Explanation of the confusing Exe Targets:- -makeWinStartExe creates a windows-program, which starts yacy instead- of the startYACY.bat file.- -distWithWinStartExe creates a tarball with the program included-- This needs jsmoothgen-- -distWininstaller and- winInstallerExe build a installer-programm for windows, instead of a tar.gz.-- This needs nsis-ant-1.2.jar in the yacyfolder.--->-<target name="rpm" depends="all" description="Creates the main rpm-package and another for lib"><mkdir dir="${release}/RPMS/noarch" /><mkdir dir="${release}/BUILD" />diff --git a/lib/jrpm-SNAPSHOT.jar b/lib/jrpm-SNAPSHOT.jardeleted file mode 100644index b5ca56888..000000000Binary files a/lib/jrpm-SNAPSHOT.jar and /dev/null differdiff --git a/source/de/anomic/document/Parser.java b/source/de/anomic/document/Parser.javaindex f2b136905..fc06420c5 100644--- a/source/de/anomic/document/Parser.java+++ b/source/de/anomic/document/Parser.java@@ -47,7 +47,6 @@ import de.anomic.document.parser.odtParser;import de.anomic.document.parser.pdfParser;import de.anomic.document.parser.pptParser;import de.anomic.document.parser.psParser;-import de.anomic.document.parser.rpmParser;import de.anomic.document.parser.rssParser;import de.anomic.document.parser.rtfParser;import de.anomic.document.parser.sevenzipParser;@@ -85,7 +84,6 @@ public final class Parser {initParser(new pdfParser());initParser(new pptParser());initParser(new psParser());- initParser(new rpmParser());initParser(new rssParser());initParser(new rtfParser());initParser(new sevenzipParser());diff --git a/source/de/anomic/document/parser/rpmParser.java b/source/de/anomic/document/parser/rpmParser.javadeleted file mode 100644index f9550f1b9..000000000--- a/source/de/anomic/document/parser/rpmParser.java+++ /dev/null@@ -1,182 +0,0 @@-//rpmParser.java-//-------------------------//part of YaCy-//(C) by Michael Peter Christen; [email protected]-//first published on http://www.anomic.de-//Frankfurt, Germany, 2005-//-//this file is contributed by Martin Thelian-//-// $LastChangedDate$-// $LastChangedRevision$-// $LastChangedBy$-//-//This program is free software; you can redistribute it and/or modify-//it under the terms of the GNU General Public License as published by-//the Free Software Foundation; either version 2 of the License, or-//(at your option) any later version.-//-//This program is distributed in the hope that it will be useful,-//but WITHOUT ANY WARRANTY; without even the implied warranty of-//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-//GNU General Public License for more details.-//-//You should have received a copy of the GNU General Public License-//along with this program; if not, write to the Free Software-//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA--package de.anomic.document.parser;--import java.io.ByteArrayInputStream;-import java.io.File;-import java.io.InputStream;-import java.util.HashMap;-import java.util.HashSet;-import java.util.Set;--import com.jguild.jrpm.io.RPMFile;-import com.jguild.jrpm.io.datatype.DataTypeIf;--import de.anomic.crawler.retrieval.HTTPLoader;-import de.anomic.document.AbstractParser;-import de.anomic.document.Idiom;-import de.anomic.document.ParserException;-import de.anomic.document.Document;-import de.anomic.http.httpClient;-import de.anomic.http.httpHeader;-import de.anomic.http.httpRequestHeader;-import de.anomic.kelondro.util.FileUtils;-import de.anomic.yacy.yacyURL;--/**- * @author theli- *- */-public class rpmParser extends AbstractParser implements Idiom {-- /**- * a list of mime types that are supported by this parser class- * @see #getSupportedMimeTypes()- */- public static final Set<String> SUPPORTED_MIME_TYPES = new HashSet<String>();- public static final Set<String> SUPPORTED_EXTENSIONS = new HashSet<String>();- static {- SUPPORTED_EXTENSIONS.add("rpm");- SUPPORTED_MIME_TYPES.add("application/x-rpm");- SUPPORTED_MIME_TYPES.add("application/x-redhat packet manager");- SUPPORTED_MIME_TYPES.add("application/x-redhat-package-manager");- }-- public rpmParser() {- super("rpm Parser");- }-- public Set<String> supportedMimeTypes() {- return SUPPORTED_MIME_TYPES;- }-- public Set<String> supportedExtensions() {- return SUPPORTED_EXTENSIONS;- }-- public Document parse(final yacyURL location, final String mimeType, final String charset,- final InputStream source) throws ParserException {- File dstFile = null;- try {- dstFile = File.createTempFile("rpmParser",".prt");- FileUtils.copy(source,dstFile);- return parse(location,mimeType,charset,dstFile);- } catch (final Exception e) {- return null;- } finally {- if (dstFile != null) FileUtils.deletedelete(dstFile);- }- }-- @Override- public Document parse(final yacyURL location, final String mimeType, final String charset, final File sourceFile) throws ParserException, InterruptedException {- RPMFile rpmFile = null;- try {- String summary = null, description = null, packager = null, name = sourceFile.getName();- final HashMap<yacyURL, String> anchors = new HashMap<yacyURL, String>();- final StringBuilder content = new StringBuilder();-- // opening the rpm file- rpmFile = new RPMFile(sourceFile);-- // parsing the file- rpmFile.parse();-- // getting all header names- final String[] headerNames = rpmFile.getTagNames();- for (int i=0; i<headerNames.length; i++) {- // check for interruption- checkInterruption();-- // getting the next tag- final DataTypeIf tag = rpmFile.getTag(headerNames[i]);- if (tag == null) continue;-- content.append(headerNames[i])- .append(": ")- .append(tag.toString())- .append("\n");-- if (headerNames[i].equalsIgnoreCase("N")) name = tag.toString();- else if (headerNames[i].equalsIgnoreCase("SUMMARY")) summary = tag.toString();- else if (headerNames[i].equalsIgnoreCase("DESCRIPTION")) description = tag.toString();- else if (headerNames[i].equalsIgnoreCase("PACKAGER")) packager = tag.toString();- //else if (headerNames[i].equalsIgnoreCase("URL")) anchors.put(new yacyURL(tag.toString(), null), tag.toString());- }-- // closing the rpm file- rpmFile.close();- rpmFile = null;- if (summary == null) summary = name;-- final Document theDoc = new Document(- location,- mimeType,- "UTF-8",- null,- null,- summary,- packager,- null,- description,- content.toString().getBytes("UTF-8"),- anchors,- null);-- return theDoc;- } catch (final Exception e) {- if (e instanceof InterruptedException) throw (InterruptedException) e;- if (e instanceof ParserException) throw (ParserException) e;-- throw new ParserException("Unexpected error while parsing rpm file. " + e.getMessage(),location);- } finally {- if (rpmFile != null) try { rpmFile.close(); } catch (final Exception e) {/* ignore this */}- }- }-- @Override- public void reset() {- // Nothing todo here at the moment- super.reset();- }-- public static void main(final String[] args) {- try {- final yacyURL contentUrl = new yacyURL(args[0], null);-- final rpmParser testParser = new rpmParser();- final httpRequestHeader reqHeader = new httpRequestHeader();- reqHeader.put(httpHeader.USER_AGENT, HTTPLoader.crawlerUserAgent);- final byte[] content = httpClient.wget(contentUrl.toString(), reqHeader, 10000);- final ByteArrayInputStream input = new ByteArrayInputStream(content);- testParser.parse(contentUrl, "application/x-rpm", null, input);- } catch (final Exception e) {- e.printStackTrace();- }- }-}