From 1a3b0d3812ebb17e5a8efc288e868f38ee01fb1c Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Mon, 3 Jan 2011 14:26:22 +0000 Subject: [PATCH] * I2PAppContext: New getProperties() method * i2ptunnel: - Use context properties as defaults --- .../java/src/net/i2p/i2ptunnel/I2PTunnel.java | 4 ++-- core/java/src/net/i2p/I2PAppContext.java | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java index 75a276aa00..3a557c5a10 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java @@ -118,8 +118,8 @@ public class I2PTunnel implements Logging, EventDispatcher { _tunnelId = ++__tunnelId; _log = _context.logManager().getLog(I2PTunnel.class); _event = new EventDispatcherImpl(); - Properties p = new Properties(); - p.putAll(System.getProperties()); + // as of 0.8.4, include context properties + Properties p = _context.getProperties(); _clientOptions = p; _sessions = new ArrayList(1); diff --git a/core/java/src/net/i2p/I2PAppContext.java b/core/java/src/net/i2p/I2PAppContext.java index e6df37e6f4..e235511aa0 100644 --- a/core/java/src/net/i2p/I2PAppContext.java +++ b/core/java/src/net/i2p/I2PAppContext.java @@ -483,6 +483,21 @@ public class I2PAppContext { return names; } + /** + * Access the configuration attributes of this context, listing the properties + * provided during the context construction, as well as the ones included in + * System.getProperties. + * + * @return new Properties with system and context properties + * @since 0.8.4 + */ + public Properties getProperties() { + Properties rv = new Properties(); + rv.putAll(System.getProperties()); + rv.putAll(_overrideProps); + return rv; + } + /** * The statistics component with which we can track various events * over time. -- GitLab