aboutsummaryrefslogtreecommitdiffstats
path: root/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java
diff options
context:
space:
mode:
authorZandra Hird <[email protected]>2015-04-27 16:37:27 +0200
committerZandra Hird <[email protected]>2015-04-27 16:37:27 +0200
commit861145a503c77d8144033f38d288bdda31699edd (patch)
treebb7c4578d2acea7e6f2460ae4248314d2070417d /lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java
parent9d46162f7a670a4b403a82ebb5600c95bb278529 (diff)
parentfd76d49c7d7bbed4775818390e47b958ee50f469 (diff)
downloadotp-861145a503c77d8144033f38d288bdda31699edd.tar.gz
otp-861145a503c77d8144033f38d288bdda31699edd.tar.bz2
otp-861145a503c77d8144033f38d288bdda31699edd.zip
Merge branch 'x0id/jinterface_transport_factory'
* x0id/jinterface_transport_factory: jinterface: transport factory implementation fix typo error from recent merge OTP-12686
Diffstat (limited to 'lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java')
-rw-r--r--lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java46
1 files changed, 41 insertions, 5 deletions
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java
index 6f07d8171e..0a33984b31 100644
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java
@@ -64,13 +64,14 @@ import java.net.UnknownHostException;
* instead.
* </p>
*/
-public class AbstractNode {
+public class AbstractNode implements OtpTransportFactory {
static String localHost = null;
String node;
String host;
String alive;
String cookie;
static String defaultCookie = null;
+ final OtpTransportFactory transportFactory;
// Node types
static final int NTYPE_R6 = 110; // 'n' post-r5, all nodes
@@ -146,21 +147,41 @@ public class AbstractNode {
}
}
- protected AbstractNode() {
+ protected AbstractNode(final OtpTransportFactory transportFactory) {
+ this.transportFactory = transportFactory;
}
/**
- * Create a node with the given name and the default cookie.
+ * Create a node with the given name and default cookie and transport
+ * factory.
*/
protected AbstractNode(final String node) {
- this(node, defaultCookie);
+ this(node, defaultCookie, new OtpSocketTransportFactory());
}
/**
- * Create a node with the given name and cookie.
+ * Create a node with the given name, transport factory and the default
+ * cookie.
+ */
+ protected AbstractNode(final String node,
+ final OtpTransportFactory transportFactory) {
+ this(node, defaultCookie, transportFactory);
+ }
+
+ /**
+ * Create a node with the given name, cookie and default transport factory.
*/
protected AbstractNode(final String name, final String cookie) {
+ this(name, cookie, new OtpSocketTransportFactory());
+ }
+
+ /**
+ * Create a node with the given name, cookie and transport factory.
+ */
+ protected AbstractNode(final String name, final String cookie,
+ final OtpTransportFactory transportFactory) {
this.cookie = cookie;
+ this.transportFactory = transportFactory;
final int i = name.indexOf('@', 0);
if (i < 0) {
@@ -268,4 +289,19 @@ public class AbstractNode {
}
return home;
}
+
+ public OtpTransport createTransport(final String addr, final int port)
+ throws IOException {
+ return transportFactory.createTransport(addr, port);
+ }
+
+ public OtpTransport createTransport(final InetAddress addr, final int port)
+ throws IOException {
+ return transportFactory.createTransport(addr, port);
+ }
+
+ public OtpServerTransport createServerTransport(final int port)
+ throws IOException {
+ return transportFactory.createServerTransport(port);
+ }
}