Merge branch 'master' of ssh://gitorious.org/yacy/rc1

This commit is contained in:
Michael Christen 2011-12-05 12:18:14 +01:00
commit 5019e132c7
22 changed files with 777 additions and 376 deletions

View File

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="env/|htdocsdefault/|proxymsg/|yacy/|env/|yacy/user/|yacy/user/|yacy/ui/|processing/domaingraph/applet/|processing/domaingraph/|api/|api/bookmarks/posts/|api/bookmarks/|api/util/|api/bookmarks/xbel/|api/bookmarks/tags/|api/ymarks/" kind="src" path="htroot"/>
<classpathentry kind="src" path="test"/>
<classpathentry excluding="user/|user/|ui/" kind="src" path="htroot/yacy"/>
<classpathentry kind="src" path="htroot/env"/>
<classpathentry kind="src" path="source"/>
<classpathentry kind="src" path="htroot/yacy/ui"/>
<classpathentry excluding="bookmarks/posts/|bookmarks/|util/|bookmarks/xbel/|bookmarks/tags/|ymarks/" kind="src" path="htroot/api"/>
<classpathentry kind="src" path="htroot/api/bookmarks/posts"/>
<classpathentry excluding="posts/|xbel/|tags/" kind="src" path="htroot/api/bookmarks"/>
<classpathentry kind="src" path="htroot/api/bookmarks/xbel"/>
<classpathentry kind="src" path="htroot/api/bookmarks/tags"/>
<classpathentry kind="src" path="htroot/api/ymarks"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/servlet-api.jar"/>

View File

@ -7,7 +7,7 @@ releaseVersion=1.0
stdReleaseFile=yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
sourceReleaseFile=yacy_src_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
releaseFileParentDir=yacy
releaseNr=$Revision$
releaseNr=$Revision: 8135 $
privateKeyFile=private.key
# defining some file/directory access rights

View File

