From d1569975bb18f4359fac18aa98f55b69c248a3ad Mon Sep 17 00:00:00 2001 From: "Chinthakayala, Sheshashailavas (sc2914)" Date: Mon, 28 Aug 2017 05:25:46 -0900 Subject: [CCSDK-28] populated the seed code for dgbuilder updated the code to point to the new package name for sli Change-Id: I3b5a1d05dc5193664fd4a667afdcd0b2354010a4 Issue-ID:{CCSDK-28} Signed-off-by: Chinthakayala, Sheshashailavas (sc2914) Signed-off-by: Chinthakayala, Sheshashailavas (sc2914) --- dgbuilder/nodes/dge/dgelogic/block.html | 223 ++++ dgbuilder/nodes/dge/dgelogic/block.js | 31 + dgbuilder/nodes/dge/dgelogic/breakNode.html | 161 +++ dgbuilder/nodes/dge/dgelogic/breakNode.js | 31 + dgbuilder/nodes/dge/dgelogic/call.html | 183 +++ dgbuilder/nodes/dge/dgelogic/call.js | 31 + dgbuilder/nodes/dge/dgelogic/configure.html | 227 ++++ dgbuilder/nodes/dge/dgelogic/configure.js | 31 + dgbuilder/nodes/dge/dgelogic/delete.html | 187 +++ dgbuilder/nodes/dge/dgelogic/delete.js | 31 + dgbuilder/nodes/dge/dgelogic/execute.html | 197 +++ dgbuilder/nodes/dge/dgelogic/execute.js | 31 + dgbuilder/nodes/dge/dgelogic/exists.html | 187 +++ dgbuilder/nodes/dge/dgelogic/exists.js | 31 + dgbuilder/nodes/dge/dgelogic/forNode.html | 172 +++ dgbuilder/nodes/dge/dgelogic/forNode.js | 31 + dgbuilder/nodes/dge/dgelogic/get-resource.html | 192 +++ dgbuilder/nodes/dge/dgelogic/get-resource.js | 31 + dgbuilder/nodes/dge/dgelogic/is-available.html | 186 +++ dgbuilder/nodes/dge/dgelogic/is-available.js | 31 + dgbuilder/nodes/dge/dgelogic/notify.html | 195 +++ dgbuilder/nodes/dge/dgelogic/notify.js | 31 + dgbuilder/nodes/dge/dgelogic/record.html | 185 +++ dgbuilder/nodes/dge/dgelogic/record.js | 31 + dgbuilder/nodes/dge/dgelogic/release.html | 192 +++ dgbuilder/nodes/dge/dgelogic/release.js | 31 + dgbuilder/nodes/dge/dgelogic/reserve.html | 189 +++ dgbuilder/nodes/dge/dgelogic/reserve.js | 31 + dgbuilder/nodes/dge/dgelogic/save.html | 189 +++ dgbuilder/nodes/dge/dgelogic/save.js | 31 + dgbuilder/nodes/dge/dgelogic/set.html | 162 +++ dgbuilder/nodes/dge/dgelogic/set.js | 31 + dgbuilder/nodes/dge/dgelogic/switchNode.html | 232 ++++ dgbuilder/nodes/dge/dgelogic/switchNode.js | 31 + dgbuilder/nodes/dge/dgelogic/update.html | 195 +++ dgbuilder/nodes/dge/dgelogic/update.js | 31 + dgbuilder/nodes/dge/dgemain/GenericXML.html | 140 +++ dgbuilder/nodes/dge/dgemain/GenericXML.js | 31 + dgbuilder/nodes/dge/dgemain/comment.html | 97 ++ dgbuilder/nodes/dge/dgemain/comment.js | 23 + dgbuilder/nodes/dge/dgemain/dgstart.html | 1322 ++++++++++++++++++++ dgbuilder/nodes/dge/dgemain/dgstart.js | 594 +++++++++ dgbuilder/nodes/dge/dgemain/method.html | 141 +++ dgbuilder/nodes/dge/dgemain/method.js | 31 + dgbuilder/nodes/dge/dgemain/serviceLogic.html | 125 ++ dgbuilder/nodes/dge/dgemain/serviceLogic.js | 31 + dgbuilder/nodes/dge/dgeoutcome/already-active.html | 144 +++ dgbuilder/nodes/dge/dgeoutcome/already-active.js | 31 + dgbuilder/nodes/dge/dgeoutcome/failure.html | 142 +++ dgbuilder/nodes/dge/dgeoutcome/failure.js | 31 + dgbuilder/nodes/dge/dgeoutcome/not-found.html | 142 +++ dgbuilder/nodes/dge/dgeoutcome/not-found.js | 31 + dgbuilder/nodes/dge/dgeoutcome/other.html | 143 +++ dgbuilder/nodes/dge/dgeoutcome/other.js | 31 + dgbuilder/nodes/dge/dgeoutcome/outcome.html | 143 +++ dgbuilder/nodes/dge/dgeoutcome/outcome.js | 31 + dgbuilder/nodes/dge/dgeoutcome/outcomeFalse.html | 143 +++ dgbuilder/nodes/dge/dgeoutcome/outcomeFalse.js | 31 + dgbuilder/nodes/dge/dgeoutcome/outcomeTrue.html | 142 +++ dgbuilder/nodes/dge/dgeoutcome/outcomeTrue.js | 31 + dgbuilder/nodes/dge/dgeoutcome/success.html | 141 +++ dgbuilder/nodes/dge/dgeoutcome/success.js | 31 + dgbuilder/nodes/dge/dgereturn/returnFailure.html | 170 +++ dgbuilder/nodes/dge/dgereturn/returnFailure.js | 31 + dgbuilder/nodes/dge/dgereturn/returnSuccess.html | 174 +++ dgbuilder/nodes/dge/dgereturn/returnSuccess.js | 32 + 66 files changed, 8342 insertions(+) create mode 100644 dgbuilder/nodes/dge/dgelogic/block.html create mode 100644 dgbuilder/nodes/dge/dgelogic/block.js create mode 100644 dgbuilder/nodes/dge/dgelogic/breakNode.html create mode 100644 dgbuilder/nodes/dge/dgelogic/breakNode.js create mode 100644 dgbuilder/nodes/dge/dgelogic/call.html create mode 100644 dgbuilder/nodes/dge/dgelogic/call.js create mode 100644 dgbuilder/nodes/dge/dgelogic/configure.html create mode 100644 dgbuilder/nodes/dge/dgelogic/configure.js create mode 100644 dgbuilder/nodes/dge/dgelogic/delete.html create mode 100644 dgbuilder/nodes/dge/dgelogic/delete.js create mode 100644 dgbuilder/nodes/dge/dgelogic/execute.html create mode 100644 dgbuilder/nodes/dge/dgelogic/execute.js create mode 100644 dgbuilder/nodes/dge/dgelogic/exists.html create mode 100644 dgbuilder/nodes/dge/dgelogic/exists.js create mode 100644 dgbuilder/nodes/dge/dgelogic/forNode.html create mode 100644 dgbuilder/nodes/dge/dgelogic/forNode.js create mode 100644 dgbuilder/nodes/dge/dgelogic/get-resource.html create mode 100644 dgbuilder/nodes/dge/dgelogic/get-resource.js create mode 100644 dgbuilder/nodes/dge/dgelogic/is-available.html create mode 100644 dgbuilder/nodes/dge/dgelogic/is-available.js create mode 100644 dgbuilder/nodes/dge/dgelogic/notify.html create mode 100644 dgbuilder/nodes/dge/dgelogic/notify.js create mode 100644 dgbuilder/nodes/dge/dgelogic/record.html create mode 100644 dgbuilder/nodes/dge/dgelogic/record.js create mode 100644 dgbuilder/nodes/dge/dgelogic/release.html create mode 100644 dgbuilder/nodes/dge/dgelogic/release.js create mode 100644 dgbuilder/nodes/dge/dgelogic/reserve.html create mode 100644 dgbuilder/nodes/dge/dgelogic/reserve.js create mode 100644 dgbuilder/nodes/dge/dgelogic/save.html create mode 100644 dgbuilder/nodes/dge/dgelogic/save.js create mode 100644 dgbuilder/nodes/dge/dgelogic/set.html create mode 100644 dgbuilder/nodes/dge/dgelogic/set.js create mode 100644 dgbuilder/nodes/dge/dgelogic/switchNode.html create mode 100644 dgbuilder/nodes/dge/dgelogic/switchNode.js create mode 100644 dgbuilder/nodes/dge/dgelogic/update.html create mode 100644 dgbuilder/nodes/dge/dgelogic/update.js create mode 100644 dgbuilder/nodes/dge/dgemain/GenericXML.html create mode 100644 dgbuilder/nodes/dge/dgemain/GenericXML.js create mode 100644 dgbuilder/nodes/dge/dgemain/comment.html create mode 100644 dgbuilder/nodes/dge/dgemain/comment.js create mode 100644 dgbuilder/nodes/dge/dgemain/dgstart.html create mode 100644 dgbuilder/nodes/dge/dgemain/dgstart.js create mode 100644 dgbuilder/nodes/dge/dgemain/method.html create mode 100644 dgbuilder/nodes/dge/dgemain/method.js create mode 100644 dgbuilder/nodes/dge/dgemain/serviceLogic.html create mode 100644 dgbuilder/nodes/dge/dgemain/serviceLogic.js create mode 100644 dgbuilder/nodes/dge/dgeoutcome/already-active.html create mode 100644 dgbuilder/nodes/dge/dgeoutcome/already-active.js create mode 100644 dgbuilder/nodes/dge/dgeoutcome/failure.html create mode 100644 dgbuilder/nodes/dge/dgeoutcome/failure.js create mode 100644 dgbuilder/nodes/dge/dgeoutcome/not-found.html create mode 100644 dgbuilder/nodes/dge/dgeoutcome/not-found.js create mode 100644 dgbuilder/nodes/dge/dgeoutcome/other.html create mode 100644 dgbuilder/nodes/dge/dgeoutcome/other.js create mode 100644 dgbuilder/nodes/dge/dgeoutcome/outcome.html create mode 100644 dgbuilder/nodes/dge/dgeoutcome/outcome.js create mode 100644 dgbuilder/nodes/dge/dgeoutcome/outcomeFalse.html create mode 100644 dgbuilder/nodes/dge/dgeoutcome/outcomeFalse.js create mode 100644 dgbuilder/nodes/dge/dgeoutcome/outcomeTrue.html create mode 100644 dgbuilder/nodes/dge/dgeoutcome/outcomeTrue.js create mode 100644 dgbuilder/nodes/dge/dgeoutcome/success.html create mode 100644 dgbuilder/nodes/dge/dgeoutcome/success.js create mode 100644 dgbuilder/nodes/dge/dgereturn/returnFailure.html create mode 100644 dgbuilder/nodes/dge/dgereturn/returnFailure.js create mode 100644 dgbuilder/nodes/dge/dgereturn/returnSuccess.html create mode 100644 dgbuilder/nodes/dge/dgereturn/returnSuccess.js (limited to 'dgbuilder/nodes/dge') diff --git a/dgbuilder/nodes/dge/dgelogic/block.html b/dgbuilder/nodes/dge/dgelogic/block.html new file mode 100644 index 00000000..fadf8a8c --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/block.html @@ -0,0 +1,223 @@ + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/block.js b/dgbuilder/nodes/dge/dgelogic/block.js new file mode 100644 index 00000000..4414d86d --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/block.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function block(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("block",block); + // RED.library.register("block"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/breakNode.html b/dgbuilder/nodes/dge/dgelogic/breakNode.html new file mode 100644 index 00000000..e3edef9d --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/breakNode.html @@ -0,0 +1,161 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/breakNode.js b/dgbuilder/nodes/dge/dgelogic/breakNode.js new file mode 100644 index 00000000..9b0b1b00 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/breakNode.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function breakNode(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("break",breakNode); + // RED.library.register("block"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/call.html b/dgbuilder/nodes/dge/dgelogic/call.html new file mode 100644 index 00000000..0e49e26c --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/call.html @@ -0,0 +1,183 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/call.js b/dgbuilder/nodes/dge/dgelogic/call.js new file mode 100644 index 00000000..3570e3db --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/call.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function call(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("call",call); + // RED.library.register("call"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/configure.html b/dgbuilder/nodes/dge/dgelogic/configure.html new file mode 100644 index 00000000..7503b1f1 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/configure.html @@ -0,0 +1,227 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/configure.js b/dgbuilder/nodes/dge/dgelogic/configure.js new file mode 100644 index 00000000..7345750d --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/configure.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function configure(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("configure",configure); + // RED.library.register("configure"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/delete.html b/dgbuilder/nodes/dge/dgelogic/delete.html new file mode 100644 index 00000000..b4c7f52f --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/delete.html @@ -0,0 +1,187 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/delete.js b/dgbuilder/nodes/dge/dgelogic/delete.js new file mode 100644 index 00000000..37731061 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/delete.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function deleteNode(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("delete",deleteNode); + // RED.library.register("delete"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/execute.html b/dgbuilder/nodes/dge/dgelogic/execute.html new file mode 100644 index 00000000..3d5fc6d7 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/execute.html @@ -0,0 +1,197 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/execute.js b/dgbuilder/nodes/dge/dgelogic/execute.js new file mode 100644 index 00000000..66265f98 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/execute.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function execute(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("execute",execute); + // RED.library.register("configure"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/exists.html b/dgbuilder/nodes/dge/dgelogic/exists.html new file mode 100644 index 00000000..001e8ca1 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/exists.html @@ -0,0 +1,187 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/exists.js b/dgbuilder/nodes/dge/dgelogic/exists.js new file mode 100644 index 00000000..d4482afc --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/exists.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function exists(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("exists",exists); + // RED.library.register("exists"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/forNode.html b/dgbuilder/nodes/dge/dgelogic/forNode.html new file mode 100644 index 00000000..c7327db4 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/forNode.html @@ -0,0 +1,172 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/forNode.js b/dgbuilder/nodes/dge/dgelogic/forNode.js new file mode 100644 index 00000000..567da858 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/forNode.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function forNode(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("for",forNode); + // RED.library.register("for"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/get-resource.html b/dgbuilder/nodes/dge/dgelogic/get-resource.html new file mode 100644 index 00000000..b3b65581 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/get-resource.html @@ -0,0 +1,192 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/get-resource.js b/dgbuilder/nodes/dge/dgelogic/get-resource.js new file mode 100644 index 00000000..597e0219 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/get-resource.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function getResource(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("get-resource",getResource); + // RED.library.register("get-resource"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/is-available.html b/dgbuilder/nodes/dge/dgelogic/is-available.html new file mode 100644 index 00000000..8bc45ef5 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/is-available.html @@ -0,0 +1,186 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/is-available.js b/dgbuilder/nodes/dge/dgelogic/is-available.js new file mode 100644 index 00000000..93f23f48 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/is-available.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function isAvailable(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("is-available",isAvailable); + // RED.library.register("is-available"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/notify.html b/dgbuilder/nodes/dge/dgelogic/notify.html new file mode 100644 index 00000000..e5bc24bc --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/notify.html @@ -0,0 +1,195 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/notify.js b/dgbuilder/nodes/dge/dgelogic/notify.js new file mode 100644 index 00000000..8b58e9e4 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/notify.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function notify(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("notify",notify); + // RED.library.register("configure"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/record.html b/dgbuilder/nodes/dge/dgelogic/record.html new file mode 100644 index 00000000..3eb7a2e6 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/record.html @@ -0,0 +1,185 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/record.js b/dgbuilder/nodes/dge/dgelogic/record.js new file mode 100644 index 00000000..f29bf8f5 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/record.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function record(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("record",record); + // RED.library.register("record"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/release.html b/dgbuilder/nodes/dge/dgelogic/release.html new file mode 100644 index 00000000..044616a9 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/release.html @@ -0,0 +1,192 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/release.js b/dgbuilder/nodes/dge/dgelogic/release.js new file mode 100644 index 00000000..ff03fff6 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/release.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function release(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("release",release); + // RED.library.register("release"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/reserve.html b/dgbuilder/nodes/dge/dgelogic/reserve.html new file mode 100644 index 00000000..bcd3fcb9 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/reserve.html @@ -0,0 +1,189 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/reserve.js b/dgbuilder/nodes/dge/dgelogic/reserve.js new file mode 100644 index 00000000..6aab1bd7 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/reserve.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function reserve(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("reserve",reserve); + // RED.library.register("reserve"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/save.html b/dgbuilder/nodes/dge/dgelogic/save.html new file mode 100644 index 00000000..6e022154 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/save.html @@ -0,0 +1,189 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/save.js b/dgbuilder/nodes/dge/dgelogic/save.js new file mode 100644 index 00000000..5771ae98 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/save.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function save(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("save",save); + // RED.library.register("save"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/set.html b/dgbuilder/nodes/dge/dgelogic/set.html new file mode 100644 index 00000000..bcbcae30 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/set.html @@ -0,0 +1,162 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/set.js b/dgbuilder/nodes/dge/dgelogic/set.js new file mode 100644 index 00000000..9b939507 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/set.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function set(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("set",set); + // RED.library.register("set"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/switchNode.html b/dgbuilder/nodes/dge/dgelogic/switchNode.html new file mode 100644 index 00000000..35c9fe67 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/switchNode.html @@ -0,0 +1,232 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/switchNode.js b/dgbuilder/nodes/dge/dgelogic/switchNode.js new file mode 100644 index 00000000..6a7a545d --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/switchNode.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function switchNode(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("switchNode",switchNode); + // RED.library.register("switch"); +} diff --git a/dgbuilder/nodes/dge/dgelogic/update.html b/dgbuilder/nodes/dge/dgelogic/update.html new file mode 100644 index 00000000..a7d28283 --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/update.html @@ -0,0 +1,195 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgelogic/update.js b/dgbuilder/nodes/dge/dgelogic/update.js new file mode 100644 index 00000000..f614af8b --- /dev/null +++ b/dgbuilder/nodes/dge/dgelogic/update.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function update(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("update",update); + // RED.library.register("configure"); +} diff --git a/dgbuilder/nodes/dge/dgemain/GenericXML.html b/dgbuilder/nodes/dge/dgemain/GenericXML.html new file mode 100644 index 00000000..4c9c01a6 --- /dev/null +++ b/dgbuilder/nodes/dge/dgemain/GenericXML.html @@ -0,0 +1,140 @@ + + + + + + + + diff --git a/dgbuilder/nodes/dge/dgemain/GenericXML.js b/dgbuilder/nodes/dge/dgemain/GenericXML.js new file mode 100644 index 00000000..e5fc0624 --- /dev/null +++ b/dgbuilder/nodes/dge/dgemain/GenericXML.js @@ -0,0 +1,31 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + + function GenericXML(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.xml = n.xml; + this.topic = n.topic; + } + + RED.nodes.registerType("GenericXML",GenericXML); + // RED.library.register("GenericXML"); +} diff --git a/dgbuilder/nodes/dge/dgemain/comment.html b/dgbuilder/nodes/dge/dgemain/comment.html new file mode 100644 index 00000000..c34d14c9 --- /dev/null +++ b/dgbuilder/nodes/dge/dgemain/comment.html @@ -0,0 +1,97 @@ + + + + + + + diff --git a/dgbuilder/nodes/dge/dgemain/comment.js b/dgbuilder/nodes/dge/dgemain/comment.js new file mode 100644 index 00000000..ef5f0800 --- /dev/null +++ b/dgbuilder/nodes/dge/dgemain/comment.js @@ -0,0 +1,23 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + +module.exports = function(RED) { + "use strict"; + function CommentNode(n) { + RED.nodes.createNode(this,n); + } + RED.nodes.registerType("comment",CommentNode); +} diff --git a/dgbuilder/nodes/dge/dgemain/dgstart.html b/dgbuilder/nodes/dge/dgemain/dgstart.html new file mode 100644 index 00000000..9caa841a --- /dev/null +++ b/dgbuilder/nodes/dge/dgemain/dgstart.html @@ -0,0 +1,1322 @@ + +
+ + + + + + + +
+ diff --git a/dgbuilder/nodes/dge/dgemain/dgstart.js b/dgbuilder/nodes/dge/dgemain/dgstart.js new file mode 100644 index 00000000..f2b4815e --- /dev/null +++ b/dgbuilder/nodes/dge/dgemain/dgstart.js @@ -0,0 +1,594 @@ +/** + * Copyright 2013 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ + + +module.exports = function(RED) { + "use strict"; + var util = require("util"); + var vm = require("vm"); + //var dgxml=require("/home/users/schinthakayala/nodered/sheshi/dgxml/dgxml2"); + var _=require('lodash'); + var fs=require('fs'); + var path = require('path'); + var appDir = path.dirname(require.main.filename); + var userDir = appDir + "/" + RED.settings.userDir; + var dbHost = RED.settings.dbHost; + var request = require('request'); + var sharedDir = appDir + "/" + RED.settings.sharedDir; + var xmlDir = appDir + "/" + RED.settings.xmlPath; + + //console.log("appDir:" + appDir); + //var dgeraw=fs.readFileSync(appDir + "/dge.json").toString(); + //var dgejson=JSON.parse(dgeraw); + //var uploadUrl=dgejson.slaHost + dgejson.uploadUrl; + //var slaUrl=dgejson.slaHost + dgejson.slaUrl; + //var uploadUrl=RED.settings.slaHost + RED.settings.uploadUrl; + //var slaUrl=RED.settings.slaHost + RED.settings.slaUrl; + var uploadUrl=""; + var slaUrl=""; + //console.log("Upload url: " + uploadUrl); + + function dgstart(n) { + RED.nodes.createNode(this,n); + this.name = n.name; + this.topic = n.topic; + } + + function writeHtmlToFile(fileName,str){ + var localfile = appDir + "/" + RED.settings.htmlPath + fileName; + try{ + fs.writeFileSync(localfile,str); + }catch(e){ + console.log("Error:" + e); + } + } + + function writeXmlToFile(fileName,str){ + var localfile = appDir + "/" + RED.settings.xmlPath + fileName; + try{ + fs.writeFileSync(localfile,str); + }catch(e){ + console.log("Error:" + e); + } + } + + function sendXml(fileName,res) { + var needle, localfile, data; + needle = require('needle') + localfile = appDir + "/" + RED.settings.xmlPath + fileName; + console.log("localfile:" + localfile); + data={ + uploadedfile: { file: localfile, content_type: 'text/xml' } + } + needle.post(uploadUrl, data, { multipart: true }, function(err, resp, body) { + //console.log(body) + if(resp != undefined && resp != null){ + console.log("resp Code for sendXml:" + resp.statusCode); + } + fs.unlink(localfile, function (error) { + if (error) { + console.log("Error deleting file "+localfile); + }else{ + //console.log("deleted file:" + localfile); + } + }); + + if(err){ + console.log("Error posting to slaUrl:" + slaUrl); + console.log("Error:" +err); + res.json({"error":err}); + }else{ + //console.dir(resp); + //console.log("slaUrl:" + slaUrl); + res.json({"url":slaUrl}); + } + + }); + } + + function oldsendXml(fileName) { + console.log("In sendXML for file: " + fileName); + var fileStream, formdata, localfile; + localfile = appDir + "/" + RED.settings.xmlPath + fileName; + + formdata = { + MAX_FILE_SIZE: "100000", + uploadedfile: { + options: { + contentType: 'audio/mpeg' + } + } + + }; + + console.log("Attempting to upload file: " + localfile); + console.log("Sending to: " + uploadUrl); + formdata.uploadedfile.value = fs.createReadStream(localfile); + fileStream = formdata.uploadedfile.value; + +//console.log("Formdata:"); +//console.dir(formdata); + + request.post({ + url: uploadUrl, + proxy: false, + formData: formdata + }, function(err, resp, body) { + fileStream.close(); + console.log("err: " + err); + return console.log("body: " + body); + }); + + }; + + RED.nodes.registerType("dgstart",dgstart); +/* + RED.httpAdmin.post("/uploadxml", function(req,res) { + console.dir(req); + console.log("USER:" + req.user); + console.log("Got request to upload xml to SDN-C."); + console.log("Requested filename to upload: " + req.params.fileName); + console.log("Requested xml to upload: " + req.params.xmlStr); + writeToFile( req.params.fileName,req.params.xmlStr); + + sendXml(req.params.fileName,res); + // res.send("Attempt complete."); + // res.redirect(slaUrl); + }); +*/ + + RED.httpAdmin.post("/OldUploadxml", function(req,res) { + //console.dir(req); + //console.log("USER:" + req.user); + var qs = require('querystring'); + var body = ''; + req.on('data', function (data) { + body += data; + // Too much POST data, kill the connection! + /*if (body.length > 1e6) + request.connection.destroy(); + */ + }); + req.on('end', function () { + //console.log("BODY:" + body); + var d = new Date().getTime(); + var user = req.user; + var fileName= user + "_" + d +".xml"; + var post = qs.parse(body); + //console.log(JSON.stringify(post)); + // use post['blah'], etc. + var localfile = appDir + "/" + RED.settings.xmlPath + fileName; + //console.log("localfile:" + localfile); + var xmlStr = post['flowXml']; + writeXmlToFile(fileName,xmlStr); + sendXml(fileName,res); + + }); + + }); + + RED.httpAdmin.post("/uploadxml", function(req,res) { + //console.dir(req); + //console.log("USER:" + req.user); + var qs = require('querystring'); + var body = ''; + req.on('data', function (data) { + body += data; + // Too much POST data, kill the connection! + /*if (body.length > 1e6) + request.connection.destroy(); + */ + }); + req.on('end', function () { + //console.log("BODY:" + body); + var d = new Date().getTime(); + var user = req.user; + var fileName= user + "_" + d +".xml"; + var post = qs.parse(body); + //console.log(JSON.stringify(post)); + // use post['blah'], etc. + var localfile = appDir + "/" + RED.settings.xmlPath + fileName; + //console.log("localfile:" + localfile); + var xmlStr = post['flowXml']; + var moduleName = post['module']; + var rpc = post['rpc']; + writeXmlToFile(fileName,xmlStr); + uploadDG(localfile,moduleName,rpc,res); + }); + + }); + + +function uploadDG(filePath,moduleName,rpc,res){ + console.log("called uploadDG..."); + var exec = require('child_process').exec; + var commandToExec = appDir + "/svclogic/svclogic.sh load " + filePath + " " + userDir + "/conf/svclogic.properties"; + console.log("commandToExec:" + commandToExec); + var child = exec(commandToExec ,function (error,stdout,stderr){ + //console.log(error); + console.log("stdout:" + stdout); + console.log("stderr:" + stderr); + if(error){ + console.log("Error occured:" + error); + if(stderr){ + //console.log("stderr:" + stderr); + res.send(500,{'error':error,'stderr':stderr}); + }else{ + res.send(500,{'error':error}); + } + //console.log("stdout :" + stdout); + }else{ + if(stdout ){ + //console.log("output:" + stdout); + if(stdout.indexOf('Compiler error') != -1){ + //console.log("compileError occured."); + + var resp = { + 'stdout':stdout, + 'stderr':"COMPILE_ERROR", + 'url':dbHost, + 'module':moduleName, + 'rpc':rpc + } + res.send(500,resp); + }else{ + res.send(200,{'stdout':stdout,'stderr':stderr,"url":dbHost,"module" : moduleName,"rpc" : rpc}); + } + } + if(stderr && !stdout){ + //console.log("stderr:" + stderr); + if(stderr.indexOf("Saving SvcLogicGraph to database") != -1){ + res.send(200,{'error':error,'stdout' :'','stderr':stderr,"url":dbHost,"module" : moduleName,"rpc" : rpc}); + }else{ + res.send(500,{'error':error,'stdout' :'','stderr':stderr}); + } + } + } + }); +} + + RED.httpAdmin.get("/displayXml", function(req,res) { + var _module = req.query._module; + var rpc = req.query.rpc; + var version = req.query.version; + var mode = req.query.mode; + var d = new Date().getTime(); + displayXml(_module,rpc,version,mode,res); + }); + +function displayXml(_module,rpc,version,mode,res){ + var exec = require('child_process').exec; + var msg = { + '_module' : _module, + 'rpc' : rpc, + 'version' : version, + 'mode' : mode + } + var commandToExec = appDir + "/svclogic/svclogic.sh get-source " + _module + " " + + rpc + " " + mode + " " + version + " " + userDir + "/conf/svclogic.properties"; + console.log("commandToExec:" + commandToExec); + var child = exec(commandToExec ,{'maxBuffer':16*1024*1024},function (error,stdout,stderr){ + if(error){ + console.log("Error occured:" + error); + if(stderr){ + //console.log("stderr:" + stderr); + res.send(500,{'error':error,'stderr':stderr,'msg':msg}); + }else{ + res.send(500,{'error':error,'msg':msg}); + } + }else{ + if(stderr){ + console.log("stderr:" + stderr); + } + if(stdout){ + res.send({'xmldata' : "" + stdout + ""}); + } + } + }); +} + + + RED.httpAdmin.post("/downloadDGXml", function(req,res) { + //console.dir(req); + var qs = require('querystring'); + var body = ''; + req.on('data', function (data) { + body += data; + }); + + req.on('end', function () { + var post = qs.parse(body); + var _module = post._module; + var rpc = post.rpc; + var version = post.version; + var mode = post.mode; + var d = new Date().getTime(); + downloadDGXml(_module,rpc,version,mode,res); + }); + }); + +function downloadDGXml(_module,rpc,version,mode,res){ + var exec = require('child_process').exec; + var msg = { + '_module' : _module, + 'rpc' : rpc, + 'version' : version, + 'mode' : mode + } + var commandToExec = appDir + "/svclogic/svclogic.sh get-source " + _module + " " + + rpc + " " + mode + " " + version + " " + userDir + "/conf/svclogic.properties"; + console.log("commandToExec:" + commandToExec); + var child = exec(commandToExec ,function (error,stdout,stderr){ + if(error){ + console.log("Error occured:" + error); + if(stderr){ + //console.log("stderr:" + stderr); + res.send(500,{'error':error,'stderr':stderr,'msg':msg}); + }else{ + res.send(500,{'error':error,'msg':msg}); + } + }else{ + if(stderr){ + console.log("stderr:" + stderr); + } + if(stdout){ + //console.log("output:" + stdout); + //var newOutput = "
" + stdout.replace(/\n/g,'
') + "
"; + //res.json({'stdout': stdout ,'stderr':stderr,"msg":msg}); + //res.set('Content-Type', 'text/xml'); + //res.set('Content-Type', 'application/octet-stream'); + //res.end("" + stdout + "" ); + //var newOutput ="" + stdout + ""; + //res.send(new Buffer( "" + newOutput + "" ) ); + //res.send(newOutput); + + /* + var xslStr = '' + + '' + + '' + + '' + + '' + + '' + + '' + + ''; + */ + + var formatted_date = getCurrentDate(); + var fileName= "db_" + _module + "_" +rpc+ "_" + version + "_" + formatted_date + ".html"; + var file = xmlDir + "/" + fileName; + var xmlStr = '' + stdout + ""; + //var xmlStr = "/g,">"); + //xmlStr = xmlStr.replace(/\n>/g,"
"); + //xmlStr = xmlStr.replace(/\t>/g,"   "); + + writeToFile(file,"" +xmlStr+ ""); + //console.log("xmlStr:" + xmlStr); + res.setHeader('Content-disposition', 'attachment; filename=' + file); + //res.setHeader('Content-type', 'text/html'); + res.setHeader('Content-type', 'text/xml'); + res.download(file); + } + } + }); +} + + + RED.httpAdmin.get("/displayAsGv", function(req,res) { + var _module = req.query._module; + var rpc = req.query.rpc; + var version = req.query.version; + var mode = req.query.mode; + var d = new Date().getTime(); + displayAsGv(_module,rpc,version,mode,res); + }); + +function displayAsGv(_module,rpc,version,mode,res){ + var exec = require('child_process').exec; + var msg = { + '_module' : _module, + 'rpc' : rpc, + 'version' : version, + 'mode' : mode + } + var commandToExec = appDir + "/svclogic/svclogic.sh print " + + _module + " " + rpc + " " + mode + " " + version + " " + //+ userDir + "/conf/svclogic.properties | dot -Tpng "; + //the label="""" is giving an error so replacing it with "null" + + userDir + "/conf/svclogic.properties |sed -e 's%label=\"\"\"\"%label=\"null\"%g'| dot -Tsvg "; + console.log("commandToExec:" + commandToExec); + //+ userDir + "/conf/svclogic.properties | dot -Tsvg "; + //var child = exec(commandToExec ,function (error,stdout,stderr){ + //var child = exec(commandToExec ,{maxBuffer:16*1024*1024},function (error,stdout,stderr){ + //var child = exec(commandToExec ,{encoding:'base64',maxBuffer:20*1024*1024},function (error,stdout,stderr){ + var child = exec(commandToExec ,{maxBuffer:20*1024*1024},function (error,stdout,stderr){ + if(error){ + console.log("Error occured:" + error); + if(stderr){ + console.log("stderr:" + stderr); + res.send(500,{'error':error,'stderr':stderr,"msg":msg}); + }else{ + res.send(500,{'error':error,"msg":msg}); + } + }else{ + if(stderr){ + console.log("stderr:" + stderr); + //To convert base64 to ascii + //console.log(new Buffer(stderr, 'base64').toString('ascii')); + } + if(stdout){ + //console.log(stdout.length); + //console.log("output:" + stdout); + //var svg_html = stdout ; + //var image = ""; + //var image = "