else if (verbose)
System.out.println("update rar \"" + rarName +
"\" with \"" + raProperties + "\"");
// create Map of properties
Map map = new Hashtable();
Hashtable prop = null;
String nodeName = null;
line = lnr.readLine();
while (line != null) {
if (line.startsWith("[")) {
prop = new Hashtable();
nodeName = line.substring(line.indexOf("[")+1,line.indexOf("]"));
map.put(nodeName.trim(),prop);
} else {
StringTokenizer st = new StringTokenizer(line);
if (st.countTokens() == 2 && prop != null) {
prop.put(st.nextToken(),st.nextToken());
}
}
line = lnr.readLine();
}
file.close();
if (debug)
System.out.println("RAConfig.updateRAR : map = " + map);
// create ra.xml file with new values
File rarFile = new File(rarName);
if (rarFile.exists()) {
ZipFile zipFile = new ZipFile(rarFile.getAbsolutePath());
for (Enumeration zippedFiles = zipFile.entries(); zippedFiles.hasMoreElements(); ) {
// Retrieve entry of existing files
ZipEntry currEntry = (ZipEntry) zippedFiles.nextElement();
if (debug)
System.out.println("RAConfig.updateRAR : currEntry = " + currEntry);
if (currEntry.getName().equalsIgnoreCase(RA_XML)) {
InputStream reader = zipFile.getInputStream(currEntry);
createFile("ra.xml",update(reader,map));
reader.close();
break;
}
}
zipFile.close();
}
// update rar
updateZIP(rarName,RA_XML, tmpDir + "ra.xml",RA_XML);
if (updateA3servers) {
// update a3servers.xml (host and port).
prop = (Hashtable) map.get("org.objectweb.joram.client.connector.JoramAdapter");
if (prop != null) {
if (debug)
System.out.println("RAConfig.updateRAR : prop = " + prop);
String host = (String) prop.get("HostName");
short serverId = -1;
String sid = (String) prop.get("ServerId");
if (sid != null)
serverId = new Short(sid).shortValue();
else {
if (debug)
System.out.println("RAConfig.updateRAR : ServerId not found in ra.properties");
}
String port = (String) prop.get("ServerPort");
if (host != null && host.length() > 0
&& port != null && port.length() > 0
&& serverId >= 0) {
updateA3Servers(rarName,host,port,serverId);
}