- removed unfinished auto-updater from roland and martin

- added new download-option for releases on the status page
still mising:
- thomas-style restart for linux/mac
- untar/gunzip on shell basis
(comes next)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3931 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 18 years ago
parent 0622dcc392
commit 9bbd39b67c

@ -68,6 +68,7 @@
</form> </form>
</dd> </dd>
#(/hintVersionAvailable)# #(/hintVersionAvailable)#
<!-- <!--
#(hintVersionDownload)#:: #(hintVersionDownload)#::
<dt class="hintIcon"><img src="env/grafics/start.gif" alt="Start"/></dt> <dt class="hintIcon"><img src="env/grafics/start.gif" alt="Start"/></dt>
@ -76,6 +77,7 @@
</dd> </dd>
#(/hintVersionDownload)# #(/hintVersionDownload)#
--> -->
#(hintStatusSenior)#:: #(hintStatusSenior)#::
<dt class="hintIcon"><img src="env/grafics/good.png" width="32" height="32" alt="good"/></dt> <dt class="hintIcon"><img src="env/grafics/good.png" width="32" height="32" alt="good"/></dt>
<dd class="hint">You are running a server in senior mode and you support the global internet index, <dd class="hint">You are running a server in senior mode and you support the global internet index,
@ -146,6 +148,36 @@
</fieldset> </fieldset>
</form> </form>
<form action="Status.html" method="get">
<fieldset>
<legend>System Update</legend>
<dl>
<dt>Available Releases</dt>
<dd>&nbsp;<select name="releasedownload">
#{availreleases}#
<option #(selected)#::selected#(/selected)# value="#[url]#">#[name]#</option>
#{/availreleases}#
</select>
&nbsp;&nbsp;<button type="submit" name="downloadRelease" value="DownloadRelease">
<img src="/env/grafics/lock.gif" alt="" />
Download Release
</button><br>
</dd>
<dt>Downloaded Releases</dt>
<dd>&nbsp;<select name="releaseinstall">
#{downloadedreleases}#
<option #(selected)#::selected#(/selected)# value="#[file]#">#[name]#</option>
#{/downloadedreleases}#
</select><!--
&nbsp;&nbsp;<button type="submit" name="installRelease" value="InstallRelease">
<img src="/env/grafics/lock.gif" alt="" />
Install Release
</button> -->
</dd>
</dl>
</fieldset>
</form>
<fieldset> <fieldset>
<legend>Public System Properties</legend> <legend>Public System Properties</legend>
<dl> <dl>

