Bugfix for getting Properties to actually work.
This commit is contained in:
14
apps/BOB/bob.config
Normal file
14
apps/BOB/bob.config
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#bob.config
|
||||||
|
#Tue Dec 30 00:00:00 UTC 2008
|
||||||
|
# Please leave this file here for testing.
|
||||||
|
# Thank you,
|
||||||
|
# Sponge
|
||||||
|
i2cp.tcp.port=7654
|
||||||
|
BOB.host=localhost
|
||||||
|
inbound.lengthVariance=0
|
||||||
|
i2cp.messageReliability=BestEffort
|
||||||
|
BOB.port=45067
|
||||||
|
outbound.length=1
|
||||||
|
inbound.length=1
|
||||||
|
outbound.lengthVariance=0
|
||||||
|
i2cp.tcp.host=localhost
|
@ -1,5 +1,11 @@
|
|||||||
application.title=BOB
|
application.title=BOB
|
||||||
application.vendor=root
|
application.vendor=root
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=false
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=8
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=8
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
|
||||||
|
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
|
||||||
build.classes.dir=${build.dir}/classes
|
build.classes.dir=${build.dir}/classes
|
||||||
build.classes.excludes=**/*.java,**/*.form
|
build.classes.excludes=**/*.java,**/*.form
|
||||||
# This directory is removed when the project is cleaned:
|
# This directory is removed when the project is cleaned:
|
||||||
@ -76,6 +82,12 @@ javadoc.splitindex=true
|
|||||||
javadoc.use=true
|
javadoc.use=true
|
||||||
javadoc.version=false
|
javadoc.version=false
|
||||||
javadoc.windowtitle=
|
javadoc.windowtitle=
|
||||||
|
jnlp.codebase.type=local
|
||||||
|
jnlp.codebase.url=file:/root/NetBeansProjects/i2p.i2p/apps/BOB/dist/
|
||||||
|
jnlp.descriptor=application
|
||||||
|
jnlp.enabled=false
|
||||||
|
jnlp.offline-allowed=false
|
||||||
|
jnlp.signed=false
|
||||||
main.class=net.i2p.BOB.Main
|
main.class=net.i2p.BOB.Main
|
||||||
manifest.file=manifest.mf
|
manifest.file=manifest.mf
|
||||||
meta.inf.dir=${src.dir}/META-INF
|
meta.inf.dir=${src.dir}/META-INF
|
||||||
|
@ -114,6 +114,8 @@ public class BOB {
|
|||||||
public final static String PROP_BOB_HOST = "BOB.host";
|
public final static String PROP_BOB_HOST = "BOB.host";
|
||||||
private static int maxConnections = 0;
|
private static int maxConnections = 0;
|
||||||
private static NamedDB database;
|
private static NamedDB database;
|
||||||
|
private static Properties props = new Properties();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a warning
|
* Log a warning
|
||||||
@ -157,7 +159,6 @@ public class BOB {
|
|||||||
// Set up all defaults to be passed forward to other threads.
|
// Set up all defaults to be passed forward to other threads.
|
||||||
// Re-reading the config file in each thread is pretty damn stupid.
|
// Re-reading the config file in each thread is pretty damn stupid.
|
||||||
// I2PClient client = I2PClientFactory.createClient();
|
// I2PClient client = I2PClientFactory.createClient();
|
||||||
Properties props = new Properties();
|
|
||||||
String configLocation = System.getProperty(PROP_CONFIG_LOCATION, "bob.config");
|
String configLocation = System.getProperty(PROP_CONFIG_LOCATION, "bob.config");
|
||||||
|
|
||||||
// This is here just to ensure there is no interference with our threadgroups.
|
// This is here just to ensure there is no interference with our threadgroups.
|
||||||
@ -217,6 +218,7 @@ public class BOB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
info(props.toString());
|
||||||
info("BOB is now running.");
|
info("BOB is now running.");
|
||||||
ServerSocket listener = new ServerSocket(Integer.parseInt(props.getProperty(PROP_BOB_PORT)), 10, InetAddress.getByName(props.getProperty(PROP_BOB_HOST)));
|
ServerSocket listener = new ServerSocket(Integer.parseInt(props.getProperty(PROP_BOB_PORT)), 10, InetAddress.getByName(props.getProperty(PROP_BOB_HOST)));
|
||||||
Socket server;
|
Socket server;
|
||||||
|
File diff suppressed because it is too large
Load Diff
56
apps/BOB/src/net/i2p/BOB/Lifted.java
Normal file
56
apps/BOB/src/net/i2p/BOB/Lifted.java
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/**
|
||||||
|
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
* Version 2, December 2004
|
||||||
|
*
|
||||||
|
* Copyright (C) sponge
|
||||||
|
* Planet Earth
|
||||||
|
* Everyone is permitted to copy and distribute verbatim or modified
|
||||||
|
* copies of this license document, and changing it is allowed as long
|
||||||
|
* as the name is changed.
|
||||||
|
*
|
||||||
|
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
*
|
||||||
|
* 0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||||
|
*
|
||||||
|
* See...
|
||||||
|
*
|
||||||
|
* http://sam.zoy.org/wtfpl/
|
||||||
|
* and
|
||||||
|
* http://en.wikipedia.org/wiki/WTFPL
|
||||||
|
*
|
||||||
|
* ...for any additional details and liscense questions.
|
||||||
|
*/
|
||||||
|
package net.i2p.BOB;
|
||||||
|
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets of "friendly" utilities to make life easier.
|
||||||
|
* Any "Lifted" code will apear here, and credits given.
|
||||||
|
* It's better to "Lift" a small chunk of "free" code than add in piles of
|
||||||
|
* code we don't need, and don't want.
|
||||||
|
*
|
||||||
|
* @author sponge
|
||||||
|
*/
|
||||||
|
public class Lifted {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy a set of properties from one Property to another.
|
||||||
|
* Lifted from Apache Derby code svn repository.
|
||||||
|
* Liscenced as follows:
|
||||||
|
* http://svn.apache.org/repos/asf/db/derby/code/trunk/LICENSE
|
||||||
|
*
|
||||||
|
* @param src_prop Source set of properties to copy from.
|
||||||
|
* @param dest_prop Dest Properties to copy into.
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
public static void copyProperties(Properties src_prop, Properties dest_prop) {
|
||||||
|
for (Enumeration propertyNames = src_prop.propertyNames();
|
||||||
|
propertyNames.hasMoreElements();) {
|
||||||
|
Object key = propertyNames.nextElement();
|
||||||
|
dest_prop.put(key, src_prop.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -74,7 +74,10 @@ public class MUXlisten implements Runnable {
|
|||||||
this.info.getReadLock();
|
this.info.getReadLock();
|
||||||
N = this.info.get("NICKNAME").toString();
|
N = this.info.get("NICKNAME").toString();
|
||||||
prikey = new ByteArrayInputStream((byte[])info.get("KEYS"));
|
prikey = new ByteArrayInputStream((byte[])info.get("KEYS"));
|
||||||
Properties Q = (Properties)info.get("PROPERTIES");
|
// Make a new copy so that anything else won't muck with our database.
|
||||||
|
Properties R = (Properties)info.get("PROPERTIES");
|
||||||
|
Properties Q = new Properties();
|
||||||
|
Lifted.copyProperties(R, Q);
|
||||||
this.database.releaseReadLock();
|
this.database.releaseReadLock();
|
||||||
this.info.releaseReadLock();
|
this.info.releaseReadLock();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user