Advertisement
Guest User

Untitled

a guest
Jun 14th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //@req(nodeGroup, name, port)
  2.  
  3. import com.hivext.api.development.Scripting;
  4.  
  5. var APPID = getParam("TARGET_APPID"),
  6.     SESSION = getParam("session"),
  7.     PROTOCOL = getParam("protocol", "TCP"),
  8.     oEnvInfo,
  9.     nNodesCount,
  10.     oResp,
  11.     i;
  12.  
  13. oScripting =  new Scripting({
  14.     serverUrl : "http://" + window.location.host.replace("app", "appstore") + "/",
  15.     session : SESSION
  16. });
  17.  
  18. oEnvInfo = jelastic.environment.control.GetEnvInfo(APPID, session);
  19.  
  20. if (oEnvInfo.result !== 0) {
  21.     return oEnvInfo;
  22. }
  23.  
  24. nNodesCount = oEnvInfo.nodes.length;
  25.  
  26. for (i = 0; i < nNodesCount; i += 1) {
  27.     if (oEnvInfo.nodes[i].nodeGroup == nodeGroup) {
  28.         oResp = jelastic.environment.control.AddEndpoint(APPID, session, oEnvInfo.nodes[i].id, port, PROTOCOL, name);
  29.  
  30.         if (oResp.result !== 0) {
  31.             return oResp;
  32.         }
  33.     }
  34. }
  35.  
  36. return oScripting.eval({
  37.     script : "InstallApp",
  38.     targetAppid : APPID,
  39.     manifest : toJSON({
  40.         "jpsType" : "update",
  41.         "application" : {
  42.             "id": "Payara Server Full",
  43.             "name": "Payara Server Full",
  44.             "success": {
  45.                 "email": "Below you will find the link to the Payara Server Admin Console.</br> <table style='font-size:13px; border: none;'><tr><td>Admin Console URL:</td><td style='padding-left: 10px;'><a href='https://${env.domain}:"+ oResp.object.publicPort + "/' target='_blank'>https://${env.domain}:"+ oResp.object.publicPort+"/</a></td></tr><tr><td>Username:</td><td  style='padding-left: 10px'>admin</td></tr><tr><td>Password:</td><td  style='padding-left: 10px'>admin</td></tr></table />"
  46.             }
  47.         }
  48.     })
  49. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement