Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit 508d13d19327df1b011690049710e24b1b151609 0 parents
@videlalvaro authored
4 .gitignore
@@ -0,0 +1,4 @@
+pom.xml
+*jar
+lib
+classes
15 README
@@ -0,0 +1,15 @@
+# erlang
+
+FIXME: write description
+
+## Usage
+
+FIXME: write
+
+## Installation
+
+FIXME: write
+
+## License
+
+FIXME: write
4 project.clj
@@ -0,0 +1,4 @@
+(defproject erlang "1.0.0-SNAPSHOT"
+ :description "FIXME: write"
+ :dependencies [[org.clojure/clojure "1.1.0"]
+ [org.clojure/clojure-contrib "1.1.0"]])
59 src/erlang/core.clj
@@ -0,0 +1,59 @@
+(ns erlang.core
+ (:import (com.ericsson.otp.erlang
+ OtpNode
+ OtpSelf
+ OtpErlangList
+ OtpErlangObject
+ OtpPeer)))
+
+(defn otp-node
+ "Creates an OtpNode"
+ [node-name]
+ (OtpNode. node-node))
+
+
+(defn otp-mbox
+ "Creates an OtpMbox"
+ ([node]
+ (. node createMbox))
+ ([node name]
+ (. node createMbox name)))
+
+(defn otp-register-name
+ "Registers the mbox name"
+ [mbox name]
+ (. mbox registerName name))
+
+(defn otp-ping
+ "Pings a remote Erlang node"
+ [node remote tmo]
+ (. node ping remote tmo))
+
+(defn otp-self
+ "Creates OtpSelf with name & cookie"
+ ([node-name]
+ (OtpSelf. node-name))
+ ([node-name cookie]
+ (OtpSelf. node-name cookie)))
+
+(defn otp-peer
+ "Initializes peer"
+ [name]
+ (OtpPeer. name))
+
+(defn connect
+ "Connects to Erlang node"
+ [s peer]
+ (. s connect peer))
+
+(defn otp-rpc-call
+ "Performs a RPC call to remote node"
+ ([connection m f]
+ (. connection sendRPC m f (OtpErlangList.)))
+ ([connection m f a]
+ (. connection sendRPC m f a)))
+
+(defn otp-receive
+ "Receive result from RPC call"
+ [connection]
+ (. connection receiveRPC))
17 test.clj
@@ -0,0 +1,17 @@
+(import '(com.ericsson.otp.erlang
+ OtpSelf
+ OtpErlangList
+ OtpErlangObject
+ OtpPeer))
+
+(def self (new OtpSelf "client"))
+
+(def other (new OtpPeer "a"))
+
+(def other (new OtpPeer "a@mrhyde"))
+
+(def connection (. self connect other))
+
+(. connection sendRPC "erlang" "date" (new OtpErlangList))
+
+(def received (. connection receiveRPC))
6 test/erlang/core_test.clj
@@ -0,0 +1,6 @@
+(ns erlang.core-test
+ (:use [erlang.core] :reload-all)
+ (:use [clojure.test]))
+
+(deftest replace-me ;; FIXME: write
+ (is false))
Please sign in to comment.
Something went wrong with that request. Please try again.