@ -46,13 +46,17 @@
// javac -classpath .:../Classes Status.java // javac -classpath .:../Classes Status.java
// if the shell's current path is HTROOT // if the shell's current path is HTROOT
import java.io.IOException;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.Date; import java.util.Date;
import java.util.Iterator;
import java.util.TreeSet;
import de.anomic.http.httpHeader; import de.anomic.http.httpHeader;
import de.anomic.http.httpd; import de.anomic.http.httpd;
import de.anomic.http.httpdByteCountInputStream; import de.anomic.http.httpdByteCountInputStream;
import de.anomic.http.httpdByteCountOutputStream; import de.anomic.http.httpdByteCountOutputStream;
import de.anomic.net.URL;
import de.anomic.plasma.plasmaSwitchboard; import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverCore; import de.anomic.server.serverCore;
import de.anomic.server.serverDate; import de.anomic.server.serverDate;
@ -61,6 +65,7 @@ import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch; import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacyCore; import de.anomic.yacy.yacyCore;
import de.anomic.yacy.yacySeed; import de.anomic.yacy.yacySeed;
import de.anomic.yacy.yacyVersion;
public class Status { public class Status {
@ -72,16 +77,16 @@ public class Status {
final serverObjects prop = new serverObjects(); final serverObjects prop = new serverObjects();
final plasmaSwitchboard sb = (plasmaSwitchboard) env; final plasmaSwitchboard sb = (plasmaSwitchboard) env;
if ((post != null) && (post.containsKey("login"))) { if (post != null) {
if (sb.adminAuthenticated(header) < 2) { if (sb.adminAuthenticated(header) < 2) {
prop.put("AUTHENTICATE","admin log-in"); prop.put("AUTHENTICATE","admin log-in");
} else { return prop;
prop.put("LOCATION","");
} }
return prop; boolean redirect = false;
} else if (post != null) { if (post.containsKey("login")) {
boolean redirect = false; prop.put("LOCATION","");
if (post.containsKey("pauseCrawlJob")) { return prop;
} else if (post.containsKey("pauseCrawlJob")) {
String jobType = (String) post.get("jobType"); String jobType = (String) post.get("jobType");
if (jobType.equals("localCrawl")) if (jobType.equals("localCrawl"))
sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL);
@ -111,7 +116,18 @@ public class Status {
sb.setConfig("browserPopUpTrigger", "true"); sb.setConfig("browserPopUpTrigger", "true");
} }
redirect = true; redirect = true;
} } else if (post.containsKey("downloadRelease")) {
// download a release
String release = post.get("releasedownload", "");
if (release.length() > 0) {
try {
yacyVersion.downloadRelease(new yacyVersion(new URL(release)));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
if (redirect) { if (redirect) {
prop.put("LOCATION",""); prop.put("LOCATION","");
@ -140,24 +156,64 @@ public class Status {
} }
// if running on Windows or with updater/wrapper enable restart button // if running on Windows or with updater/wrapper enable restart button
if ((sb.updaterCallback != null) || (System.getProperty("os.name").toLowerCase().startsWith("win"))) { if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
prop.put("restartEnabled", 1); } prop.put("restartEnabled", 1); }
// version information // version information
prop.put("versionpp", yacy.combined2prettyVersion(sb.getConfig("version","0.1"))); prop.put("versionpp", yacy.combined2prettyVersion(sb.getConfig("version","0.1")));
double thisVersion = Double.parseDouble(sb.getConfig("version","0.1")); double thisVersion = Double.parseDouble(sb.getConfig("version","0.1"));
// cut off the SVN Rev in the Version // cut off the SVN Rev in the Version
try {thisVersion = Math.round(thisVersion*1000.0)/1000.0;} catch (NumberFormatException e) {} try {thisVersion = Math.round(thisVersion*1000.0)/1000.0;} catch (NumberFormatException e) {}
if ((adminaccess) && (sb.updaterCallback != null) && (sb.updaterCallback.updateYaCyIsPossible())){ // list downloaded releases
prop.put("hintVersionAvailable", 1); yacyVersion release, dflt;
prop.put("hintVersionAvailable_latestVersion", sb.updaterCallback.getYaCyUpdateReleaseVersion()); String[] downloaded = sb.releasePath.list();
if ((post != null) && (post.containsKey("aquirerelease"))) { TreeSet downloadedreleases = new TreeSet();
sb.updaterCallback.grantYaCyUpdate(); for (int j = 0; j < downloaded.length; j++) {
} release = (yacyVersion) new yacyVersion(downloaded[j]);
downloadedreleases.add(release);
}
dflt = (downloadedreleases.size() == 0) ? null : (yacyVersion) downloadedreleases.last();
Iterator i = downloadedreleases.iterator();
int relcount = 0;
while (i.hasNext()) {
release = (yacyVersion) i.next();
prop.put("downloadedreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);
prop.put("downloadedreleases_" + relcount + "_file", release.name);
prop.put("downloadedreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);
relcount++;
}
prop.put("downloadedreleases", relcount);
// list remotely available releases
TreeSet[] releasess = yacyVersion.allReleases(); // {0=promain, 1=prodev, 2=stdmain, 3=stddev}
relcount = 0;
// main
TreeSet releases = releasess[(yacy.pro) ? 0 : 2];
releases.removeAll(downloadedreleases);
i = releases.iterator();
while (i.hasNext()) {
release = (yacyVersion) i.next();
prop.put("availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);
prop.put("availreleases_" + relcount + "_url", release.url.toString());
prop.put("availreleases_" + relcount + "_selected", 0);
relcount++;
}
// dev
dflt = (releasess[(yacy.pro) ? 1 : 3].size() == 0) ? null : (yacyVersion) releasess[(yacy.pro) ? 1 : 3].last();
releases = releasess[(yacy.pro) ? 1 : 3];
releases.removeAll(downloadedreleases);
i = releases.iterator();
while (i.hasNext()) {
release = (yacyVersion) i.next();
prop.put("availreleases_" + relcount + "_name", (release.proRelease ? "pro" : "standard") + "/" + ((release.mainRelease) ? "main" : "dev") + " " + release.releaseNr + "/" + release.svn);
prop.put("availreleases_" + relcount + "_url", release.url.toString());
prop.put("availreleases_" + relcount + "_selected", (release == dflt) ? 1 : 0);
relcount++;
} }
prop.put("availreleases", relcount);
/* /*
if ((adminaccess) && (yacyVersion.latestRelease >= (thisVersion+0.01))) { // only new Versions(not new SVN) if ((adminaccess) && (yacyVersion.latestRelease >= (thisVersion+0.01))) { // only new Versions(not new SVN)
@ -171,11 +227,12 @@ public class Status {
prop.put("hintVersionAvailable", 1); prop.put("hintVersionAvailable", 1);
} }
} }
prop.put("hintVersionAvailable", 1); // for testing
prop.putASIS("hintVersionDownload_versionResMain", (yacyVersion.latestMainRelease == null) ? "-" : yacyVersion.latestMainRelease.toAnchor()); prop.putASIS("hintVersionDownload_versionResMain", (yacyVersion.latestMainRelease == null) ? "-" : yacyVersion.latestMainRelease.toAnchor());
prop.putASIS("hintVersionDownload_versionResDev", (yacyVersion.latestDevRelease == null) ? "-" : yacyVersion.latestDevRelease.toAnchor()); prop.putASIS("hintVersionDownload_versionResDev", (yacyVersion.latestDevRelease == null) ? "-" : yacyVersion.latestDevRelease.toAnchor());
prop.put("hintVersionAvailable_latestVersion", Double.toString(yacyVersion.latestRelease)); prop.put("hintVersionAvailable_latestVersion", Double.toString(yacyVersion.latestRelease));
*/ */
// place some more hints // place some more hints
if ((adminaccess) && (sb.getThread(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL).getJobCount() == 0) && (sb.getThread(plasmaSwitchboard.INDEXER).getJobCount() == 0)) { if ((adminaccess) && (sb.getThread(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL).getJobCount() == 0) && (sb.getThread(plasmaSwitchboard.INDEXER).getJobCount() == 0)) {
prop.put("hintCrawlStart", 1); prop.put("hintCrawlStart", 1);

@ -73,14 +73,13 @@ public class Steering {
} }
if (post.containsKey("shutdown")) { if (post.containsKey("shutdown")) {
if (sb.updaterCallback != null) { sb.setConfig("Updater.restartSignal", 0); }
sb.terminate(3000); sb.terminate(3000);
prop.put("info", 3); prop.put("info", 3);
return prop; return prop;
} }
if (post.containsKey("restart")) { if (post.containsKey("restart")) {
if ((sb.updaterCallback == null) && (System.getProperty("os.name").toLowerCase().startsWith("win"))) { if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
// create yacy.restart file which is used in Windows startscript // create yacy.restart file which is used in Windows startscript
final File yacyRestart = new File(sb.getRootPath(), "DATA/yacy.restart"); final File yacyRestart = new File(sb.getRootPath(), "DATA/yacy.restart");
if (!yacyRestart.exists()) { if (!yacyRestart.exists()) {
@ -93,12 +92,6 @@ public class Steering {
} }
} }
if (sb.updaterCallback != null) {
sb.setConfig("Updater.shutdownSignal", 1);
} else {
serverLog.logWarning("SHUTDOWN", "No wrapper/updater running! Performing a normal shutdown...");
}
sb.terminate(5000); sb.terminate(5000);
prop.put("info", 4); prop.put("info", 4);

@ -79,13 +79,11 @@ public final class transfer {
prop.putASIS("process_path", ""); prop.putASIS("process_path", "");
prop.putASIS("process_maxsize", "0"); prop.putASIS("process_maxsize", "0");
if (sb.isRobinsonMode()) { if (sb.isRobinsonMode() || !sb.rankingOn) {
// in a robinson environment, do not answer. We do not do any transfer in a robinson cluster. // in a robinson environment, do not answer. We do not do any transfer in a robinson cluster.
return prop; return prop;
} }
if (!sb.rankingOn) { return prop; }
yacySeed otherseed = yacyCore.seedDB.get(otherpeer); yacySeed otherseed = yacyCore.seedDB.get(otherpeer);
if ((otherseed == null) || (filename.indexOf("..") >= 0)) { if ((otherseed == null) || (filename.indexOf("..") >= 0)) {
// reject unknown peers: this does not appear fair, but anonymous senders are dangerous // reject unknown peers: this does not appear fair, but anonymous senders are dangerous

Binary file not shown.

@ -717,7 +717,6 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
targetDate, null, tp.getOutgoingHeader(), targetDate, null, tp.getOutgoingHeader(),
null, "chunked", nocache); null, "chunked", nocache);
// send the content in chunked parts, see RFC 2616 section 3.6.1 // send the content in chunked parts, see RFC 2616 section 3.6.1
//byte[] result = o.toByteArray(); // this interrupts streaming (bad idea!)
httpChunkedOutputStream chos = new httpChunkedOutputStream(out); httpChunkedOutputStream chos = new httpChunkedOutputStream(out);
httpSSI.writeSSI(targetFile, o, chos); httpSSI.writeSSI(targetFile, o, chos);
//chos.write(result); //chos.write(result);

@ -75,7 +75,7 @@ public class URL {
} }
path = resolveBackpath(path); path = resolveBackpath(path);
identPort(url); identPort(url, (protocol.equals("http") ? 80 : ((protocol.equals("https")) ? 443 : ((protocol.equals("ftp")) ? 21 : -1))));
identRef(); identRef();
identQuest(); identQuest();
escape(); escape();
@ -370,11 +370,11 @@ public class URL {
return sbuf.toString(); return sbuf.toString();
} }
private void identPort(String inputURL) throws MalformedURLException { private void identPort(String inputURL, int dflt) throws MalformedURLException {
// identify ref in file // identify ref in file
int r = this.host.indexOf(':'); int r = this.host.indexOf(':');
if (r < 0) { if (r < 0) {
this.port = -1; this.port = dflt;
} else { } else {
try { try {
String portStr = this.host.substring(r + 1); String portStr = this.host.substring(r + 1);

@ -88,14 +88,6 @@ public final class plasmaRankingDistribution {
while (st.hasMoreTokens()) {this.address[c++] = st.nextToken();} while (st.hasMoreTokens()) {this.address[c++] = st.nextToken();}
} }
public plasmaRankingDistribution(serverLog log, File sourcePath, int method, int percentage, String address[]) {
this.log = log;
this.sourcePath = sourcePath;
this.method = method;
this.percentage = percentage;
this.address = address;
}
public void setMethod(int method, int percentage, String address[]) { public void setMethod(int method, int percentage, String address[]) {
this.method = method; this.method = method;
this.percentage = percentage; this.percentage = percentage;

@ -161,9 +161,9 @@ import de.anomic.server.serverObjects;
import de.anomic.server.serverSemaphore; import de.anomic.server.serverSemaphore;
import de.anomic.server.serverSwitch; import de.anomic.server.serverSwitch;
import de.anomic.server.serverThread; import de.anomic.server.serverThread;
import de.anomic.server.serverUpdaterCallback;
import de.anomic.server.logging.serverLog; import de.anomic.server.logging.serverLog;
import de.anomic.tools.crypt; import de.anomic.tools.crypt;
import de.anomic.yacy.yacyVersion;
import de.anomic.yacy.yacyClient; import de.anomic.yacy.yacyClient;
import de.anomic.yacy.yacyCore; import de.anomic.yacy.yacyCore;
import de.anomic.yacy.yacyNewsPool; import de.anomic.yacy.yacyNewsPool;
@ -210,6 +210,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public File htDocsPath; public File htDocsPath;
public File rankingPath; public File rankingPath;
public File workPath; public File workPath;
public File releasePath;
public HashMap rankingPermissions; public HashMap rankingPermissions;
public plasmaCrawlNURL noticeURL; public plasmaCrawlNURL noticeURL;
public plasmaCrawlZURL errorURL, delegatedURL; public plasmaCrawlZURL errorURL, delegatedURL;
@ -278,11 +279,6 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
private serverSemaphore shutdownSync = new serverSemaphore(0); private serverSemaphore shutdownSync = new serverSemaphore(0);
private boolean terminate = false; private boolean terminate = false;
/**
* Reference to the Updater callback class
*/
public serverUpdaterCallback updaterCallback = null;
//private Object crawlingPausedSync = new Object(); //private Object crawlingPausedSync = new Object();
//private boolean crawlingIsPaused = false; //private boolean crawlingIsPaused = false;
@ -735,6 +731,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
*/ */
public static final String HTCACHE_PATH = "proxyCache"; public static final String HTCACHE_PATH = "proxyCache";
public static final String HTCACHE_PATH_DEFAULT = "DATA/HTCACHE"; public static final String HTCACHE_PATH_DEFAULT = "DATA/HTCACHE";
public static final String RELEASE_PATH = "releases";
public static final String RELEASE_PATH_DEFAULT = "DATA/RELEASE";
/** /**
* <p><code>public static final String <strong>HTDOCS_PATH</strong> = "htDocsPath"</code></p> * <p><code>public static final String <strong>HTDOCS_PATH</strong> = "htDocsPath"</code></p>
* <p>Name of the setting specifying the folder beginning from the YaCy-installation's top-folder, where all * <p>Name of the setting specifying the folder beginning from the YaCy-installation's top-folder, where all
@ -934,6 +932,10 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
} }
} }
// set auto-updater locations
yacyVersion.latestDevReleaseLocation = getConfig("network.unit.update.location.dev", "");
yacyVersion.latestMainReleaseLocation = getConfig("network.unit.update.location.main", "");
// load values from configs // load values from configs
this.plasmaPath = new File(rootPath, getConfig(DBPATH, DBPATH_DEFAULT)); this.plasmaPath = new File(rootPath, getConfig(DBPATH, DBPATH_DEFAULT));
this.log.logConfig("Plasma DB Path: " + this.plasmaPath.toString()); this.log.logConfig("Plasma DB Path: " + this.plasmaPath.toString());
@ -1079,6 +1081,18 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
boolean cacheMigration = getConfigBool(PROXY_CACHE_MIGRATION, true); boolean cacheMigration = getConfigBool(PROXY_CACHE_MIGRATION, true);
this.cacheManager = new plasmaHTCache(htCachePath, maxCacheSize, ramHTTP_time, cacheLayout, cacheMigration); this.cacheManager = new plasmaHTCache(htCachePath, maxCacheSize, ramHTTP_time, cacheLayout, cacheMigration);
// create the release download directory
String release = getConfig(RELEASE_PATH, RELEASE_PATH_DEFAULT);
release = release.replace('\\', '/');
if (release.endsWith("/")) { release = release.substring(0, release.length() - 1); }
if (new File(release).isAbsolute()) {
releasePath = new File(release); // don't use rootPath
} else {
releasePath = new File(rootPath, release);
}
releasePath.mkdirs();
this.log.logInfo("RELEASE Path = " + releasePath.getAbsolutePath());
// starting message board // starting message board
initMessages(ramMessage_time); initMessages(ramMessage_time);
@ -1225,7 +1239,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
CRDist1Percent = 30 CRDist1Percent = 30
CRDist1Target = kaskelix.de:8080,yacy.dyndns.org:8000,suma-lab.de:8080 CRDist1Target = kaskelix.de:8080,yacy.dyndns.org:8000,suma-lab.de:8080
**/ **/
rankingOn = getConfig(RANKING_DIST_ON, "true").equals("true"); rankingOn = getConfig(RANKING_DIST_ON, "true").equals("true") && getConfig("network.unit.name", "").equals("freeworld");
rankingOwnDistribution = new plasmaRankingDistribution(log, new File(rankingPath, getConfig(RANKING_DIST_0_PATH, plasmaRankingDistribution.CR_OWN)), (int) getConfigLong(RANKING_DIST_0_METHOD, plasmaRankingDistribution.METHOD_ANYSENIOR), (int) getConfigLong(RANKING_DIST_0_METHOD, 0), getConfig(RANKING_DIST_0_TARGET, "")); rankingOwnDistribution = new plasmaRankingDistribution(log, new File(rankingPath, getConfig(RANKING_DIST_0_PATH, plasmaRankingDistribution.CR_OWN)), (int) getConfigLong(RANKING_DIST_0_METHOD, plasmaRankingDistribution.METHOD_ANYSENIOR), (int) getConfigLong(RANKING_DIST_0_METHOD, 0), getConfig(RANKING_DIST_0_TARGET, ""));
rankingOtherDistribution = new plasmaRankingDistribution(log, new File(rankingPath, getConfig(RANKING_DIST_1_PATH, plasmaRankingDistribution.CR_OTHER)), (int) getConfigLong(RANKING_DIST_1_METHOD, plasmaRankingDistribution.METHOD_MIXEDSENIOR), (int) getConfigLong(RANKING_DIST_1_METHOD, 30), getConfig(RANKING_DIST_1_TARGET, "kaskelix.de:8080,yacy.dyndns.org:8000,suma-lab.de:8080")); rankingOtherDistribution = new plasmaRankingDistribution(log, new File(rankingPath, getConfig(RANKING_DIST_1_PATH, plasmaRankingDistribution.CR_OTHER)), (int) getConfigLong(RANKING_DIST_1_METHOD, plasmaRankingDistribution.METHOD_MIXEDSENIOR), (int) getConfigLong(RANKING_DIST_1_METHOD, 30), getConfig(RANKING_DIST_1_TARGET, "kaskelix.de:8080,yacy.dyndns.org:8000,suma-lab.de:8080"));
@ -1757,14 +1771,6 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
errorURL.close(); errorURL.close();
wordIndex.close(); wordIndex.close();
yc.close(); yc.close();
// signal shutdown to the updater
if (updaterCallback != null) {
if (sb.getConfigLong("Updater.shutdownSignal", -1) == 0)
updaterCallback.signalYaCyShutdown();
else if
(sb.getConfigLong("Updater.shutdownSignal", -1) == 1)
updaterCallback.signalYaCyRestart();
}
log.logConfig("SWITCHBOARD SHUTDOWN TERMINATED"); log.logConfig("SWITCHBOARD SHUTDOWN TERMINATED");
} }
@ -1916,8 +1922,10 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
int count = rankingOwnDistribution.size() / 100; int count = rankingOwnDistribution.size() / 100;
if (count == 0) count = 1; if (count == 0) count = 1;
if (count > 5) count = 5; if (count > 5) count = 5;
rankingOwnDistribution.transferRanking(count); if (rankingOn) {
rankingOtherDistribution.transferRanking(1); rankingOwnDistribution.transferRanking(count);
rankingOtherDistribution.transferRanking(1);
}
// clean up delegated stack // clean up delegated stack
checkInterruption(); checkInterruption();

@ -1,12 +0,0 @@
package de.anomic.server;
public interface serverUpdaterCallback {
public boolean updateYaCyIsPossible();
public void grantYaCyUpdate();
public String getYaCyUpdateReleaseVersion();
//public File getYaCyUpdateReleaseFile();
public String getYaCyUpdateSource();
/** Signal a user initiated YaCy shutdown (not restart!) to the updater so it can terminate itself */
public void signalYaCyShutdown();
public void signalYaCyRestart();
}

@ -27,6 +27,7 @@
package de.anomic.yacy; package de.anomic.yacy;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.util.Comparator; import java.util.Comparator;
@ -35,7 +36,10 @@ import java.util.Map;
import java.util.TreeSet; import java.util.TreeSet;
import de.anomic.htmlFilter.htmlFilterContentScraper; import de.anomic.htmlFilter.htmlFilterContentScraper;
import de.anomic.http.httpc;
import de.anomic.net.URL; import de.anomic.net.URL;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverFileUtils;
public final class yacyVersion implements Comparator, Comparable { public final class yacyVersion implements Comparator, Comparable {
@ -50,16 +54,20 @@ public final class yacyVersion implements Comparator, Comparable {
public static double latestRelease = 0.1; // this value is overwritten when a peer with later version appears public static double latestRelease = 0.1; // this value is overwritten when a peer with later version appears
// information about latest release, retrieved from download pages // information about latest release, retrieved from download pages
public static yacyVersion latestDevRelease = null; // this static information should be overwritten by network-specific locations
public static yacyVersion latestMainRelease = null; // for details see yacy.network.unit
private static TreeSet[] allDevReleases = null;
private static TreeSet[] allMainReleases = null;
public static String latestDevReleaseLocation = ""; // will be initialized with value in yacy.network.unit
public static String latestMainReleaseLocation = ""; // will be initialized with value in yacy.network.unit
// class variables // class variables
public float releaseNr; public float releaseNr;
public String dateStamp; public String dateStamp;
public int svn; public int svn;
public boolean mainRelease; public boolean proRelease, mainRelease;
public URL url; public URL url;
public String name;
public yacyVersion(URL url) { public yacyVersion(URL url) {
this(url.getFileName()); this(url.getFileName());
@ -73,16 +81,17 @@ public final class yacyVersion implements Comparator, Comparable {
// yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz // yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
// i.e. yacy_v0.51_20070321_3501.tar.gz // i.e. yacy_v0.51_20070321_3501.tar.gz
this.url = null; this.url = null;
this.name = release;
if ((release == null) || (!release.endsWith(".tar.gz"))) { if ((release == null) || (!release.endsWith(".tar.gz"))) {
throw new RuntimeException("release file name '" + release + "' is not valid, no tar.gz"); throw new RuntimeException("release file name '" + release + "' is not valid, no tar.gz");
} }
// cut off tail // cut off tail
release = release.substring(0, release.length() - 7); release = release.substring(0, release.length() - 7);
if (release.startsWith("yacy_dev_v")) { if (release.startsWith("yacy_pro_v")) {
mainRelease = false; proRelease = true;
release = release.substring(10); release = release.substring(10);
} else if (release.startsWith("yacy_v")) { } else if (release.startsWith("yacy_v")) {
mainRelease = true; proRelease = false;
release = release.substring(6); release = release.substring(6);
} else { } else {
throw new RuntimeException("release file name '" + release + "' is not valid, wrong prefix"); throw new RuntimeException("release file name '" + release + "' is not valid, wrong prefix");
@ -98,6 +107,8 @@ public final class yacyVersion implements Comparator, Comparable {
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[0] + "' should be a float number"); throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[0] + "' should be a float number");
} }
this.mainRelease = ((int) (this.releaseNr * (float) 1000)) % 10 == 0;
//System.out.println("Release version " + this.releaseNr + " is " + ((this.mainRelease) ? "main" : "std"));
this.dateStamp = comp[1]; this.dateStamp = comp[1];
if (this.dateStamp.length() != 8) { if (this.dateStamp.length() != 8) {
throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[1] + "' should be a 8-digit date string"); throw new RuntimeException("release file name '" + release + "' is not valid, '" + comp[1] + "' should be a 8-digit date string");
@ -110,16 +121,6 @@ public final class yacyVersion implements Comparator, Comparable {
// finished! we parsed a relase string // finished! we parsed a relase string
} }
/*
public yacyVersion(URL url, float releaseNr, String dateStamp, int svn, boolean mainRelease) {
this.url = url;
this.releaseNr = releaseNr;
this.dateStamp = dateStamp;
this.svn = svn;
this.mainRelease = mainRelease;
}
*/
public int compareTo(Object obj) { public int compareTo(Object obj) {
yacyVersion v = (yacyVersion) obj; yacyVersion v = (yacyVersion) obj;
return compare(this, v); return compare(this, v);
@ -144,35 +145,67 @@ public final class yacyVersion implements Comparator, Comparable {
public String toAnchor() { public String toAnchor() {
// generates an anchor string that can be used to embed in an html for direct download // generates an anchor string that can be used to embed in an html for direct download
return "<a href=" + this.url.toNormalform() + ">YaCy " + ((this.mainRelease) ? "main release" : "developer release") + " v" + this.releaseNr + ", SVN " + this.svn + "</a>"; return "<a href=" + this.url.toNormalform() + ">YaCy " + ((this.proRelease) ? "pro release" : "standard release") + " v" + this.releaseNr + ", SVN " + this.svn + "</a>";
}
/*
public static yacyVersion latestStandardRelease() {
// get the latest release info from a internet resource
yacyVersion devrel = (yacyVersion) allDevReleases().last();
yacyVersion mainrel = (yacyVersion) allDevReleases().last();
} }
public static void aquireLatestReleaseInfo() { public static yacyVersion latestProRelease() {
if ((latestDevRelease == null) && (latestMainRelease == null)) { // get the latest release info from a internet resource
if (latestDevRelease == null) latestDevRelease = aquireLatestDevRelease(); return (yacyVersion) allMainReleases().last();
if (latestMainRelease == null) latestMainRelease = aquireLatestMainRelease(); }
*/
public static TreeSet[] allReleases() {
// join the release infos
// {promainreleases, prodevreleases, stdmainreleases, stddevreleases}
TreeSet[] a = allMainReleases();
TreeSet[] b = allDevReleases();
TreeSet[] r = new TreeSet[4];
TreeSet s;
for (int i = 0; i < 4; i++) {
s = new TreeSet();
if (b[i] != null) s.addAll((TreeSet) b[i]);
if (a[i] != null) s.addAll((TreeSet) a[i]);
r[i] = s;
} }
return r;
} }
public static yacyVersion aquireLatestDevRelease() { private static TreeSet[] allDevReleases() {
// get the latest release info from a internet resource // get release info from a internet resource
try { // {promainreleases, prodevreleases, stdmainreleases, stddevreleases}
return latestReleaseFrom(new URL("http://latest.yacy-forum.net")); if ((allDevReleases == null) ||
((allDevReleases[0].size() == 0) &&
(allDevReleases[1].size() == 0) &&
(allDevReleases[2].size() == 0) &&
(allDevReleases[3].size() == 0) )) try {
allDevReleases = allReleaseFrom(new URL(latestDevReleaseLocation));
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
return null; return null;
} }
return allDevReleases;
} }
public static yacyVersion aquireLatestMainRelease() { private static TreeSet[] allMainReleases() {
// get the latest release info from a internet resource // get release info from a internet resource
try { // {promainreleases, prodevreleases, stdmainreleases, stddevreleases}
return latestReleaseFrom(new URL("http://yacy.net/yacy/Download.html")); if ((allMainReleases == null) ||
((allMainReleases[0].size() == 0) &&
(allMainReleases[1].size() == 0) &&
(allMainReleases[2].size() == 0) &&
(allMainReleases[3].size() == 0) )) try {
allMainReleases = allReleaseFrom(new URL(latestMainReleaseLocation));
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
return null; return null;
} }
return allMainReleases;
} }
public static yacyVersion latestReleaseFrom(URL url) { private static TreeSet[] allReleaseFrom(URL url) {
// retrieves the latest info about releases // retrieves the latest info about releases
// this is done by contacting a release location, // this is done by contacting a release location,
// parsing the content and filtering+parsing links // parsing the content and filtering+parsing links
@ -187,7 +220,10 @@ public final class yacyVersion implements Comparator, Comparable {
// analyse links in scraper resource, and find link to latest release in it // analyse links in scraper resource, and find link to latest release in it
Map anchors = scraper.getAnchors(); // a url (String) / name (String) relation Map anchors = scraper.getAnchors(); // a url (String) / name (String) relation
Iterator i = anchors.keySet().iterator(); Iterator i = anchors.keySet().iterator();
TreeSet releases = new TreeSet(); // will contain a release (Float) / url (String) relation TreeSet stddevreleases = new TreeSet();
TreeSet prodevreleases = new TreeSet();
TreeSet stdmainreleases = new TreeSet();
TreeSet promainreleases = new TreeSet();
yacyVersion release; yacyVersion release;
while (i.hasNext()) { while (i.hasNext()) {
try { try {
@ -198,7 +234,10 @@ public final class yacyVersion implements Comparator, Comparable {
try { try {
release = new yacyVersion(url); release = new yacyVersion(url);
//System.out.println("r " + release.toAnchor()); //System.out.println("r " + release.toAnchor());
releases.add(release); if ( release.proRelease && release.mainRelease) promainreleases.add(release);
if ( release.proRelease && !release.mainRelease) prodevreleases.add(release);
if (!release.proRelease && release.mainRelease) stdmainreleases.add(release);
if (!release.proRelease && !release.mainRelease) stddevreleases.add(release);
} catch (RuntimeException e) { } catch (RuntimeException e) {
// the release string was not well-formed. // the release string was not well-formed.
// that might have been another link // that might have been another link
@ -206,8 +245,22 @@ public final class yacyVersion implements Comparator, Comparable {
continue; continue;
} }
} }
if (releases.size() == 0) return null; return new TreeSet[] {promainreleases, prodevreleases, stdmainreleases, stddevreleases} ;
//i = releases.iterator(); while (i.hasNext()) {System.out.println("v " + ((yacyVersion) i.next()).toAnchor());} }
return (yacyVersion) releases.last();
public static void downloadRelease(yacyVersion release) throws IOException {
File storagePath = plasmaSwitchboard.getSwitchboard().releasePath;
// load file
byte[] file = httpc.wget(
release.url,
release.url.getHost(),
10000,
null,
null,
plasmaSwitchboard.getSwitchboard().remoteProxyConfig
);
if (file == null) throw new IOException("wget of url " + release.url + " failed");
// save file
serverFileUtils.write(file, new File(storagePath, release.url.getFileName()));
} }
} }

@ -90,7 +90,6 @@ import de.anomic.server.serverFileUtils;
import de.anomic.server.serverMemory; import de.anomic.server.serverMemory;
import de.anomic.server.serverSemaphore; import de.anomic.server.serverSemaphore;
import de.anomic.server.serverSystem; import de.anomic.server.serverSystem;
import de.anomic.server.serverUpdaterCallback;
import de.anomic.server.logging.serverLog; import de.anomic.server.logging.serverLog;
import de.anomic.tools.enumerateFiles; import de.anomic.tools.enumerateFiles;
import de.anomic.yacy.yacyClient; import de.anomic.yacy.yacyClient;
@ -137,6 +136,7 @@ public final class yacy {
// static objects // static objects
private static String vString = "@REPL_VERSION@"; private static String vString = "@REPL_VERSION@";
private static double version = 0.1; private static double version = 0.1;
public static boolean pro;
private static final String vDATE = "@REPL_DATE@"; private static final String vDATE = "@REPL_DATE@";
private static final String copyright = "[ YaCy v" + vString + ", build " + vDATE + " by Michael Christen / www.yacy.net ]"; private static final String copyright = "[ YaCy v" + vString + ", build " + vDATE + " by Michael Christen / www.yacy.net ]";
@ -259,26 +259,7 @@ public final class yacy {
f.createNewFile(); f.createNewFile();
f.deleteOnExit(); f.deleteOnExit();
/* pro = new File(homePath, "libx").exists();
// Testing if the yacy archive file were unzipped correctly.
// This test is needed because of classfile-names longer than 100 chars
// which could cause problems with incompatible unzip software.
// See:
// - http://www.yacy-forum.de/viewtopic.php?t=1763
// - http://www.yacy-forum.de/viewtopic.php?t=715
// - http://www.yacy-forum.de/viewtopic.php?t=1674
File unzipTest = new File(homePath,"doc/This_is_a_test_if_the_archive_file_containing_YaCy_was_unpacked_correctly_If_not_please_use_gnu_tar_instead.txt");
if (!unzipTest.exists()) {
String errorMsg = "The archive file containing YaCy was not unpacked correctly. " +
"Please use 'GNU-Tar' or upgrade to a newer version of your unzip software.\n" +
"For detailed information on this bug see: " +
"http://www.yacy-forum.de/viewtopic.php?t=715";
System.err.println(errorMsg);
serverLog.logSevere("STARTUP", errorMsg);
System.exit(1);
}
*/
boolean pro = new File(homePath, "libx").exists();
sb = new plasmaSwitchboard(homePath, "yacy.init", "DATA/SETTINGS/httpProxy.conf", pro); sb = new plasmaSwitchboard(homePath, "yacy.init", "DATA/SETTINGS/httpProxy.conf", pro);
sbSync.V(); // signal that the sb reference was set sbSync.V(); // signal that the sb reference was set
@ -548,26 +529,6 @@ public final class yacy {
} }
} }
/**
* Function to set the updater callback class
* @param updaterCallback
* @throws InterruptedException
*/
public static void setUpdaterCallback(serverUpdaterCallback updaterCallback) throws InterruptedException {
sbSync.P();
sb.updaterCallback = updaterCallback;
sbSync.V();
}
/**
* Function allowing the updater to block until the startup has finished
* @throws InterruptedException
*/
public static void waitForFinishedStartup() throws InterruptedException {
startupFinishedSync.P();
startupFinishedSync.V();
}
/** /**
* Call the shutdown-page of YaCy to tell it to shut down. This method is * Call the shutdown-page of YaCy to tell it to shut down. This method is
* called if you start yacy with the argument -shutdown. * called if you start yacy with the argument -shutdown.

@ -157,6 +157,9 @@ proxyCache = DATA/HTCACHE
proxyCacheSize = 100 proxyCacheSize = 100
proxyCacheSize__pro = 600 proxyCacheSize__pro = 600
# storage place for new releases
releases = DATA/RELEASE
# use the mostly direct mapping of URLs to Filenames # use the mostly direct mapping of URLs to Filenames
# makes it easy watching the content of the cache using file browsers # makes it easy watching the content of the cache using file browsers
# problems arise when a file already exists where a new entry expects a directory # problems arise when a file already exists where a new entry expects a directory

@ -62,6 +62,11 @@ network.unit.bootstrap.seedlist4 = http://www.yacy.net/yacy/seed.txt
network.unit.bootstrap.seedlist5 = http://www.marcelhenseler.de/yacy/seed.txt network.unit.bootstrap.seedlist5 = http://www.marcelhenseler.de/yacy/seed.txt
network.unit.bootstrap.seedlist6 = http://www.dc-art.de/yacy/seed.txt network.unit.bootstrap.seedlist6 = http://www.dc-art.de/yacy/seed.txt
# each network may use different yacy distributions.
# the auto-updater can access network-specific update locations
network.unit.update.location.dev = http://latest.yacy-forum.net
network.unit.update.location.main = http://yacy.net/yacy/Download.html
# properties for in-protocol response authentification: # properties for in-protocol response authentification:
#network.unit.protocol.control = uncontrolled #network.unit.protocol.control = uncontrolled
#network.unit.protocol.request.authentification.method = salted-magic #network.unit.protocol.request.authentification.method = salted-magic

Loading…
Cancel
Save