Author: toad
Date: 2008-04-23 15:15:08 +0000 (Wed, 23 Apr 2008)
New Revision: 19534
Modified:
trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
Log:
First-time wizard: Ask the user how much memory to allow Freenet to use (if we
have access to wrapper.conf).
Modified: trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
2008-04-23 14:54:16 UTC (rev 19533)
+++ trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
2008-04-23 15:15:08 UTC (rev 19534)
@@ -11,6 +11,7 @@
import freenet.client.HighLevelSimpleClient;
import freenet.config.Config;
import freenet.config.InvalidConfigValueException;
+import freenet.config.WrapperConfig;
import freenet.l10n.L10n;
import freenet.node.Node;
import freenet.node.NodeClientCore;
@@ -190,6 +191,30 @@
bandwidthForm.addChild("input", new String[] { "type",
"name", "value" }, new String[] { "submit", "cancel",
L10n.getString("Toadlet.cancel")});
this.writeHTMLReply(ctx, 200, "OK",
pageNode.generate());
return;
+ } else if(currentStep == 6) {
+ HTMLNode pageNode =
ctx.getPageMaker().getPageNode(l10n("step6Title"), false, ctx);
+ HTMLNode contentNode =
ctx.getPageMaker().getContentNode(pageNode);
+
+ HTMLNode memoryInfobox = contentNode.addChild("div",
"class", "infobox infobox-normal");
+ HTMLNode memoryInfoboxHeader =
memoryInfobox.addChild("div", "class", "infobox-header");
+ HTMLNode memoryInfoboxContent =
memoryInfobox.addChild("div", "class", "infobox-content");
+
+ memoryInfoboxHeader.addChild("#", l10n("memoryLimit"));
+ memoryInfoboxContent.addChild("#",
l10n("memoryLimitLong"));
+
+ HTMLNode bandwidthForm =
ctx.addFormChild(memoryInfoboxContent, ".", "memoryForm");
+ HTMLNode result = bandwidthForm.addChild("select",
"name", "memory");
+ result.addChild("option", "value", "64", "64MiB - only
if desperate");
+ result.addChild("option", "value", "128", "128MiB -
bare minimum");
+ result.addChild("option", new String[] { "value",
"selected" }, new String[] { "192", "selected" }, "192MiB - reasonable
default");
+ result.addChild("option", "value", "256", "256MiB - if
you have at least 1GB of RAM");
+ result.addChild("option", "value", "512", "512MiB - if
you have lots of RAM");
+
+ bandwidthForm.addChild("input", new String[] { "type",
"name", "value" }, new String[] { "submit", "memoryF",
L10n.getString("FirstTimeWizardToadlet.continue")});
+ bandwidthForm.addChild("input", new String[] { "type",
"name", "value" }, new String[] { "submit", "cancel",
L10n.getString("Toadlet.cancel")});
+ this.writeHTMLReply(ctx, 200, "OK",
pageNode.generate());
+ return;
+
}else if(currentStep == 7) {
HTMLNode pageNode =
ctx.getPageMaker().getPageNode(l10n("step7Title"), true, ctx);
HTMLNode contentNode =
ctx.getPageMaker().getContentNode(pageNode);
@@ -292,8 +317,17 @@
} catch (InvalidConfigValueException e) {
Logger.error(this, "Should not happen, please
report!" + e, e);
}
+ boolean canDoStepSix =
WrapperConfig.canChangeProperties();
+ super.writeTemporaryRedirect(ctx, "step5",
TOADLET_URL+"?step="+(canDoStepSix?"6":"7"));
+ return;
+ } else if(request.isPartSet("memoryF")) {
+ String selectedMemorySize =
request.getPartAsString("memoryF", 6);
+
+ int memorySize = Fields.parseInt(selectedMemorySize,
-1);
+ if(memorySize >= 0) {
+
WrapperConfig.setWrapperProperty("wrapper.java.maxmemory", selectedMemorySize);
+ }
super.writeTemporaryRedirect(ctx, "step5",
TOADLET_URL+"?step=7");
- return;
}
super.writeTemporaryRedirect(ctx, "invalid/unhandled data",
TOADLET_URL);
Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-04-23
14:54:16 UTC (rev 19533)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-04-23
15:15:08 UTC (rev 19534)
@@ -272,11 +272,14 @@
FirstTimeWizardToadlet.iDoTrust=Do you trust people connected to ${interface}
(${ip})?
FirstTimeWizardToadlet.congratz=Welcome on board!
FirstTimeWizardToadlet.congratzLong=Congratulations, the base configuration of
your Freenet node is now done. You can change and edit any of the parameters
you have just set going to the "configuration" page, reachable anytime from the
menu on the left of the interface. Please note that Freenet will be slow to
start with, it will improve over time. You can get started by clicking on the
bookmarks on the next page. We wish you a pleasant Freenet experience.
+FirstTimeWizardToadlet.memoryLimit=Memory usage
+FirstTimeWizardToadlet.memoryLimitLong=How much memory would you like to allow
Freenet to use? If you have many downloads or uploads queued, Freenet will need
more memory. We suggest you not set this below 128MB unless you are really
short of RAM. If you have 1GB or more, you should probably set this to at least
256MB.
FirstTimeWizardToadlet.step1Title=Freenet first time wizard! - Friends and
strangers
FirstTimeWizardToadlet.step2Title=Freenet first time wizard! - Choose a node
name
FirstTimeWizardToadlet.step3Title=Freenet first time wizard! - Bandwidth limits
FirstTimeWizardToadlet.step4Title=Freenet first time wizard! - Datastore size
FirstTimeWizardToadlet.step5Title=Freenet first time wizard! - Network
configuration
+FirstTimeWizardToadlet.step6Title=Freenet first time wizard! - Memory usage
FirstTimeWizardToadlet.step7Title=Freenet first time wizard! -
Congratulations, your node is now configured
FirstTimeWizardToadlet.skipWizard=I am not a newbie, please skip the wizard!
FirstTimeWizardToadlet.tenPercentDisk=(= 10% of free disk space)