projects
/
jSite.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
version 0.5: show usk keys only, update usk on insert completion
[jSite.git]
/
src
/
de
/
todesbaum
/
jsite
/
main
/
Configuration.java
diff --git
a/src/de/todesbaum/jsite/main/Configuration.java
b/src/de/todesbaum/jsite/main/Configuration.java
index
3931dcb
..
9b43784
100644
(file)
--- a/
src/de/todesbaum/jsite/main/Configuration.java
+++ b/
src/de/todesbaum/jsite/main/Configuration.java
@@
-44,7
+44,7
@@
import de.todesbaum.util.xml.XML;
/**
* @author David Roden <droden@gmail.com>
/**
* @author David Roden <droden@gmail.com>
- * @version $Id
: Configuration.java 418 2006-03-29 17:49:16Z bombe
$
+ * @version $Id$
*/
public class Configuration {
*/
public class Configuration {
@@
-171,18
+171,42
@@
public class Configuration {
return Boolean.parseBoolean(nodeValue);
}
return Boolean.parseBoolean(nodeValue);
}
+ /**
+ * Returns the hostname of the node.
+ * @return The hostname of the node
+ * @deprecated Use {@link #getSelectedNode()} instead
+ */
+ @Deprecated
public String getNodeAddress() {
return getNodeValue(new String[] { "node-address" }, "localhost");
}
public String getNodeAddress() {
return getNodeValue(new String[] { "node-address" }, "localhost");
}
+ /**
+ * Sets the hostname of the node.
+ * @param nodeAddress The hostname of the node
+ * @deprecated Use {@link #setSelectedNode(Node)} instead
+ */
+ @Deprecated
public void setNodeAddress(String nodeAddress) {
rootNode.replace("node-address", nodeAddress);
}
public void setNodeAddress(String nodeAddress) {
rootNode.replace("node-address", nodeAddress);
}
+ /**
+ * The port number of the node
+ * @return The port number of the node
+ * @deprecated Use {@link #getSelectedNode()} instead.
+ */
+ @Deprecated
public int getNodePort() {
return getNodeIntValue(new String[] { "node-port" }, 9481);
}
public int getNodePort() {
return getNodeIntValue(new String[] { "node-port" }, 9481);
}
+ /**
+ * Sets the port number of the node.
+ * @param nodePort The port number of the node
+ * @deprecated Use {@link #setSelectedNode(Node)} instead
+ */
+ @Deprecated
public void setNodePort(int nodePort) {
rootNode.replace("node-port", String.valueOf(nodePort));
}
public void setNodePort(int nodePort) {
rootNode.replace("node-port", String.valueOf(nodePort));
}
@@
-305,6
+329,10
@@
public class Configuration {
if (nodesNode == null) {
String hostname = getNodeAddress();
int port = getNodePort();
if (nodesNode == null) {
String hostname = getNodeAddress();
int port = getNodePort();
+ if (hostname == null) {
+ hostname = "127.0.0.1";
+ port = 9481;
+ }
return new Node[] { new Node(hostname, port, "Node") };
}
SimpleXML[] nodeNodes = nodesNode.getNodes("node");
return new Node[] { new Node(hostname, port, "Node") };
}
SimpleXML[] nodeNodes = nodesNode.getNodes("node");
@@
-344,7
+372,13
@@
public class Configuration {
public Node getSelectedNode() {
SimpleXML selectedNodeNode = rootNode.getNode("selected-node");
if (selectedNodeNode == null) {
public Node getSelectedNode() {
SimpleXML selectedNodeNode = rootNode.getNode("selected-node");
if (selectedNodeNode == null) {
- return null;
+ String hostname = getNodeAddress();
+ int port = getNodePort();
+ if (hostname == null) {
+ hostname = "127.0.0.1";
+ port = 9481;
+ }
+ return new Node(hostname, port, "Node");
}
String name = selectedNodeNode.getNode("name").getValue();
String hostname = selectedNodeNode.getNode("hostname").getValue();
}
String name = selectedNodeNode.getNode("name").getValue();
String hostname = selectedNodeNode.getNode("hostname").getValue();