@ -9,7 +9,7 @@
// $LastChangedBy$
//
// LICENSE
//
//
// 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
@ -26,6 +26,7 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.NavigableSet;
import java.util.Set;
@ -40,7 +41,6 @@ import net.yacy.peers.operation.yacyBuildProperties;
import net.yacy.peers.operation.yacyRelease;
import net.yacy.peers.operation.yacyVersion;
import net.yacy.search.Switchboard;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@ -62,12 +62,12 @@ public class ConfigUpdate_p {
} else {
prop.put("candeploy", "0");
}
prop.put("candeploy_configCommit", "0");
prop.put("candeploy_autoUpdate", "0");
prop.put("candeploy_downloadsAvailable", "0");
if (post != null) {
// check if update is supposed to be installed and a release is defined
if (post.containsKey("update") && !post.get("releaseinstall", "").isEmpty()) {
@ -77,16 +77,16 @@ public class ConfigUpdate_p {
prop.put("candeploy", "2"); // display nothing else
return prop;
}
if (post.containsKey("downloadRelease")) {
// download a release
final String release = post.get("releasedownload", "");
if (!release.isEmpty()) {
try {
yacyRelease versionToDownload = new yacyRelease(new DigestURI(release));
// replace this version with version which contains public key
yacyRelease.DevAndMainVersions allReleases = yacyRelease.allReleases(false, false);
final yacyRelease.DevAndMainVersions allReleases = yacyRelease.allReleases(false, false);
final Set<yacyRelease> mostReleases = versionToDownload.isMainRelease() ? allReleases.main : allReleases.dev;
for (final yacyRelease rel : mostReleases) {
if (rel.equals(versionToDownload)) {
@ -101,7 +101,7 @@ public class ConfigUpdate_p {
}
}
}
if (post.containsKey("checkRelease")) {
yacyRelease.allReleases(true, false);
}
@ -117,7 +117,7 @@ public class ConfigUpdate_p {
}
}
}
if (post.containsKey("autoUpdate")) {
final yacyRelease updateVersion = yacyRelease.rulebasedUpdateInfo(true);
if (updateVersion == null) {
@ -142,7 +142,7 @@ public class ConfigUpdate_p {
}
}
}
if (post.containsKey("configSubmit")) {
prop.put("candeploy_configCommit", "1");
sb.setConfig("update.process", ("manual".equals(post.get("updateMode", "manual"))) ? "manual" : "auto");
@ -152,7 +152,7 @@ public class ConfigUpdate_p {
sb.setConfig("update.onlySignedFiles", (post.getBoolean("onlySignedFiles", false)) ? "1" : "0");
}
}
// version information
final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
prop.putHTML("candeploy_versionpp", versionstring);
@ -163,18 +163,18 @@ public class ConfigUpdate_p {
thisVersion = (float) (Math.round(thisVersion*1000.0)/1000.0);
} catch (final NumberFormatException e) {}
// list downloaded releases
final File[] downloadedFiles = sb.releasePath.listFiles();
// list can be null if RELEASE directory has been deleted manually
final int downloadedFilesNum = (downloadedFiles == null) ? 0 : downloadedFiles.length;
prop.put("candeploy_deployenabled", (downloadedFilesNum == 0) ? "0" : ((devenvironment) ? "1" : "2")); // prevent that a developer-version is over-deployed
final NavigableSet<yacyRelease> downloadedReleases = new TreeSet<yacyRelease>();
for (final File downloaded : downloadedFiles) {
try {
yacyRelease release = new yacyRelease(downloaded);
final yacyRelease release = new yacyRelease(downloaded);
downloadedReleases.add(release);
} catch (final RuntimeException e) {
// not a valid release
@ -186,11 +186,11 @@ public class ConfigUpdate_p {
}
}
// latest downloaded release
yacyVersion dflt = (downloadedReleases.isEmpty()) ? null : downloadedReleases.last();
final yacyVersion dflt = (downloadedReleases.isEmpty()) ? null : downloadedReleases.last();
// check if there are any downloaded releases and if there are enable the update buttons
prop.put("candeploy_downloadsAvailable", (downloadedReleases.isEmpty()) ? "0" : "1");
prop.put("candeploy_deployenabled_buttonsActive", (downloadedReleases.isEmpty() || devenvironment) ? "0" : "1");
int relcount = 0;
for(final yacyRelease release : downloadedReleases) {
prop.put("candeploy_downloadedreleases_" + relcount + "_name", ((release.isMainRelease()) ? "main" : "dev") + " " + release.getReleaseNr() + "/" + release.getSvn());
@ -204,29 +204,28 @@ public class ConfigUpdate_p {
// list remotely available releases
final yacyRelease.DevAndMainVersions releasess = yacyRelease.allReleases(false, false);
relcount = 0;
// main
final Set<yacyRelease> remoteMainReleases = releasess.main;
remoteMainReleases.removeAll(downloadedReleases);
for (final yacyRelease release : remoteMainReleases) {
prop.put("candeploy_availreleases_" + relcount + "_name", ((release.isMainRelease()) ? "main" : "dev") + " " + release.getReleaseNr() + "/" + release.getSvn());
prop.put("candeploy_availreleases_" + relcount + "_url", release.getUrl().toString());
prop.put("candeploy_availreleases_" + relcount + "_signatures", (release.getPublicKey()!=null?"1":"0"));
prop.put("candeploy_availreleases_" + relcount + "_selected", "0");
relcount++;
}
// dev
dflt = (releasess.dev.isEmpty()) ? null : releasess.dev.last();
final ArrayList<yacyRelease> rlist = new ArrayList<yacyRelease>();
final Set<yacyRelease> remoteDevReleases = releasess.dev;
remoteDevReleases.removeAll(downloadedReleases);
for (final yacyRelease release : remoteDevReleases) {
rlist.add(release);
}
final Set<yacyRelease> remoteMainReleases = releasess.main;
remoteMainReleases.removeAll(downloadedReleases);
for (final yacyRelease release : remoteMainReleases) {
rlist.add(release);
}
yacyRelease release;
for (int i = rlist.size() - 1; i >= 0; i--) {
release = rlist.get(i);
prop.put("candeploy_availreleases_" + relcount + "_name", ((release.isMainRelease()) ? "main" : "dev") + " " + release.getReleaseNr() + "/" + release.getSvn());
prop.put("candeploy_availreleases_" + relcount + "_url", release.getUrl().toString());
prop.put("candeploy_availreleases_" + relcount + "_signatures", (release.getPublicKey()!=null?"1":"0"));
prop.put("candeploy_availreleases_" + relcount + "_selected", (release == dflt) ? "1" : "0");
prop.put("candeploy_availreleases_" + relcount + "_selected", (relcount == 0) ? "1" : "0");
relcount++;
}
prop.put("candeploy_availreleases", relcount);
// properties for automated system update
@ -243,7 +242,7 @@ public class ConfigUpdate_p {
prop.put("candeploy_lastdeploy", (sb.getConfigLong("update.time.deploy", 0) == 0) ? "0" : "1");
prop.put("candeploy_lastdeploy_time", new Date(sb.getConfigLong("update.time.deploy", 0)).toString());
prop.put("candeploy_onlySignedFiles", ("1".equals(sb.getConfig("update.onlySignedFiles", "1"))) ? "1" : "0");
/*
if ((adminaccess) && (yacyVersion.latestRelease >= (thisVersion+0.01))) { // only new Versions(not new SVN)
if ((yacyVersion.latestMainRelease != null) ||
@ -257,12 +256,12 @@ public class ConfigUpdate_p {
}
}
prop.put("hintVersionAvailable", 1); // for testing
prop.putASIS("hintVersionDownload_versionResMain", (yacyVersion.latestMainRelease == null) ? "-" : yacyVersion.latestMainRelease.toAnchor());
prop.putASIS("hintVersionDownload_versionResDev", (yacyVersion.latestDevRelease == null) ? "-" : yacyVersion.latestDevRelease.toAnchor());
prop.put("hintVersionAvailable_latestVersion", Float.toString(yacyVersion.latestRelease));
*/
return prop;
}

View File

@ -750,6 +750,8 @@ Replace the word \"MySearch\" with your own message==Ersetzen Sie das Wort "Mein
Manual System Update==Manuelle Systemaktualisierung
Current installed Release==Aktuell installierte Version
Available Releases==Verfügbare Versionen
\(unsigned\)==(unsigniert)
\(signed\)==(signiert)
"Download Release"=="Version Herunterladen"
"Check for new Release"=="Nach neuer Version suchen"
Downloaded Releases==Heruntergeladene Versionen
@ -3175,6 +3177,8 @@ This search result can also be retrieved as RSS/<a href=\"http://www.opensearch.
The query format is similar to <a href=\"http://www.loc.gov/standards/sru/\">SRU</a>.==Das Abfrageformat ist ähnlich dem <a href="http://www.loc.gov/standards/sru/">SRU</a>.
Click the API icon to see an example call to the search rss API.==Klicken Sie auf das API Symbol, um einen Beispielaufruf der RSS Such API zu sehen.
To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de/wiki/index.php/Dev:API">API wiki page</a>.==Um eine Liste aller APIs zu sehen, besuchen Sie die <a href="http://www.yacy-websuche.de/wiki/index.php/Dev:API">API Seite im Wiki</a>.
loading from local index...==lädt aus lokalem Index...
e="Search"==e="Suchen"
#-----------------------------
#File: yacysearch.html

215
locales/gr.lng Normal file
View File

@ -0,0 +1,215 @@
# gr.lng
# English-->Greek
# -----------------------
# part of YaCy
# (C) by Michael Peter Christen; mc@anomic.de
# first published on http://www.anomic.de
# Frankfurt, Germany, 2005
#
#
# This file is written by (chronological order) Constantine Mousafiris <kvisitor@gnugr.org>
# Αυτό το αρχείο γράφτηκε (με χρονολογική σειρά) από τον Κωστή Μουσαφείρη <kvisitor@gnugr.org>
# If you find any mistakes or untranslated strings in this file please don't hesitate to email them to the maintainer.
# Αν βρείτε τυχόν σφάλματα ή αμετάφραστες γραμμές κειμένου σε αυτό το αρχείο, παρακαλώ μη διστάσετε να τα στείλλετε με ένα email στον συντηρητή.
#File: Language_p.html
#---------------------------
#Only part 1.
#Μόνον το Μέρος 1.
#Contributors are in chronological order, not how much they did absolutely.
#Οι άνθρωποι που συνεισέφεραν παρατίθενται κατά χρονολογική σειρά, και όχι με βάση το πόσο πολλά προσέφεραν κατ' απόλυτη έννοια.
#Thank you for your help!
#Σας ευχαριστούμε για τη βοήθειά σας!
<!-- lang -->default\(english\)==Greek
<!-- author -->==Constantine Mousafiris
<!-- maintainer -->==
#-----------------------------
#File: Blacklist_p.html
#---------------------------
Blacklist Manager==Διαχειριστής Blacklist
Blacklist==Μαύρη Λίστα
This function provides an URL filter to the proxy; any blacklisted URL is blocked==Αυτή η λειτουργία παρέχει στον proxy ένα φίλτρο για τις URL. Στις URL που περιλαμβάνονται στη Μαύρη Λίστα, δεν θα επιτραπεί να
from being loaded. You can define several blacklists and activate them separately.== φορτωθούν. Μπορείτε να ορίσετε διάφορες Μαύρες Λίστες και να τις ενεργοποιήσετε ξεχωριστά.
You may also provide your blacklist to other peers by sharing them; in return you may==Μπορείτε, επίσης, να προσφέρετε τη Μαύρη Λίστα σας στους άλλους ομότιμους χρήστες, καθιστώντας την διαμοιράσιμη. Σε αντάλλαγμα μπορείτε να
collect blacklist entries from other peers.==συλλέγετε τις καταχωρήσεις από τις Μαύρες Λίστες των άλλων ομότιμων χρηστών.
Edit list:==Τροποποίηση καταλόγου:
\(active\)\#not active::active\#\(/active\)\# \#\(shared\)\#not shared::shared\#\(/shared\)==(active)#ανενεργή::ενεργή#(/active)# #(shared)#μη διαμοιρασμένη::διαμοιρασμένη#(/shared)
"select"=="επιλέξτε"
New list:==Νέος κατάλογος:
"create"=="δημιουργία"
Enable/disable this list==Ενεργοποίηση/Απενεργοποίηση Λίστας
Share/don't share this list==Μοιράσου/Μη μοιράζεσαι αυτή τη λίστα
Change==Αλλαγή
Delete this list==Διαγραφή λίστας
/>active==/>ενεργός
/>shared==/>διαμοιρασμένος
Active list:==Ενεργή Λίστα:
These are the domain name / path patterns in this blacklist:==Αυτά είναι τα ονόματα χώρου (domain name)/διαδρομές σε αυτή την Μαύρη Λίστα:
You can select them here for deletion==Μπορείτε να τα επιλέξετε εδώ για διαγραφή
Delete URL pattern==Διαγραφή του URL pattern
Enter new domain name / path pattern in the form:==Βάλτε στη φόρμα ένα νέο όνομα χώρου (domain name)/διαδρομή
path-regexpr==path-regexpr
Add URL pattern==Προσθήκη ενός URL pattern
Import blacklist items from other YaCy peers:==Εισαγωγή καταχωρήσεων από Μαύρες Λίστες άλλων ομότιμων χρηστών του YacY:
Host:==Host:
"Load new blacklist items"=="Φορτώστε νέες καταχωρήσεις στη Μαύρη Λίστα"
Import blacklist items from URL:==Εισαγωγή καταχωρήσεων της Μαύρης Λίστας από την URL
URL:==URL:
"Load new blacklist items"=="Φορτώστε νέες καταχωρήσεις στη Μαύρη Λίστα"
Import blacklist items from file:==Εισαγωγή καταχωρήσεων που βρίσκονται σε Μαύρες Λίστες, από το αρχείο:
"Load new blacklist items"=="Φορτώστε νέες καταχωρήσεις στη Μαύρη Λίστα"
was removed from blacklist==αφαιρέθηκε από τη Μαύρη Λίστα
was added to the blacklist==προσετέθη στη Μαύρη Λίστα
File:==Αρχείο:
#-----------------------------
#File: Bookmarks.html
#---------------------------
YaCy \'\#\[clientname\]\#\': Bookmarks==YaCy '#[clientname]#': Bookmarks
<h2>Bookmarks==<h2>Bookmarks
Add Bookmark==Προσθήκη Σελειδοδείκτη (Bookmark)
Edit Bookmark==Τροποποίηση Σελειδοδείκτη (Bookmark)
Url:==URL:
Title:==Τίτλος:
Description:==Περιγραφή:
Tags \(comma separated\):==Tags (χωρισμένα με κόμματα):
Public:==Δημόσιος:
yes==ναι
no==όχι
"create"=="δημιουργία"
"edit"=="τροποποίηση"
Tagged with==Ετικέττα
Edit==Τροποποίηση
Delete==Διαγραφή
next page==επόμενη σελίδα
All==Όλα
#-----------------------------
#File: CacheAdmin_p.html
#---------------------------
Local Cache Management==Διαχείριση τοπικής Cache
Local Cache==Τοπική Cache
The current cache size is==Το μέγεθος που έχει τώρα η cache είναι
The maximum cache size is==Το ανώτατο μέγεθος της cache είναι
#-----------------------------
#File: ConfigProfile_p.html
#---------------------------
Your Personal Profile==Το Προσωπικό σας Προφίλ
You can create a personal profile here. Other YaCy users can view these information using a link on the network page.==Εδώ μπορείτε να δημιουργήσετε το προσωπικό σας προφίλ. Οι άλλοι χρήστες του YaCy θα μπορούν να δουν αυτές τις πληροφορίες, χρησιμοποιώντας το link στη σελίδα The search can also be applied globally, by searching other peers. You can use the following options to enhance your search results=='Δίκτυο'.
You do not need to provide any personal data here, but if you want to distribute your contact information, you can do that here.==Δε χρειάζεται να δώσετε κανένα προσωπικό στοιχείο, αλλά αν θέλετε να γνωστοποιήσετε τις πληροφορίες για το πως να έρθουν σε επαφή μαζί σας, μπορείτε να το κάνετε εδώ.
#Name==Όνομα
#Nick Name==Ψευδώνυμο
#Homepage==Αρχική σελίδα
#eMail==eMail
#ICQ==ICQ
#Jabber==Jabber
#Yahoo!==Yahoo!
#MSN=MSN
Comment==Σχόλιο
"Save"==Αποθήκευση
#-----------------------------
#File: Connections_p.html
#---------------------------
YaCy \'\#\[clientname\]\#\': Connection Tracking==YaCy '#[clientname]#': Ανίχνευση συνδέσεως
Connection Tracking==Ανίχνευση συνδέσεως
Incoming Connections==Εισερχόμενες συνδέσεις
Showing \#\[numActiveRunning\]\# active, \#\[numActivePending\]\# pending connections from a max. of \#\[numMax\]\# allowed incoming connections.==Προβολή ενεργών συνδέσεων #[numActiveRunning]# και των εκκρεμών συνδέσεων #[numActivePending]# από ένα μέγιστο #[numMax]# επιτρεπόμενων εισερχόμενων συνδέσεων.
Protocol==Πρωτόκολλο
Duration==Διάρκεια
Source IP\[:Port\]==IP Πηγής[:Port]
Dest. IP\[:Port\]==IP Προορισμού.[:Port]
Command==Εντολή
Used==Σε χρήση
Close==Κλειστή
Waiting for new request nr.==Αναμένοντας νέο αριθμό αιτήματος
#-----------------------------
#File: CookieMonitorIncoming_p.html
#---------------------------
Incoming Cookies Monitor==Παρακολούθηση Εισερχόμενων Cookies
Cookie Monitor: Incoming Cookies==Παρακολούθηση Cookies: Εισερχόμενα Cookies
This is a list of Cookies that a web server has sent to clients of the YaCy Proxy:==Αυτός είναι ένας κατάλογος με τα Cookies που έστειλε ο διακομιστής προς τους πελάτες του YaCy Proxy :
Showing==Επίδειξη
entries from a total of==καταχωρήσεις από ένα σύνολο
Cookies==Cookies
#-----------------------------
#File: CookieMonitorOutgoing_p.html
#---------------------------
Outgoing Cookies Monitor==Παρακολούθηση Εξερχόμενων Cookies
Cookie Monitor: Outgoing Cookies==Παρακολούθηση Cookies: Εξερχόμενα Cookies
This is a list of Cookies that a browser using the YaCy Proxy has sent to a web server:==:Αυτός είναι ένας κατάλογος με Cookies που έστειλε ένας browser ο οποίος χρησιμοποιούσε τον YaCy Proxy προς τον διακομιστή διαδικτύου
Showing==Επίδειξη
entries from a total of==καταχωρήσεις από ένα σύνολο
Cookies==Cookies
#-----------------------------
#File: Help.html
#---------------------------
YaCy: Help==YaCy: Βοήθεια
Help==Βοήθεια
This is a distributed web crawler and also a caching HTTP proxy. You are using the <i>online-interface</i> of the application. You can use this interface to configure your personal settings, proxy settings, access control and crawling properties. You can also use this interface to start crawls, send messages to other peers and monitor your index, cache status and crawling processes. Most important, you can use the search page to search either your own or the <i>global</i> index.==Αυτός είναι ένας κατανεμημένος web crawler, αλλά και ένας caching proxy HTTP. Εσείς χρησιμοποιείτε <i>την on-line διεπαφή<i> της εφαρμογής. Μπορείτε να χρησιμοποιείτε αυτή τη διεπαφή για να ορίσετε τις προσωπικές σας προτιμήσεις και τις ρυθμίσεις του proxy, για να ελέγχετε την πρόσβαση και τις ιδιότητες του crawler. Μπορείτε, επίσης, να χρησιμοποιείτε αυτή τη διεπαφή για να ξεκινάτε κάποια crawls, να στέλνετε μηνύματα σε άλλους peers και να ελέγχετε τον δικό σας κατάλογο περιεχομένων (index), την κατάσταση της cache και τις διαδικασίες του crawling. Το πιο σημαντικό είναι ότι μπορείτε να χρησιμοποιείτε τη σελίδα αναζήτησης για να εξερευνήσετε είτε το δικό σας κατάλογο, είτε τον <i>συνολικό</i> κατάλογο.
For more detailed information, visit the <a href="http://www.yacy.net/">YaCy homepage</a>==Για λεπτομερέστερες πληροφορίες, επισκεφθείτε το <a href="http://www.yacy.net/">Αρχική σελίδα του YaCy</a>
Local and Global Search: Options and Functions==Τοπική και Συνολική Αναζήτηση: Επιλογές και Λειτουργίες
The proxy provides a search interface that accesses your local index, created from web pages that passed the proxy.==Ο proxy προσφέρει μία διεπαφή αναζήτησης που έχει πρόσβαση στον τοπικό σας κατάλογο και που δημιουργήθηκε από τις σελίδες που περνούν μέσω του proxy.
The search can also be applied globally, by searching other peers. You can use the following options to enhance your search results==Η αναζήτηση μπορεί επίσης να εφαρμοσθεί και συνολικά, με αναζήτηση σε άλλους ισότιμους χρήστες. Μπορείτε να χρησιμοποιήσετε τις παρακάτω επιλογές για να βελτιώσετε τα αποτελέσματα της έρευνάς σας.
Search Word List==Αναζήτηση Καταλόγου Λέξεων
You can search for several words simultanous. Words must be separated by a single space.==Μπορείτε να κάνετε αναζήτηση για πολλές λέξεις ταυτόχρονα. Οι λέξεις πρέπει να ξεχωρίζουν μεταξύ τους με ένα απλό διάστημα.
The words are treated conjunctive, that means every must occur in the result, not any.== Οι λέξεις παρουσιάζονται συνδεδεμένες, αυτό σημαίνει ότι η κάθε μία πρέπει να εμφανίζεται στο αποτέλεσμα και όχι μόνο μία οποιαδήποτε από αυτές.
If you do a global search \(see below\) you may get different results each time you do a search.==Αν επιλέξετε μία συνολική αναζήτηση \(βλέπε πιο κάτω\) μπορείτε να έχετε διαφορετικά αποτελέσματα κάθε φορά που κάνετε μία αναζήτηση.
Maximum Number of Results==Μέγιστος Αριθμός Αποτελεσμάτων
You can select the number of wanted maximum links. We do not yet support multiple result pages for virtually any possible link.==Μπορείτε να επιλέξετε τον μέγιστο αριθμό των επιθυμητών links. Δεν υποστηρίζουμε ακόμη σελίδες πολλαπλών αποτελεσμάτων για κάθε πιθανό link.
Instead we encourage you to enhance the search result by submitting more search words.==Αντιθέτως, σας ενθαρρύνουμε να βελτιώσετε τα αποτελέσματα της αναζήτησης, υποβάλοντας περισσότερους όρους αναζήτησης.
Result Order Options==Επιλογές για τη Σειρά Εμφάνισης Αποτελεσμάτων
The search engine provides an experimental 'Quality' ranking. In contrast to other known search engines we provide also==Η μηχανή αναζήτησης προσφέρει ένα πειραματικό σύστημα ταξινόμησης 'Ποιότητας'. Σε αντίθεση με άλλες γνωστές μηχανές αναζήτησης, εμείς προσφέρουμε, επίσης, και
a result order by date. If you change the order to 'Date-Quality' the most recently updated page from the search results is listed first.==μία κατάταξη των αποτελεσμάτων με βάση την ημερομηνία. Αν αλλάξετε τη σειρά εμφάνισης σε 'Ημερομηνία-Ποιότητα' τότε θα εμφανιστούν στην αρχή οι πλέον πρόσφατα ενημερωμένες σελίδες.
For pages that have the same date the second order, 'Quality' is applied.==Οι σελίδες που φέρουν την ίδια ημερομηνία κατατάσσονται σύμφωνα με το δεύτερο κριτήριο της 'Ποιότητας'.
This search engine is constructed to search the web pages that pass the proxy. But the search index is distributed to other peers as well,==Αυτή η μηχανή αναζήτησης φτιάχθηκε για να αναζητά τις ιστοσελίδες που περνούν τον proxy. Αλλά ο πίνακας περιεχομένων αναζήτησης (search index) διανέμεται και σε άλλους ισότιμους χρήστες,
so you can search also globally: this function is currently only rudimentary, but can be choosen for test cases. Future releases will==έτσι ώστε να μπορείτε να κάνετε και μία συνολική αναζήτηση: αυτή η λειτουργία είναι, προς το παρόν, κάπως στοιχειώδης, αλλά μπορεί να επιλεχθεί για δοκιμαστικές περιπτώσεις. Στις μελλοντικές εκδόσεις οι πληροφορίες του πίνακας περιεχομένων
automatically distribute index information <i>before</i> a search happens to form a performant distributed hash table -- a very fast global search.==θα διανέμονται αυτόματα. <i>πριν</i> Η αναζήτηση μπορεί να φτιάχνει έναν πίνακα hash κατανεμημένο και performant -- μία συνολική έρευνα πραγματικά γρήγορη.
Maximum Search Time==Μέγιστος Χρόνος Αναζήτησης
Searching the local index is extremely fast, it happens within milliseconds, even for a large number \(millions\) of pages. But searching the==Οι αναζητήσεις στον τοπικό πίνακα περιεχομένων είναι εξαιρετικά γρήγορες, της τάξης των χιλιοστών του δευτερολέπτου, ακόμη και αν πρόκειται για έναν τεράστιο αριθμό /(εκατομμύρια/) σελίδων. Η αναζήτηση, όμως,
global index needs more time to find the correct remote peer that contains best search results. This is especially the case while the==στον συνολικό πίνακα περιεχομένων απαιτεί παραπάνω χρόνο για να εντοπίσει τον σωστό απομεμακρυσμένο ισότιμο χρήστη, που να μπορεί να προσφέρει τα καλύτερα αποτελέσαματα για την αναζήτηση. Αυτό ισχύει ιδιαίτερα όταν ο
distributed index is in test mode. Search results get more stable \(repeated global search produce more similar results\) the longer==κατανεμημένος πίνακας περιεχομένων βρίκεται σε test mode. Τα αποτελέσματα των αναζητήσεων θα είναι πιο σταθερά /(οι επανειλημμένες συνολικές αναζητήσεις θα αποδίδουν πιο όμοια αποτελέσματα/) όσο πιο μεγάλος
the search time is.==είναι ο χρόνος αναζήτησης.
You may want to use accesskeys to navigate through the YaCy webinterface:==Μπορεί να θελήσετε να χρησιμοποιήσετε τα accesskeys για να πλοηγηθείτε στη διαδικτυακή διεπαφή του YaCy:
Windows and Internet Explorer: Alt \+ Accesskey \+ Enter==Για τα Windows και τον Internet Explorer: Alt + Accesskey + Enter
Windows and Mozilla/Firefox/Netscape: Alt \+ Accesskey==Για τα Windows και τον Mozilla/Firefox/Netscape: Alt + Accesskey
Windows and Opera: Shift \+ Esc \+ Accesskey==Για τα Windows και το Opera: Shift + Esc + Accesskey
Macintosh and Internet Explorer: Strg \+ Accesskey \+ Enter=Για το Macintosh και τον Internet Explorer: Str + Accesskey + Enter
Macintosh and Safari: Strg \+ Accesskey==Για το Macintosh και το Safari: Strg + Accesskey
Macintosh and Mozilla/Firefox/Netscape: Strg \+ Accesskey==Για το Macintosh και τον Mozilla/Firefox/Netscape: Strg + Accesskey
Macintosh and Opera: Shift \+ Esc \+ Accesskey==Για το Macintosh και το Opera: Shift + Esc + Accesskey
Linux Mandrake and Galeon/Mozilla: Alt \+ Accesskey==Για το Linux Mandrake και το Galeon/Mozilla: Alt + Accesskey
All OS and Amaya: Strg \+ Accesskey==Για όλα τα Λ.Σ. και το Amaya: Strg + Accesskey
Search Page==Σελίδα Αναζήτησης
Network==Δίκτυο
Status==Κατάσταση
YaCy uses Regular Expressions for some functions, for example in the blacklist.==Το YaCy, σε κάποιες συναρτήσεις, χρησιμοποιεί Regular Expressions, για παράδειγμα στη Μαύρη Λίστα.
There are some standards for these regexps, YaCy uses the syntax used by Perl 5.==Υπάρχουν διάφορα πρότυπα για τις regexps, το YaCy χρησιμοποιεί την σύνταξη της Perl 5.
Here is a short overview about the functions, which should fir for most cases\:<==Ακολουθεί μία σύντομη επισκόπηση αυτών των συναρτήσεων, που πρέπει να επαρκούν για την πλειοψηφία των περιπτώσεων:<
arbitrary character==αυθαίρετοι χαρακτήρες
character x==χαρακτήρας x
not x==όχι x
0 or more times x==0 ή περισσότερες φορές x
0 or 1 time x==0 ή 1 φορά x
1 or more times x==1 ή περισσότερες φορές x
concatenation of x and y==Concatenation των x και y
x or y==x ή y
String "foo" or string "bar"==String "foo" ή String "bar"
a or b or c \(same as a\|b\|c\)==a ή b ή c \(ίδιο όπως και το a\|b\|c\)
a or b or c \(same as above\)==a ή b ή c \(όπως και πιο πάνω\)
exactly n appearances of x==ακριβώς n εμφανίσεις του x
at least n appearances of x==τουλάχιστον n εμφανίσεις του x
at least n, maximum m appearanches of x==τουλάχιστον n, το ανώτερο m εμφανίσεις του x
Modify priority of instructions==Αλλάξτε την προτεραιότητα των εντολών
#-----------------------------
# EOF

View File

@ -65,7 +65,7 @@ NO OTHER SOFTWARE IS REQUIRED!
== HOW DO I START THIS SOFTWARE? ==
Startup and Shutdown of YaCy:
- on Linux:
- on GNU/Linux:
to start: execute ./startYACY.sh
to stop : execute ./stopYACY.sh

View File

@ -27,6 +27,9 @@ import de.anomic.crawler.retrieval.Response;
public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandler {
private static final String EMPTY_STRING = new String();
public final static String SPACE = " ";
public final static String POISON = "";
public final static HashSet<String> stopwords = new HashSet<String>(Arrays.asList(".", "!", "?", "nbsp", "uuml", "ouml", "auml", "amp", "quot", "laquo", "raquo",
@ -83,19 +86,22 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle
final TreeSet<YMarkTag> topwords = new TreeSet<YMarkTag>();
StringBuilder token;
if(document != null) {
if(document == null) {
return EMPTY_STRING;
}
//get words from document
final Map<String, Word> words = new Condenser(document, true, true, LibraryProvider.dymLib).words();
// generate potential tags from document title, description and subject
final int bufferSize = document.dc_title().length() + document.dc_description().length() + document.dc_subject(' ').length() + 32;
final StringBuilder buffer = new StringBuilder(bufferSize);
final StringBuilder pwords = new StringBuilder(1000);
buffer.append(document.dc_title().toLowerCase());
buffer.append(document.dc_description().toLowerCase());
buffer.append(document.dc_subject(' ').toLowerCase());
final Enumeration<StringBuilder> tokens = new WordTokenizer(new ByteArrayInputStream(UTF8.getBytes(buffer.toString())), LibraryProvider.dymLib);
//get words from document
final Map<String, Word> words = new Condenser(document, true, true, LibraryProvider.dymLib).words();
// generate potential tags from document title, description and subject
final int bufferSize = document.dc_title().length() + document.dc_description().length() + document.dc_subject(' ').length() + 32;
final StringBuilder buffer = new StringBuilder(bufferSize);
final StringBuilder pwords = new StringBuilder(1000);
buffer.append(document.dc_title().toLowerCase());
buffer.append(document.dc_description().toLowerCase());
buffer.append(document.dc_subject(' ').toLowerCase());
final WordTokenizer tokens = new WordTokenizer(new ByteArrayInputStream(UTF8.getBytes(buffer.toString())), LibraryProvider.dymLib);
try {
int score = 0;
// get phrases
@ -163,44 +169,49 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle
return document.getFileExtension();
}
return clean;
} finally {
tokens.close();
}
return new String();
}
private static TreeMap<String, YMarkTag> getPhrases(final Document document, final int size) {
final TreeMap<String, YMarkTag> phrases = new TreeMap<String, YMarkTag>();
final StringBuilder phrase = new StringBuilder(128);
final Enumeration<StringBuilder> tokens = new WordTokenizer(document.getText(), LibraryProvider.dymLib);
StringBuilder token;
int count = 0;
// loop through text
while(tokens.hasMoreElements()) {
token = tokens.nextElement();
if(stopwords.contains(token.toString()) || isDigitSpace(token.toString()))
continue;
final WordTokenizer tokens = new WordTokenizer(document.getText(), LibraryProvider.dymLib);
try {
StringBuilder token;
int count = 0;
// if we have a full phrase, delete the first token
count++;
if(count > size)
phrase.delete(0, phrase.indexOf(SPACE)+1);
// loop through text
while(tokens.hasMoreElements()) {
token = tokens.nextElement();
if(stopwords.contains(token.toString()) || isDigitSpace(token.toString()))
continue;
// if we have a full phrase, delete the first token
count++;
if(count > size)
phrase.delete(0, phrase.indexOf(SPACE)+1);
// append new token
if(phrase.length() > 1)
phrase.append(SPACE);
phrase.append(token);
if(count >= size) { // make sure we really have a phrase
if(phrases.containsKey(phrase.toString())) {
phrases.get(phrase.toString()).inc();
} else {
phrases.put(phrase.toString(), new YMarkTag(phrase.toString()));
}
}
}
// append new token
if(phrase.length() > 1)
phrase.append(SPACE);
phrase.append(token);
if(count >= size) { // make sure we really have a phrase
if(phrases.containsKey(phrase.toString())) {
phrases.get(phrase.toString()).inc();
} else {
phrases.put(phrase.toString(), new YMarkTag(phrase.toString()));
}
}
return phrases;
} finally {
tokens.close();
}
return phrases;
}
public static String autoTag(final String url, final LoaderDispatcher loader, final int max, final TreeMap<String, YMarkTag> tags) {

View File

@ -61,10 +61,12 @@ import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -74,6 +76,8 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
@ -646,143 +650,227 @@ public final class HTTPDFileHandler {
}
}
}
} else if (((switchboard.getConfigBool("cgi.allow", false)) && // check if CGI execution is allowed in config
(matchesSuffix(path, switchboard.getConfig("cgi.suffixes", null))) && // "right" file extension?
(path.substring(0, path.indexOf(targetFile.getName())).contains("/CGI-BIN/") ||
path.substring(0, path.indexOf(targetFile.getName())).contains("/cgi-bin/")) && // file in right directory?
targetFile.exists())
// old-school CGI execution
} else if ((switchboard.getConfigBool("cgi.allow", false) // check if CGI execution is allowed in config
&& matchesSuffix(path, switchboard.getConfig("cgi.suffixes", null)) // "right" file extension?
&& path.substring(0, path.indexOf(targetFile.getName())).toUpperCase().contains("/CGI-BIN/") // file in right directory?
&& targetFile.exists())
) {
String mimeType = "text/html";
int statusCode = 200;
if (!targetFile.canExecute()) {
HTTPDemon.sendRespondError(
conProp,
out,
-1,
403,
null,
HeaderFramework.http1_1.get(
Integer.toString(403)),
null);
Log.logWarning(
"HTTPD",
"CGI script " + targetFile.getPath()
+ " could not be executed due to "
+ "insufficient access rights.");
} else {
String mimeType = "text/html";
int statusCode = 200;
ProcessBuilder pb;
final ProcessBuilder pb =
new ProcessBuilder(assembleCommandFromShebang(targetFile));
pb.directory(targetFile.getParentFile());
pb = new ProcessBuilder(targetFile.getAbsolutePath());
final String fileSeparator =
System.getProperty("file.separator", "/");
final String fileSeparator = System.getProperty("file.separator", "/");
// set environment variables
final Map<String, String> env = pb.environment();
env.put("SERVER_SOFTWARE", getDefaultHeaders(path).get(HeaderFramework.SERVER));
env.put("SERVER_NAME", sb.peers.mySeed().getName());
env.put("GATEWAY_INTERFACE", "CGI/1.1");
if (httpVersion != null) {
env.put("SERVER_PROTOCOL", httpVersion);
}
env.put("SERVER_PORT", switchboard.getConfig("port", "8090"));
env.put("REQUEST_METHOD", method);
// env.put("PATH_INFO", ""); // TODO: implement
// env.put("PATH_TRANSLATED", ""); // TODO: implement
env.put("SCRIPT_NAME", path);
if (argsString != null) {
env.put("QUERY_STRING", argsString);
}
env.put("REMOTE_ADDR", clientIP);
// env.put("AUTH_TYPE", ""); // TODO: implement
// env.put("REMOTE_USER", ""); // TODO: implement
// env.put("REMOTE_IDENT", ""); // I don't think we need this
env.put("DOCUMENT_ROOT", switchboard.getAppPath().getAbsolutePath() + fileSeparator + switchboard.getConfig("htDocsPath", "DATA/HTDOCS"));
if (requestHeader.getContentType() != null) {
env.put("CONTENT_TYPE", requestHeader.getContentType());
}
if (method.equalsIgnoreCase(HeaderFramework.METHOD_POST) && body != null) {
env.put("CONTENT_LENGTH", Integer.toString(requestHeader.getContentLength()));
}
// add values from request header to environment (see: http://hoohoo.ncsa.uiuc.edu/cgi/env.html#headers)
for (final Map.Entry<String, String> requestHeaderEntry : requestHeader.entrySet()) {
env.put("HTTP_" + requestHeaderEntry.getKey().toUpperCase().replace("-", "_"), requestHeaderEntry.getValue());
}
int exitValue = 0;
String cgiBody = null;
try {
// start execution of script
final Process p = pb.start();
final OutputStream os = new BufferedOutputStream(p.getOutputStream());
if (method.equalsIgnoreCase(HeaderFramework.METHOD_POST) && body != null) {
final byte[] buffer = new byte[1024];
int len = requestHeader.getContentLength();
while (len > 0) {
body.read(buffer);
len = len - buffer.length;
os.write(buffer);
}
// set environment variables
final Map<String, String> env = pb.environment();
env.put(
"SERVER_SOFTWARE",
getDefaultHeaders(path).get(HeaderFramework.SERVER));
env.put("SERVER_NAME", sb.peers.mySeed().getName());
env.put("GATEWAY_INTERFACE", "CGI/1.1");
if (httpVersion != null) {
env.put("SERVER_PROTOCOL", httpVersion);
}
env.put("SERVER_PORT", switchboard.getConfig("port", "8090"));
env.put("REQUEST_METHOD", method);
// env.put("PATH_INFO", ""); // TODO: implement
// env.put("PATH_TRANSLATED", ""); // TODO: implement
env.put("SCRIPT_NAME", path);
if (argsString != null) {
env.put("QUERY_STRING", argsString);
}
env.put("REMOTE_ADDR", clientIP);
// env.put("AUTH_TYPE", ""); // TODO: implement
// env.put("REMOTE_USER", ""); // TODO: implement
// env.put("REMOTE_IDENT", ""); // I don't think we need this
env.put(
"DOCUMENT_ROOT",
switchboard.getAppPath().getAbsolutePath()
+ fileSeparator + switchboard.getConfig("htDocsPath", "DATA/HTDOCS"));
if (requestHeader.getContentType() != null) {
env.put("CONTENT_TYPE", requestHeader.getContentType());
}
if (method.equalsIgnoreCase(HeaderFramework.METHOD_POST)
&& body != null) {
env.put(
"CONTENT_LENGTH",
Integer.toString(requestHeader.getContentLength()));
}
os.close();
/* add values from request header to environment
* (see: http://hoohoo.ncsa.uiuc.edu/cgi/env.html#headers) */
for (final Map.Entry<String, String> requestHeaderEntry
: requestHeader.entrySet()) {
env.put("HTTP_"
+ requestHeaderEntry.getKey().toUpperCase().replace("-", "_"),
requestHeaderEntry.getValue());
}
int exitValue = 0;
String cgiBody = null;
final StringBuilder error = new StringBuilder(256);
try {
p.waitFor();
} catch (final InterruptedException ex) {
// start execution of script
final Process p = pb.start();
}
final OutputStream os =
new BufferedOutputStream(p.getOutputStream());
exitValue = p.exitValue();
if (method.equalsIgnoreCase(
HeaderFramework.METHOD_POST) && body != null) {
final byte[] buffer = new byte[1024];
int len = requestHeader.getContentLength();
while (len > 0) {
body.read(buffer);
len = len - buffer.length;
os.write(buffer);
}
}
final InputStream is = new BufferedInputStream(p.getInputStream());
os.close();
final StringBuilder StringBuilder = new StringBuilder(1024);
try {
p.waitFor();
} catch (final InterruptedException ex) {
while (is.available() > 0) {
StringBuilder.append((char) is.read());
}
}
final String cgiReturn = StringBuilder.toString();
int indexOfDelimiter = cgiReturn.indexOf("\n\n",0);
String[] cgiHeader = new String[0];
if (indexOfDelimiter > -1) {
cgiHeader = cgiReturn.substring(0, indexOfDelimiter).split("\n");
}
cgiBody = cgiReturn.substring(indexOfDelimiter + 1);
exitValue = p.exitValue();
String key;
String value;
for (final String element : cgiHeader) {
indexOfDelimiter = element.indexOf(':');
key = element.substring(0, indexOfDelimiter).trim();
value = element.substring(indexOfDelimiter + 1).trim();
conProp.put(key, value);
if (key.equals("Cache-Control") && value.equals("no-cache")) {
nocache = true;
} else if (key.equals("Content-type")) {
mimeType = value;
} else if (key.equals("Status")) {
if (key.length() > 2) {
try {
statusCode = Integer.parseInt(value.substring(0, 3));
} catch (final NumberFormatException ex) {
/* tough luck, we will just have to use 200 as default value */
final InputStream is =
new BufferedInputStream(p.getInputStream());
final InputStream es =
new BufferedInputStream(p.getErrorStream());
final StringBuilder processOutput =
new StringBuilder(1024);
while (is.available() > 0) {
processOutput.append((char) is.read());
}
while (es.available() > 0) {
error.append((char) es.read());
}
int indexOfDelimiter = processOutput.indexOf("\n\n", 0);
final String[] cgiHeader;
if (indexOfDelimiter > -1) {
cgiHeader =
processOutput.substring(
0, indexOfDelimiter).split("\n");
} else {
cgiHeader = new String[0];
}
cgiBody = processOutput.substring(indexOfDelimiter + 1);
String key;
String value;
for (final String element : cgiHeader) {
indexOfDelimiter = element.indexOf(':');
key = element.substring(0, indexOfDelimiter).trim();
value = element.substring(indexOfDelimiter + 1).trim();
conProp.put(key, value);
if ("Cache-Control".equals(key)
&& "no-cache".equals(value)) {
nocache = true;
} else if ("Content-type".equals(key)) {
mimeType = value;
} else if ("Status".equals(key)) {
if (key.length() > 2) {
try {
statusCode =
Integer.parseInt(
value.substring(0, 3));
} catch (final NumberFormatException ex) {
Log.logWarning(
"HTTPD",
"CGI script " + targetFile.getPath()
+ " returned illegal status code \""
+ value + "\".");
}
}
}
}
} catch (final IOException ex) {
exitValue = -1;
}
/* did the script return an exit value != 0
* and still there is supposed to be
* everything right with the HTTP status?
* -> change status to 500 since 200 would
* be a lie
*/
if (exitValue != 0 && statusCode == 200) {
statusCode = 500;
}
targetDate = new Date(System.currentTimeMillis());
if (exitValue == 0
&& cgiBody != null
&& !cgiBody.isEmpty()) {
HTTPDemon.sendRespondHeader(
conProp,
out,
httpVersion,
statusCode,
null,
mimeType,
cgiBody.length(),
targetDate,
null,
null,
null,
null,
nocache);
out.write(UTF8.getBytes(cgiBody));
} else {
HTTPDemon.sendRespondError(
conProp,
out,
exitValue,
statusCode,
null,
HeaderFramework.http1_1.get(
Integer.toString(statusCode)),
null);
Log.logWarning(
"HTTPD",
"CGI script " + targetFile.getPath()
+ " returned exit value " + exitValue
+ ", body empty: "
+ (cgiBody == null || cgiBody.isEmpty()));
if (error.length() > 0) {
Log.logWarning("HTTPD", "Reported error: " + error);
}
}
} catch (final IOException ex) {
exitValue = -1;
}
/* did the script return an exit value != 0 and still there is supposed to be
* everything right with the HTTP status? -> change status to 500 since 200 would
* be a lie
*/
if (exitValue != 0 && statusCode == 200) {
statusCode = 500;
}
targetDate = new Date(System.currentTimeMillis());
if (exitValue == 0 || (cgiBody != null && !cgiBody.equals(""))) {
HTTPDemon.sendRespondHeader(conProp, out, httpVersion, statusCode, null, mimeType, cgiBody.length(), targetDate, null, null, null, null, nocache);
out.write(UTF8.getBytes(cgiBody));
} else {
HTTPDemon.sendRespondError(conProp, out, exitValue, statusCode, null, HeaderFramework.http1_1.get(Integer.toString(statusCode)), null);
}
} else if ((targetClass != null) && (path.endsWith(".stream"))) {
// call rewrite-class
requestHeader.put(HeaderFramework.CONNECTION_PROP_CLIENTIP, (String) conProp.get(HeaderFramework.CONNECTION_PROP_CLIENTIP));
@ -1177,6 +1265,29 @@ public final class HTTPDFileHandler {
}
}
/**
* Returns a list which contains parts of command
* which is used to start external process for
* CGI scripts.
* @param targetFile file to run
* @return list of parts of command
* @throws IOException if file can not be accessed
*/
private static List<String> assembleCommandFromShebang(
final File targetFile)
throws IOException {
final List<String > ret = new ArrayList<String>();
final BufferedReader br =
new BufferedReader(new FileReader(targetFile), 512);
final String line = br.readLine();
if (line.startsWith("#!")) {
ret.addAll(Arrays.asList(line.substring(2).split(" ")));
}
ret.add(targetFile.getAbsolutePath());
return ret;
}
private static final String appendPath(final String proplist, final String path) {
if (proplist.length() == 0) return path;
if (proplist.indexOf(path) >= 0) return proplist;

View File

@ -235,21 +235,24 @@ public final class Condenser {
if (text == null) return;
String word;
Word wprop;
WordTokenizer wordenum;
wordenum = new WordTokenizer(new ByteArrayInputStream(UTF8.getBytes(text)), meaningLib);
int pip = 0;
while (wordenum.hasMoreElements()) {
word = (wordenum.nextElement().toString()).toLowerCase(Locale.ENGLISH);
if (useForLanguageIdentification) this.languageIdentificator.add(word);
if (word.length() < 2) continue;
wprop = this.words.get(word);
if (wprop == null) wprop = new Word(0, pip, phrase);
if (wprop.flags == null) wprop.flags = flagstemplate.clone();
wprop.flags.set(flagpos, true);
this.words.put(word, wprop);
pip++;
this.RESULT_NUMB_WORDS++;
this.RESULT_DIFF_WORDS++;
WordTokenizer wordenum = new WordTokenizer(new ByteArrayInputStream(UTF8.getBytes(text)), meaningLib);
try {
int pip = 0;
while (wordenum.hasMoreElements()) {
word = (wordenum.nextElement().toString()).toLowerCase(Locale.ENGLISH);
if (useForLanguageIdentification) this.languageIdentificator.add(word);
if (word.length() < 2) continue;
wprop = this.words.get(word);
if (wprop == null) wprop = new Word(0, pip, phrase);
if (wprop.flags == null) wprop.flags = flagstemplate.clone();
wprop.flags.set(flagpos, true);
this.words.put(word, wprop);
pip++;
this.RESULT_NUMB_WORDS++;
this.RESULT_DIFF_WORDS++;
}
} finally {
wordenum.close();
}
}
@ -296,45 +299,49 @@ public final class Condenser {
// read source
final WordTokenizer wordenum = new WordTokenizer(is, meaningLib);
while (wordenum.hasMoreElements()) {
word = wordenum.nextElement().toString().toLowerCase(Locale.ENGLISH);
if (this.languageIdentificator != null) this.languageIdentificator.add(word);
if (word.length() < wordminsize) continue;
// distinguish punctuation and words
wordlen = word.length();
if (wordlen == 1 && SentenceReader.punctuation(word.charAt(0))) {
// store sentence
currsentwords.clear();
wordInSentenceCounter = 1;
} else {
// check index.of detection
if (last_last && comb_indexof && word.equals("modified")) {
this.RESULT_FLAGS.set(flag_cat_indexof, true);
wordenum.pre(true); // parse lines as they come with CRLF
}
if (last_index && (wordminsize > 2 || word.equals("of"))) comb_indexof = true;
last_last = word.equals("last");
last_index = word.equals("index");
// store word
allwordcounter++;
currsentwords.add(word);
wsp = this.words.get(word);
if (wsp != null) {
// word already exists
wordHandle = wsp.posInText;
wsp.inc();
} else {
// word does not yet exist, create new word entry
wordHandle = wordHandleCount++;
wsp = new Word(wordHandle, wordInSentenceCounter, sentences.size() + 100);
wsp.flags = this.RESULT_FLAGS.clone();
this.words.put(word, wsp);
}
// we now have the unique handle of the word, put it into the sentence:
wordInSentenceCounter++;
}
try {
while (wordenum.hasMoreElements()) {
word = wordenum.nextElement().toString().toLowerCase(Locale.ENGLISH);
if (this.languageIdentificator != null) this.languageIdentificator.add(word);
if (word.length() < wordminsize) continue;
// distinguish punctuation and words
wordlen = word.length();
if (wordlen == 1 && SentenceReader.punctuation(word.charAt(0))) {
// store sentence
currsentwords.clear();
wordInSentenceCounter = 1;
} else {
// check index.of detection
if (last_last && comb_indexof && word.equals("modified")) {
this.RESULT_FLAGS.set(flag_cat_indexof, true);
wordenum.pre(true); // parse lines as they come with CRLF
}
if (last_index && (wordminsize > 2 || word.equals("of"))) comb_indexof = true;
last_last = word.equals("last");
last_index = word.equals("index");
// store word
allwordcounter++;
currsentwords.add(word);
wsp = this.words.get(word);
if (wsp != null) {
// word already exists
wordHandle = wsp.posInText;
wsp.inc();
} else {
// word does not yet exist, create new word entry
wordHandle = wordHandleCount++;
wsp = new Word(wordHandle, wordInSentenceCounter, sentences.size() + 100);
wsp.flags = this.RESULT_FLAGS.clone();
this.words.put(word, wsp);
}
// we now have the unique handle of the word, put it into the sentence:
wordInSentenceCounter++;
}
}
} finally {
wordenum.close();
}
if (pseudostemming) {

View File

@ -141,4 +141,12 @@ public class SentenceReader implements Iterator<StringBuilder> {
public void remove() {
throw new UnsupportedOperationException();
}
public void close() {
try {
raf.close();
} catch(IOException ioe) {
// Ignore IO Exceptions
}
}
}

View File

@ -280,14 +280,21 @@ public final class TextParser {
final HashMap<Parser, Parser.Failure> failedParser = new HashMap<Parser, Parser.Failure>();
if (MemoryControl.request(sourceArray.length * 6, false)) {
for (final Parser parser: parsers) {
ByteArrayInputStream bis = new ByteArrayInputStream(sourceArray);
try {
docs = parser.parse(location, mimeType, documentCharset, new ByteArrayInputStream(sourceArray));
docs = parser.parse(location, mimeType, documentCharset, bis);
} catch (final Parser.Failure e) {
failedParser.put(parser, e);
//log.logWarning("tried parser '" + parser.getName() + "' to parse " + location.toNormalform(true, false) + " but failed: " + e.getMessage(), e);
} catch (final Exception e) {
failedParser.put(parser, new Parser.Failure(e.getMessage(), location));
//log.logWarning("tried parser '" + parser.getName() + "' to parse " + location.toNormalform(true, false) + " but failed: " + e.getMessage(), e);
} finally {
try {
bis.close();
} catch(IOException ioe) {
// Ignore.
}
}
if (docs != null) break;
}

View File

@ -79,6 +79,10 @@ public class WordTokenizer implements Enumeration<StringBuilder> {
if (this.meaningLib != null) WordCache.learn(r);
return r;
}
public void close() {
e.close();
}
private static class unsievedWordsEnum implements Enumeration<StringBuilder> {
// returns an enumeration of StringBuilder Objects
@ -145,6 +149,9 @@ public class WordTokenizer implements Enumeration<StringBuilder> {
return r;
}
public void close() {
e.close();
}
}
public static StringBuilder trim(final StringBuilder sb) {
@ -172,23 +179,27 @@ public class WordTokenizer implements Enumeration<StringBuilder> {
*/
public static SortedMap<byte[], Integer> hashSentence(final String sentence, final WordCache meaningLib) {
final SortedMap<byte[], Integer> map = new TreeMap<byte[], Integer>(Base64Order.enhancedCoder);
final Enumeration<StringBuilder> words = new WordTokenizer(new ByteArrayInputStream(UTF8.getBytes(sentence)), meaningLib);
int pos = 0;
StringBuilder word;
byte[] hash;
Integer oldpos;
while (words.hasMoreElements()) {
word = words.nextElement();
hash = Word.word2hash(word);
// don't overwrite old values, that leads to too far word distances
oldpos = map.put(hash, LargeNumberCache.valueOf(pos));
if (oldpos != null) {
map.put(hash, oldpos);
}
pos += word.length() + 1;
final WordTokenizer words = new WordTokenizer(new ByteArrayInputStream(UTF8.getBytes(sentence)), meaningLib);
try {
int pos = 0;
StringBuilder word;
byte[] hash;
Integer oldpos;
while (words.hasMoreElements()) {
word = words.nextElement();
hash = Word.word2hash(word);
// don't overwrite old values, that leads to too far word distances
oldpos = map.put(hash, LargeNumberCache.valueOf(pos));
if (oldpos != null) {
map.put(hash, oldpos);
}
pos += word.length() + 1;
}
return map;
} finally {
words.close();
}
return map;
}
}

View File

@ -58,7 +58,8 @@ import net.yacy.kelondro.util.MemoryControl;
public class ContentScraper extends AbstractScraper implements Scraper {
private static final String EMPTY_STRING = new String();
private final char degree = '\u00B0';
private final char[] minuteCharsHTML = "&#039;".toCharArray();
@ -159,7 +160,7 @@ public class ContentScraper extends AbstractScraper implements Scraper {
this.iframes = new HashSet<MultiProtocolURI>();
this.metas = new HashMap<String, String>();
this.script = new HashSet<MultiProtocolURI>();
this.title = "";
this.title = EMPTY_STRING;
this.headlines = new ArrayList[6];
for (int i = 0; i < this.headlines.length; i++) this.headlines[i] = new ArrayList<String>();
this.bold = new ClusteredScoreMap<String>();
@ -318,14 +319,14 @@ public class ContentScraper extends AbstractScraper implements Scraper {
public void scrapeTag0(final String tagname, final Properties tagopts) {
if (tagname.equalsIgnoreCase("img")) {
final String src = tagopts.getProperty("src", "");
final String src = tagopts.getProperty("src", EMPTY_STRING);
try {
final int width = Integer.parseInt(tagopts.getProperty("width", "-1"));
final int height = Integer.parseInt(tagopts.getProperty("height", "-1"));
if (src.length() > 0) {
final MultiProtocolURI url = absolutePath(src);
if (url != null) {
final ImageEntry ie = new ImageEntry(url, tagopts.getProperty("alt", ""), width, height, -1);
final ImageEntry ie = new ImageEntry(url, tagopts.getProperty("alt", EMPTY_STRING), width, height, -1);
addImage(this.images, ie);
}
}
@ -333,47 +334,47 @@ public class ContentScraper extends AbstractScraper implements Scraper {
this.evaluationScores.match(Element.imgpath, src);
} else if(tagname.equalsIgnoreCase("base")) {
try {
this.root = new MultiProtocolURI(tagopts.getProperty("href", ""));
this.root = new MultiProtocolURI(tagopts.getProperty("href", EMPTY_STRING));
} catch (final MalformedURLException e) {}
} else if (tagname.equalsIgnoreCase("frame")) {
final MultiProtocolURI src = absolutePath(tagopts.getProperty("src", ""));
final MultiProtocolURI src = absolutePath(tagopts.getProperty("src", EMPTY_STRING));
mergeAnchors(src, tagopts /* with property "name" */);
this.frames.add(src);
this.evaluationScores.match(Element.framepath, src.toNormalform(true, false));
} else if (tagname.equalsIgnoreCase("body")) {
final String c = tagopts.getProperty("class", "");
final String c = tagopts.getProperty("class", EMPTY_STRING);
this.evaluationScores.match(Element.bodyclass, c);
} else if (tagname.equalsIgnoreCase("div")) {
final String id = tagopts.getProperty("id", "");
final String id = tagopts.getProperty("id", EMPTY_STRING);
this.evaluationScores.match(Element.divid, id);
} else if (tagname.equalsIgnoreCase("meta")) {
String name = tagopts.getProperty("name", "");
final String content = tagopts.getProperty("content","");
String name = tagopts.getProperty("name", EMPTY_STRING);
final String content = tagopts.getProperty("content", EMPTY_STRING);
if (name.length() > 0) {
this.metas.put(name.toLowerCase(), CharacterCoding.html2unicode(content));
if (name.equals("generator")) {
this.evaluationScores.match(Element.metagenerator, content);
}
} else {
name = tagopts.getProperty("http-equiv", "");
name = tagopts.getProperty("http-equiv", EMPTY_STRING);
if (name.length() > 0) {
this.metas.put(name.toLowerCase(), CharacterCoding.html2unicode(content));
}
}
} else if (tagname.equalsIgnoreCase("area")) {
final String areatitle = cleanLine(tagopts.getProperty("title",""));
//String alt = tagopts.getProperty("alt","");
final String href = tagopts.getProperty("href", "");
final String areatitle = cleanLine(tagopts.getProperty("title",EMPTY_STRING));
//String alt = tagopts.getProperty("alt",EMPTY_STRING);
final String href = tagopts.getProperty("href", EMPTY_STRING);
tagopts.put("nme", areatitle);
if (href.length() > 0) mergeAnchors(absolutePath(href), tagopts);
} else if (tagname.equalsIgnoreCase("link")) {
final String href = tagopts.getProperty("href", "");
final String href = tagopts.getProperty("href", EMPTY_STRING);
final MultiProtocolURI newLink = absolutePath(href);
if (newLink != null) {
final String rel = tagopts.getProperty("rel", "");
final String linktitle = tagopts.getProperty("title", "");
final String type = tagopts.getProperty("type", "");
final String rel = tagopts.getProperty("rel", EMPTY_STRING);
final String linktitle = tagopts.getProperty("title", EMPTY_STRING);
final String type = tagopts.getProperty("type", EMPTY_STRING);
if (rel.equalsIgnoreCase("shortcut icon")) {
final ImageEntry ie = new ImageEntry(newLink, linktitle, -1, -1, -1);
@ -394,11 +395,11 @@ public class ContentScraper extends AbstractScraper implements Scraper {
}
}
} else if(tagname.equalsIgnoreCase("embed")) {
mergeAnchors(absolutePath(tagopts.getProperty("src", "")), tagopts /* with property "name" */);
mergeAnchors(absolutePath(tagopts.getProperty("src", EMPTY_STRING)), tagopts /* with property "name" */);
} else if(tagname.equalsIgnoreCase("param")) {
final String name = tagopts.getProperty("name", "");
final String name = tagopts.getProperty("name", EMPTY_STRING);
if (name.equalsIgnoreCase("movie")) {
mergeAnchors(absolutePath(tagopts.getProperty("value", "")), tagopts /* with property "name" */);
mergeAnchors(absolutePath(tagopts.getProperty("value", EMPTY_STRING)), tagopts /* with property "name" */);
}
}
@ -409,12 +410,12 @@ public class ContentScraper extends AbstractScraper implements Scraper {
public void scrapeTag1(final String tagname, final Properties tagopts, final char[] text) {
// System.out.println("ScrapeTag1: tagname=" + tagname + ", opts=" + tagopts.toString() + ", text=" + UTF8.String(text));
if (tagname.equalsIgnoreCase("a") && text.length < 2048) {
final String href = tagopts.getProperty("href", "");
final String href = tagopts.getProperty("href", EMPTY_STRING);
MultiProtocolURI url;
if ((href.length() > 0) && ((url = absolutePath(href)) != null)) {
final String f = url.getFile();
final int p = f.lastIndexOf('.');
final String type = (p < 0) ? "" : f.substring(p + 1);
final String type = (p < 0) ? EMPTY_STRING : f.substring(p + 1);
if (type.equals("png") || type.equals("gif") || type.equals("jpg") || type.equals("jpeg") || type.equals("tiff") || type.equals("tif")) {
// special handling of such urls: put them to the image urls
final ImageEntry ie = new ImageEntry(url, recursiveParse(text), -1, -1, -1);
@ -461,12 +462,12 @@ public class ContentScraper extends AbstractScraper implements Scraper {
h = recursiveParse(text);
if (h.length() > 0) this.li.add(h);
} else if (tagname.equalsIgnoreCase("iframe")) {
final MultiProtocolURI src = absolutePath(tagopts.getProperty("src", ""));
final MultiProtocolURI src = absolutePath(tagopts.getProperty("src", EMPTY_STRING));
mergeAnchors(src, tagopts /* with property "name" */);
this.iframes.add(src);
this.evaluationScores.match(Element.iframepath, src.toNormalform(true, false));
} else if (tagname.equalsIgnoreCase("script")) {
final String src = tagopts.getProperty("src", "");
final String src = tagopts.getProperty("src", EMPTY_STRING);
if (src.length() > 0) {
this.script.add(absolutePath(src));
this.evaluationScores.match(Element.scriptpath, src);
@ -507,7 +508,7 @@ public class ContentScraper extends AbstractScraper implements Scraper {
}
private final static String cleanLine(final String s) {
if (!MemoryControl.request(s.length() * 2, false)) return "";
if (!MemoryControl.request(s.length() * 2, false)) return EMPTY_STRING;
final StringBuilder sb = new StringBuilder(s.length());
char l = ' ';
char c;
@ -683,27 +684,27 @@ public class ContentScraper extends AbstractScraper implements Scraper {
public String getDescription() {
String s = this.metas.get("description");
if (s == null) s = this.metas.get("dc.description");
if (s == null) return "";
if (s == null) return EMPTY_STRING;
return s;
}
public String getContentType() {
final String s = this.metas.get("content-type");
if (s == null) return "";
if (s == null) return EMPTY_STRING;
return s;
}
public String getAuthor() {
String s = this.metas.get("author");
if (s == null) s = this.metas.get("dc.creator");
if (s == null) return "";
if (s == null) return EMPTY_STRING;
return s;
}
public String getPublisher() {
String s = this.metas.get("copyright");
if (s == null) s = this.metas.get("dc.publisher");
if (s == null) return "";
if (s == null) return EMPTY_STRING;
return s;
}
@ -732,7 +733,7 @@ public class ContentScraper extends AbstractScraper implements Scraper {
public String[] getKeywords() {
String s = this.metas.get("keywords");
if (s == null) s = this.metas.get("dc.description");
if (s == null) s = "";
if (s == null) s = EMPTY_STRING;
if (s.length() == 0) {
return MultiProtocolURI.splitpattern.split(getTitle().toLowerCase());
}
@ -756,13 +757,13 @@ public class ContentScraper extends AbstractScraper implements Scraper {
public String getRefreshPath() {
String s = this.metas.get("refresh");
if (s == null) return "";
if (s == null) return EMPTY_STRING;
final int pos = s.indexOf(';');
if (pos < 0) return "";
if (pos < 0) return EMPTY_STRING;
s = s.substring(pos + 1);
if (s.toLowerCase().startsWith("url=")) return s.substring(4).trim();
return "";
return EMPTY_STRING;
}
// parse location

View File

@ -81,11 +81,22 @@ public final class TransformerWriter extends Writer {
final Scraper scraper,
final Transformer transformer,
final boolean passbyIfBinarySuspect
) {
this(outStream, charSet, scraper, transformer, passbyIfBinarySuspect, 1024);
}
public TransformerWriter(
final OutputStream outStream,
final Charset charSet,
final Scraper scraper,
final Transformer transformer,
final boolean passbyIfBinarySuspect,
final int initialBufferSize
) {
this.outStream = outStream;
this.scraper = scraper;
this.transformer = transformer;
this.buffer = new CharBuffer(1024);
this.buffer = new CharBuffer(initialBufferSize);
this.filterTag = null;
this.filterOpts = null;
this.filterCont = null;
@ -540,6 +551,7 @@ public final class TransformerWriter extends Writer {
final char[] filtered = filterSentence(this.buffer.getChars(), quotechar);
if (this.out != null) this.out.write(filtered);
}
this.buffer.close();
this.buffer = null;
}
final char[] finalized = filterFinalize(quotechar);
@ -550,6 +562,7 @@ public final class TransformerWriter extends Writer {
}
this.filterTag = null;
this.filterOpts = null;
if (this.filterCont != null) this.filterCont.close();
this.filterCont = null;
// if (scraper != null) {scraper.close(); scraper = null;}
// if (transformer != null) {transformer.close(); transformer = null;}

View File

@ -196,7 +196,7 @@ public class htmlParser extends AbstractParser implements Parser {
// parsing the content
final ContentScraper scraper = new ContentScraper(location);
final TransformerWriter writer = new TransformerWriter(null,null,scraper,null,false);
final TransformerWriter writer = new TransformerWriter(null,null,scraper,null,false, sourceStream.available());
try {
FileUtils.copy(sourceStream, writer, c);
} catch (final IOException e) {

View File

@ -114,17 +114,20 @@ public class odtParser extends AbstractParser implements Parser {
if (entryName.equals("content.xml")) {
// create a writer for output
writer = new CharBuffer();
// extract data
final InputStream zipFileEntryStream = zipFile.getInputStream(zipEntry);
final SAXParser saxParser = saxParserFactory.newSAXParser();
saxParser.parse(zipFileEntryStream, new ODContentHandler(writer));
// close readers and writers
zipFileEntryStream.close();
writer.close();
writer = new CharBuffer((int)zipEntry.getSize());
try {
// extract data
final InputStream zipFileEntryStream = zipFile.getInputStream(zipEntry);
try {
final SAXParser saxParser = saxParserFactory.newSAXParser();
saxParser.parse(zipFileEntryStream, new ODContentHandler(writer));
} finally {
// close readers and writers
zipFileEntryStream.close();
}
} finally {
writer.close();
}
} else if (entryName.equals("meta.xml")) {
// meta.xml contains metadata about the document
final InputStream zipFileEntryStream = zipFile.getInputStream(zipEntry);

View File

@ -100,17 +100,21 @@ public class ooxmlParser extends AbstractParser implements Parser {
|| entryName.startsWith("xl/worksheets/sheet")) {
// create a writer for output
writer = new CharBuffer();
// extract data
final InputStream zipFileEntryStream = zipFile.getInputStream(zipEntry);
final SAXParser saxParser = saxParserFactory.newSAXParser();
saxParser.parse(zipFileEntryStream, new ODContentHandler(writer));
// close readers and writers
zipFileEntryStream.close();
writer.close();
writer = new CharBuffer((int)zipEntry.getSize());
try {
// extract data
final InputStream zipFileEntryStream = zipFile.getInputStream(zipEntry);
try {
final SAXParser saxParser = saxParserFactory.newSAXParser();
saxParser.parse(zipFileEntryStream, new ODContentHandler(writer));
// close readers and writers
} finally {
zipFileEntryStream.close();
}
} finally {
writer.close();
}
} else if (entryName.equals("docProps/core.xml")) {
// meta.xml contains metadata about the document
final InputStream zipFileEntryStream = zipFile.getInputStream(zipEntry);

View File

@ -898,8 +898,7 @@ public class ArrayStack implements BLOB {
if (!i1.hasNext()) {
if (i2.hasNext()) {
HeapWriter.delete(f1);
if (f2.renameTo(newFile))
return newFile;
if (f2.renameTo(newFile)) return newFile;
return f2;
}
HeapWriter.delete(f1);
@ -907,8 +906,7 @@ public class ArrayStack implements BLOB {
return null;
} else if (!i2.hasNext()) {
HeapWriter.delete(f2);
if (f1.renameTo(newFile))
return newFile;
if (f1.renameTo(newFile)) return newFile;
return f1;
}
assert i1.hasNext();

View File

@ -48,6 +48,8 @@ import net.yacy.kelondro.util.kelondroException;
public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>, Cloneable {
private static final byte[] EMPTY_CACHE = new byte[0];
public static final long growfactorLarge100 = 140L;
public static final long growfactorSmall100 = 120L;
private static final int isortlimit = 20;
@ -77,7 +79,7 @@ public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>,
this.rowdef = rowdef;
this.sortBound = 0;
this.lastTimeWrote = System.currentTimeMillis();
this.chunkcache = new byte[0];
this.chunkcache = EMPTY_CACHE;
this.chunkcount = 0;
}

View File

@ -122,9 +122,9 @@ public final class CharBuffer extends Writer {
return length;
}
private void grow() {
int newsize = buffer.length * 2 + 1;
if (newsize < 32) newsize = 32;
private void grow(int minSize) {
int newsize = buffer.length + 1024;
if (newsize < minSize) newsize = minSize+1;
char[] tmp = new char[newsize];
System.arraycopy(buffer, offset, tmp, 0, length);
buffer = tmp;
@ -136,7 +136,7 @@ public final class CharBuffer extends Writer {
}
public void write(final char b) {
if (offset + length + 1 > buffer.length) grow();
if (offset + length + 1 > buffer.length) grow(offset + length + 1);
buffer[offset + length++] = b;
}
@ -145,7 +145,7 @@ public final class CharBuffer extends Writer {
}
public void write(final char[] bb, final int of, final int le) {
while (offset + length + le > buffer.length) grow();
if (offset + length + le > buffer.length) grow(offset + length + le);
System.arraycopy(bb, of, buffer, offset + length, le);
length += le;
}
@ -476,7 +476,7 @@ public final class CharBuffer extends Writer {
}
public void close() throws IOException {
// TODO Auto-generated method stub
buffer = null; // assist with garbage collection
}
public void flush() throws IOException {

View File

@ -85,7 +85,7 @@ public final class yacyRelease extends yacyVersion {
this.url = url;
}
public yacyRelease(final MultiProtocolURI url, final PublicKey publicKey) {
private yacyRelease(final MultiProtocolURI url, final PublicKey publicKey) {
this(url);
this.publicKey = publicKey;
}

View File

@ -15,11 +15,11 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
public static final float YACY_POVIDES_REMOTECRAWL_LISTS = (float) 0.550;
public static final float YACY_STANDARDREL_IS_PRO = (float) 0.557;
private static yacyVersion thisVersion = null;
/**
* information about latest release, retrieved by other peers release version,
* this value is overwritten when a peer with later version appears*/
public static double latestRelease = 0.1; //
public static double latestRelease = 0.1; //
private float releaseNr;
private final String dateStamp;
@ -38,7 +38,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
* i.e. yacy_v0.51_20070321_3501.tar.gz
* @param release
*/
public yacyVersion(String release, String host) {
public yacyVersion(String release, final String host) {
this.name = release;
if (release == null || !(release.endsWith(".tar.gz") || release.endsWith(".tar"))) {
@ -54,7 +54,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
// now all release names have the form
// ${releaseVersion}_${DSTAMP}_${releaseNr}
final String[] comp = release.split("_"); // should be 3 parts
if (comp.length != 3) {
if (comp.length < 2 || comp.length > 3) {
throw new RuntimeException("release file name '" + release + "' is not valid, 3 information parts expected");
}
try {
@ -62,21 +62,25 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
} catch (final NumberFormatException e) {
throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[0] + "' should be a float number");
}
this.mainRelease = ((int) (this.getReleaseNr() * 100)) % 10 == 0 || (host != null && host.endsWith("yacy.net"));
this.mainRelease = ((int) (getReleaseNr() * 100)) % 10 == 0 || (host != null && host.endsWith("yacy.net"));
//System.out.println("Release version " + this.releaseNr + " is " + ((this.mainRelease) ? "main" : "std"));
this.dateStamp = comp[1];
if (this.getDateStamp().length() != 8) {
if (getDateStamp().length() != 8) {
throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[1] + "' should be a 8-digit date string");
}
try {
this.svn = Integer.parseInt(comp[2]);
} catch (final NumberFormatException e) {
throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[2] + "' should be a integer number");
if (comp.length > 2) {
try {
this.svn = Integer.parseInt(comp[2]);
} catch (final NumberFormatException e) {
throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[2] + "' should be a integer number");
}
} else {
this.svn = 0; // we migrate to git
}
// finished! we parsed a relase string
}
public static final yacyVersion thisVersion() {
// construct a virtual release name for this release
if (thisVersion == null) {
@ -105,41 +109,45 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
* a ordered structure, like TreeSet or TreeMap
*/
public int compare(final yacyVersion v0, final yacyVersion v1) {
int r = (Float.valueOf(v0.getReleaseNr())).compareTo(Float.valueOf(v1.getReleaseNr()));
if (r != 0) return r;
r = v0.getDateStamp().compareTo(v1.getDateStamp());
if (r != 0) return r;
return (Integer.valueOf(v0.getSvn())).compareTo(Integer.valueOf(v1.getSvn()));
}
public boolean equals(final Object obj) {
if (obj instanceof yacyVersion) {
final yacyVersion v = (yacyVersion) obj;
return (this.getSvn() == v.getSvn()) && (this.getName().equals(v.getName()));
return (getReleaseNr() == v.getReleaseNr()) && (getSvn() == v.getSvn()) && (getName().equals(v.getName()));
}
return false;
}
public int hashCode() {
return this.getName().hashCode();
return getName().hashCode();
}
/**
* Converts combined version-string to a pretty string, e.g. "0.435/01818" or "dev/01818" (development version) or "dev/00000" (in case of wrong input)
*
* @param ver Combined version string matching regular expression: "\A(\d+\.\d{3})(\d{4}|\d{5})\z" <br>
* (i.e.: start of input, 1 or more digits in front of decimal point, decimal point followed by 3 digits as major version, 4 or 5 digits for SVN-Version, end of input)
* (i.e.: start of input, 1 or more digits in front of decimal point, decimal point followed by 3 digits as major version, 4 or 5 digits for SVN-Version, end of input)
* @return If the major version is &lt; 0.11 - major version is separated from SVN-version by '/', e.g. "0.435/01818" <br>
* If the major version is &gt;= 0.11 - major version is replaced by "dev" and separated SVN-version by '/', e.g."dev/01818" <br>
* "dev/00000" - If the input does not matcht the regular expression above
* If the major version is &gt;= 0.11 - major version is replaced by "dev" and separated SVN-version by '/', e.g."dev/01818" <br>
* "dev/00000" - If the input does not matcht the regular expression above
*/
public static String combined2prettyVersion(final String ver) {
return combined2prettyVersion(ver, "");
}
public static String combined2prettyVersion(final String ver, final String computerName) {
final Matcher matcher = yacyBuildProperties.versionMatcher.matcher(ver);
if (!matcher.find()) {
Log.logWarning("STARTUP", "Peer '"+computerName+"': wrong format of version-string: '" + ver + "'. Using default string 'dev/00000' instead");
final Matcher matcher = yacyBuildProperties.versionMatcher.matcher(ver);
if (!matcher.find()) {
Log.logWarning("STARTUP", "Peer '"+computerName+"': wrong format of version-string: '" + ver + "'. Using default string 'dev/00000' instead");
return "dev/00000";
}
final String mainversion = (Float.parseFloat(matcher.group(1)) < 0.11 ? "dev" : matcher.group(1));
String revision = matcher.group(2);
for(int i=revision.length();i<5;++i) revision += "0";
@ -147,11 +155,11 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
}
public static int revision(final String ver) {
final Matcher matcher = yacyBuildProperties.versionMatcher.matcher(ver);
final Matcher matcher = yacyBuildProperties.versionMatcher.matcher(ver);
if (!matcher.find()) return 0;
return Integer.parseInt(matcher.group(2));
}
/**
* Combines the version of YaCy with the versionnumber from SVN to a
* combined version
@ -169,7 +177,7 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
* @return timestamp
*/
public String getDateStamp() {
return dateStamp;
return this.dateStamp;
}
/**
@ -177,15 +185,15 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
* @return svn revision as integer
*/
public int getSvn() {
return svn;
return this.svn;
}
/**
* Whether this is a stable main release or not
* @return
* @return
*/
public boolean isMainRelease() {
return mainRelease;
return this.mainRelease;
}
/**
@ -193,12 +201,22 @@ public class yacyVersion implements Comparator<yacyVersion>, Comparable<yacyVers
* @return
*/
public float getReleaseNr() {
return releaseNr;
return this.releaseNr;
}
public String getName() {
return name;
return this.name;
}
public static void main(final String[] args) {
final yacyVersion y1 = new yacyVersion("yacy_v0.51_20070321_3501.tar.gz", null);
final yacyVersion y2 = new yacyVersion("yacy_v1.0_20111203_8134.tar.gz", null);
final yacyVersion y3 = new yacyVersion("yacy_v1.01_20111206_8140.tar.gz", null);
final yacyVersion y4 = new yacyVersion("yacy_v1.01_20111207.tar.gz", null);
System.out.println(y1.compareTo(y2));
System.out.println(y2.compareTo(y3));
System.out.println(y3.compareTo(y4));
}
}