agent client/server doc: service creation
authorLuc Yriarte <luc.yriarte@intel.com>
Wed, 20 Mar 2013 11:15:56 +0000 (12:15 +0100)
committerLuc Yriarte <luc.yriarte@intel.com>
Wed, 20 Mar 2013 11:15:56 +0000 (12:15 +0100)
doc/agent/CREDENTIALS [new file with mode: 0644]
doc/agent/WHITELIST [new file with mode: 0644]
doc/agent/client.html [new file with mode: 0644]
doc/agent/client.sh [new file with mode: 0755]
doc/agent/server.html [new file with mode: 0644]
doc/agent/server.sh [new file with mode: 0755]

diff --git a/doc/agent/CREDENTIALS b/doc/agent/CREDENTIALS
new file mode 100644 (file)
index 0000000..61e3cfa
--- /dev/null
@@ -0,0 +1,3 @@
+{
+       "cloudeebus": "secret"
+}
diff --git a/doc/agent/WHITELIST b/doc/agent/WHITELIST
new file mode 100644 (file)
index 0000000..a7c3561
--- /dev/null
@@ -0,0 +1,3 @@
+[
+               "org.cloudeebus.Sample"
+]
diff --git a/doc/agent/client.html b/doc/agent/client.html
new file mode 100644 (file)
index 0000000..1d4dbdc
--- /dev/null
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../../lib/autobahn.min.js"></script>
+        <script src="../../cloudeebus/cloudeebus.js"></script>
+        <script type="text/javascript">
+               function evalScript() {
+                       eval(
+                               "var lambda = function() {" +
+                                       document.getElementById('script').value +
+                               "};" + 
+                               "lambda();"
+                       );
+               }
+        </script>
+    </head>
+   <body>
+        <center><h1>cloudeebus</h1></center>
+        <br>
+               <textarea style="width:80%" rows="32" id="script">
+var manifest = {
+       name: "cloudeebus",
+       key: "secret",
+       permissions: [
+               "org.cloudeebus.Sample"
+       ]
+};
+
+cloudeebus.log = function(msg) {
+  document.getElementById("log").innerHTML += msg + "\n";
+}
+
+function logCB(result) {
+  cloudeebus.log(JSON.stringify(result));
+}
+
+function errorCB(error) {
+  cloudeebus.log(error.desc ? error.desc : error);
+}
+
+function connectSuccess() {
+  cloudeebus.SessionBus().getObject("org.cloudeebus.Sample", "/org/cloudeebus/Sample", logCB, errorCB);
+}
+
+cloudeebus.connect("ws://localhost:9002", manifest, connectSuccess, errorCB);
+</textarea>
+               <br>
+               <input type="button" value="run script" onclick="evalScript()"/>
+               <input type="button" value="clear log" onclick="document.getElementById('log').innerHTML='';"/>
+               <br>
+               <pre id="log" style="height: 20em; overflow-x: auto; overflow-y: auto; background-color: #faa;"></pre>
+   </body>
+</html>
diff --git a/doc/agent/client.sh b/doc/agent/client.sh
new file mode 100755 (executable)
index 0000000..5782641
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+cloudeebus.py -d -c ./CREDENTIALS -w ./WHITELIST -p 9002
diff --git a/doc/agent/server.html b/doc/agent/server.html
new file mode 100644 (file)
index 0000000..9468bf6
--- /dev/null
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../../lib/autobahn.min.js"></script>
+        <script src="../../cloudeebus/cloudeebus.js"></script>
+        <script type="text/javascript">
+               function evalScript() {
+                       eval(
+                               "var lambda = function() {" +
+                                       document.getElementById('script').value +
+                               "};" + 
+                               "lambda();"
+                       );
+               }
+        </script>
+    </head>
+   <body>
+        <center><h1>cloudeebus</h1></center>
+        <br>
+               <textarea style="width:80%" rows="32" id="script">
+cloudeebus.log = function(msg) {
+  document.getElementById("log").innerHTML += msg + "\n";
+}
+
+function logCB(result) {
+  cloudeebus.log(JSON.stringify(result));
+}
+
+function errorCB(error) {
+  cloudeebus.log(error.desc ? error.desc : error);
+}
+
+function connectSuccess() {
+  cloudeebus.SessionBus().addService("org.cloudeebus.Sample", logCB, errorCB);
+}
+
+cloudeebus.connect("ws://localhost:9003", null, connectSuccess, errorCB);
+</textarea>
+               <br>
+               <input type="button" value="run script" onclick="evalScript()"/>
+               <input type="button" value="clear log" onclick="document.getElementById('log').innerHTML='';"/>
+               <br>
+               <pre id="log" style="height: 20em; overflow-x: auto; overflow-y: auto; background-color: #faa;"></pre>
+   </body>
+</html>
diff --git a/doc/agent/server.sh b/doc/agent/server.sh
new file mode 100755 (executable)
index 0000000..fca98ca
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+cloudeebus.py -d -o -p 9003