remove dependency from old serverCore.java

- remaining getPortNr not needed 
  (as current release allows only to set plain integer as port,
   see ConfigBasic)
pull/1/head
reger 11 years ago
parent 2a48c4138e
commit 8eaabb9600

@ -44,7 +44,6 @@ import net.yacy.peers.Seed;
import net.yacy.peers.operation.yacyBuildProperties;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.server.serverCore;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
@ -185,7 +184,7 @@ public class Status
// hostname and port
final String extendedPortString = sb.getConfig("port", "8090");
final int pos = extendedPortString.indexOf(':', 0);
prop.put("port", serverCore.getPortNr(extendedPortString));
prop.put("port", extendedPortString);
if ( pos != -1 ) {
prop.put("extPortFormat", "1");
prop.putHTML("extPortFormat_extPort", extendedPortString);

@ -28,7 +28,6 @@ import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.server.serverCore;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
@ -41,7 +40,7 @@ public class opensearchdescription {
if (env.getConfigBool(SwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
String thisaddress = header.get("Host", Domains.LOCALHOST);
if (thisaddress.indexOf(':',0) == -1) thisaddress += ":" + serverCore.getPortNr(env.getConfig("port", "8090"));
if (thisaddress.indexOf(':',0) == -1) thisaddress += ":" + env.getConfig("port", "8090");
final serverObjects prop = new serverObjects();
prop.put("compareyacy", post != null && post.getBoolean("compare_yacy") ? 1 : 0);

@ -35,7 +35,6 @@ import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.peers.Seed;
import net.yacy.search.Switchboard;
import net.yacy.server.serverCore;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
@ -55,7 +54,7 @@ public class welcome {
prop.putHTML("peeraddress", sb.peers.mySeed().getPublicAddress());
prop.put("hostname", env.myPublicIP());
prop.put("hostip", Domains.dnsResolve(env.myPublicIP()).getHostAddress());
prop.put("port", serverCore.getPortNr(env.getConfig("port","8090")));
prop.put("port", env.getConfig("port","8090"));
prop.put("clientip", header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, ""));
final String peertype = (sb.peers.mySeed() == null) ? Seed.PEERTYPE_JUNIOR : sb.peers.mySeed().get(Seed.PEERTYPE, Seed.PEERTYPE_VIRGIN);

@ -85,7 +85,6 @@ import net.yacy.search.query.SearchEvent;
import net.yacy.search.query.SearchEventCache;
import net.yacy.search.query.SearchEventType;
import net.yacy.search.ranking.RankingProfile;
import net.yacy.server.serverCore;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
import net.yacy.server.servletProperties;
@ -147,7 +146,7 @@ public class yacysearch {
// adding some additional properties needed for the rss feed
String hostName = header.get("Host", Domains.LOCALHOST);
if ( hostName.indexOf(':', 0) == -1 ) {
hostName += ":" + serverCore.getPortNr(env.getConfig("port", "8090"));
hostName += ":" + env.getConfig("port", "8090");
}
prop.put("searchBaseURL", "http://" + hostName + "/yacysearch.html");
prop.put("rssYacyImageURL", "http://" + hostName + "/env/grafics/yacy.gif");
@ -982,7 +981,7 @@ public class yacysearch {
// hostname and port (assume locahost if nothing helps)
final InetAddress hostIP = Domains.myPublicLocalIP();
prop.put("myhost", hostIP != null ? hostIP.getHostAddress() : Domains.LOCALHOST);
prop.put("myport", serverCore.getPortNr(sb.getConfig("port", "8090")));
prop.put("myport", sb.getConfig("port", "8090"));
// return rewrite properties
return prop;

@ -33,7 +33,6 @@ import net.yacy.cora.protocol.RequestHeader;
import net.yacy.document.LibraryProvider;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.server.serverCore;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
@ -122,7 +121,7 @@ public class yacysearch_location {
String promoteSearchPageGreeting = env.getConfig(SwitchboardConstants.GREETING, "");
if (env.getConfigBool(SwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
String hostName = header.get("Host", Domains.LOCALHOST);
if (hostName.indexOf(':',0) == -1) hostName += ":" + serverCore.getPortNr(env.getConfig("port", "8090"));
if (hostName.indexOf(':',0) == -1) hostName += ":" + env.getConfig("port", "8090");
final String originalquerystring = (post == null) ? "" : post.get("query", post.get("search", "")).trim(); // SRU compliance
final boolean global = post.get("kml_resource", "local").equals("global");

@ -3632,7 +3632,7 @@ public final class Switchboard extends serverSwitch {
private static long indeSizeCache = 0;
private static long indexSizeTime = 0;
public void updateMySeed() {
this.peers.mySeed().put(Seed.PORT, Integer.toString(serverCore.getPortNr(getConfig("port", "8090"))));
this.peers.mySeed().put(Seed.PORT, getConfig("port", "8090"));
//the speed of indexing (pages/minute) of the peer
final long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;

@ -54,7 +54,6 @@ import net.yacy.cora.util.NumberTools;
import net.yacy.kelondro.util.FileUtils;
import net.yacy.kelondro.util.MemoryControl;
import net.yacy.search.Switchboard;
import net.yacy.server.serverCore;
import net.yacy.server.serverObjects;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
@ -324,13 +323,13 @@ public final class HTTPDemon {
final InetAddress hostAddress = Domains.dnsResolve(clientIP);
if (hostAddress == null) {
tp.put("host", Domains.myPublicLocalIP().getHostAddress());
tp.put("port", Integer.toString(serverCore.getPortNr(switchboard.getConfig("port", "8090"))));
tp.put("port", switchboard.getConfig("port", "8090"));
} else if (hostAddress.isSiteLocalAddress() || hostAddress.isLoopbackAddress()) {
tp.put("host", Domains.myPublicLocalIP().getHostAddress());
tp.put("port", Integer.toString(serverCore.getPortNr(switchboard.getConfig("port", "8090"))));
tp.put("port", switchboard.getConfig("port", "8090"));
} else {
tp.put("host", switchboard.myPublicIP());
tp.put("port", Integer.toString(serverCore.getPortNr(switchboard.getConfig("port", "8090"))));
tp.put("port", switchboard.getConfig("port", "8090"));
}
tp.put("peerName", (getAlternativeResolver() == null) ? "" : getAlternativeResolver().myName());

@ -41,13 +41,4 @@ public final class serverCore {
public static boolean useStaticIP = false;
public static int getPortNr(String extendedPortString) {
int pos = -1;
if ((pos = extendedPortString.indexOf(':'))!= -1) {
extendedPortString = extendedPortString.substring(pos+1);
}
return Integer.parseInt(extendedPortString);
}
}

@ -63,7 +63,6 @@ import net.yacy.peers.operation.yacyRelease;
import net.yacy.peers.operation.yacyVersion;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.server.serverCore;
import com.google.common.io.Files;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.federate.yacy.CacheStrategy;
@ -542,7 +541,7 @@ public final class yacy {
final Properties config = configuration("COMMAND-STEERING", homePath);
// read port
final int port = serverCore.getPortNr(config.getProperty("port", "8090"));
final int port = Integer.parseInt(config.getProperty("port", "8090"));
// read password
String encodedPassword = (String) config.get(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5);

Loading…
Cancel
Save