/* Hypermedia workflow. 
 ** Amqp task executor which submits commands as amqp messages.
 ** This executor is based on executor_simple made by Bartosz Balis
 ** Author: Maciej Palwik
 */
var fs = require('fs'),
    xml2js = require('xml2js'),
    spawn = require('child_process').spawn,
    amqp = require('amqp'),
    uuid = require('uuid');

exports.init = function() {

    //////////////////////////////////////////////////////////////////////////
    /////////////////////////////// data /////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////



    //////////////////////////////////////////////////////////////////////////
    ///////////////////////// public functions ///////////////////////////////
    //////////////////////////////////////////////////////////////////////////

    function public_execute(task, server, cb) {
        var args = [server, 'cd', 'montage-working/0.5/input', ';', task['@'].name, task.argument];

	var proc = spawn('ssh', args);
	proc.stdout.on('data', function(data) {
		console.log(task['@'].name + '-'+ task['@'].id + ' stdout:' + data);
	});
	proc.stderr.on('data', function(data) {
		console.log(task['@'].name + '-'+ task['@'].id + ' stdout:' + data);
	});
	proc.on('exit', function(code) {
		console.log(task['@'].name + '-'+ task['@'].id + ' stdout:' + code);
		cb(null, code);
	});
	
	//this seems unnecessary
	setTimeout(function() {

	}, 1000);
    }
    

    return {
        execute: public_execute,
    };

};

@@ -920,401 +920,56 @@
  %7B%0D%0A
-        var args = %5Bserver, 'cd', 'montage-working/0.5/input', ';', task%5B'@'%5D.name, task.argument%5D;%0D%0A%0D%0A%09var proc = spawn('ssh', args);%0D%0A%09proc.stdout.on('data', function(data) %7B%0D%0A%09%09console.log(task%5B'@'%5D.name + '-'+ task%5B'@'%5D.id + ' stdout:' + data);%0D%0A%09%7D);%0D%0A%09proc.stderr.on('data', function(data) %7B%0D%0A%09%09console.log(task%5B'@'%5D.name + '-'+ task%5B'@'%5D.id + ' stdout:' + data);%0D%0A%09%7D);%0D%0A%09proc.on('exit', 
+%09%0D%0A//    %09console.log(task)%0D%0A    %09%0D%0A%09setTimeout(
 func
@@ -977,20 +977,16 @@
 ion(
-code
 ) %7B%0D%0A%09%09c
 onso
@@ -985,158 +985,31 @@
 %0A%09%09c
-onsole.log(task%5B'@'%5D.name + '-'+ task%5B'@'%5D.id + ' stdout:' + code);%0D%0A%09%09cb(null, code);%0D%0A%09%7D);%0D%0A%09%0D%0A%09//this seems unnecessary%0D%0A%09setTimeout(function() %7B%0D%0A
+b(null, 'some output');
 %0D%0A%09%7D
@@ -1022,20 +1022,17 @@
 );%0D%0A
+%09%0D%0A
     %7D%0D
-%0A    %0D
 %0A%0D%0A 

Remove old parts of executor_simple