]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcExecutionMessage.js
Agent Launcher implementation
[gpl/argeo-slc.git] / org.argeo.slc.webapp / src / main / webapp / argeo-ria-lib / slc / class / org / argeo / slc / ria / SlcExecutionMessage.js
1 /**
2 * A generic JMS slcExecution message encapsulator.
3 */
4 qx.Class.define("org.argeo.slc.ria.SlcExecutionMessage", {
5 extend : qx.core.Object,
6 construct : function(uuid){
7 this.base(arguments);
8 this.setUuid(uuid);
9 },
10 properties : {
11 /**
12 * The unique id identifying the message
13 */
14 uuid : {
15 check : "String"
16 },
17 /**
18 * Execution status
19 */
20 status : {
21 check : "String",
22 init : "STARTED"
23 },
24 /**
25 * Execution type
26 */
27 type : {
28 check : "String",
29 init : "slcAnt"
30 },
31 /**
32 * Execution Host
33 */
34 host : {
35 check : "String",
36 init : "localhost"
37 },
38 /**
39 * Execution User
40 */
41 user : {
42 check : "String",
43 init : "user"
44 },
45 /**
46 * Additionnal attributes as map of key/values
47 */
48 attributes : {
49 check : "Map",
50 init : {}
51 }
52 },
53 members : {
54
55 addAttribute: function(attName, attValue){
56 var attr = this.getAttributes();
57 attr[attName] = attValue;
58 this.setAttributes(attr);
59 },
60 /**
61 * Build the xml formatted message body to send
62 *
63 * @return {String} The message content as Xml
64 */
65 toXml : function (){
66 var builder = new qx.util.StringBuilder();
67 builder.add('<slc-execution uuid="'+this.getUuid()+'">');
68 builder.add('<slc-status>'+this.getStatus()+'</slc-status>');
69 builder.add('<slc-type>'+this.getType()+'</slc-type>');
70 builder.add('<slc-host>'+this.getHost()+'</slc-host>');
71 builder.add('<slc-user>'+this.getUser()+'</slc-user>');
72 var attr = this.getAttributes();
73 if(qx.lang.Object.getLength(attr)){
74 builder.add('<slc-attributes>');
75 for(var key in attr){
76 builder.add('<slc-attribute name="'+key+'">'+attr[key]+'</slc-attribute>');
77 }
78 builder.add('</slc-attributes>');
79 }
80 builder.add('</slc-execution>');
81 return builder.get();
82 }
83 }
84 });