*/
public static Preferences loadArgs(String[] args) {
try {
// user: See $HOME/.java/.userPrefs
// root: See /opt/j2sdk1.4.2_06/jre/.systemPrefs/prefs.xml
Preferences prefs = Preferences.userRoot();
prefs.clear();
// ---- Database settings -----
String driverClass = System.getProperty("jdbc.drivers", "org.hsqldb.jdbcDriver:oracle.jdbc.driver.OracleDriver:com.microsoft.jdbc.sqlserver.SQLServerDriver:org.postgresql.Driver");
// String dbUrl = System.getProperty("db.url", "jdbc:oracle:thin:@localhost:1521:orcl");
String dbUrl = System.getProperty("db.url", "jdbc:postgresql:test//localhost/test");
// String dbUser = System.getProperty("db.user", "system");
String dbUser = System.getProperty("db.user", "postgres");
String dbPassword = System.getProperty("db.password", "");
prefs.put("jdbc.drivers", driverClass);
prefs.put("db.url", dbUrl);
prefs.put("db.user", dbUser);
prefs.put("db.password", dbPassword);
// ---- Mom settings -----
/*
prefs.put("mom.connectQos",
"<qos>" +
" <securityService type='htpasswd' version='1.0'>" +
" <![CDATA[" +
" <user>michele</user>" +
" <passwd>secret</passwd>" +
" ]]>" +
" </securityService>" +
" <session name='joe/3'/>'" +
" <address type='SOCKET'>" +
" socket://192.168.110.10:7607" +
" </address>" +
" </qos>");
System.setProperty("protocol", "SOCKET");
System.setProperty("protocol/socket/hostname", "192.168.110.10");
*/
// ----- Other DbWriter settings -----
// prefs.put("mom.subscribeKey", "<key oid='' queryType='XPATH'>//key</key>");
String subscribeKey = System.getProperty("mom.subscribeKey", "<key oid='transaction'/>");
prefs.put("mom.subscribeKey", subscribeKey);
prefs.put("mom.subscribeQos", "<qos><initialUpdate>false</initialUpdate><multiSubscribe>false</multiSubscribe><persistent>true</persistent></qos>");
prefs.put("dbWriter.writer.class", "org.xmlBlaster.contrib.replication.ReplicationWriter");
setPref("example.sleep", "0L", prefs);
// setPref("pingInterval", "10000L", prefs);
// setPref("retries", ".-1", prefs);
// setPref("delay", ".4000", prefs);
setPref("dispatch/callback/retries", ".-1", prefs);
setPref("dispatch/callback/delay", ".10000", prefs);
setPref("queue/callback/maxEntries", "10000", prefs);
for (int i=0; i<args.length-1; i++) {
if (args[i].startsWith("-")) {
prefs.put(args[i].substring(1), args[++i]);
}
}
prefs.flush();
// Log output:
//prefs.exportSubtree(System.out);
return prefs;
}