Advertisement
Guest User

Untitled

a guest
Jun 14th, 2016
81
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.     oScripting,
  11.     oResp,
  12.     i;
  13.  
  14. oScripting =  new Scripting({
  15.     serverUrl : "http://" + window.location.host.replace("app", "appstore") + "/",
  16.     session : SESSION
  17. });
  18.  
  19. oEnvInfo = jelastic.environment.control.GetEnvInfo(APPID, session);
  20.  
  21. if (oEnvInfo.result !== 0) {
  22.     return oEnvInfo;
  23. }
  24.  
  25. nNodesCount = oEnvInfo.nodes.length;
  26.  
  27. for (i = 0; i < nNodesCount; i += 1) {
  28.     if (oEnvInfo.nodes[i].nodeGroup == nodeGroup) {
  29.         oResp = jelastic.environment.control.AddEndpoint(APPID, session, oEnvInfo.nodes[i].id, port, PROTOCOL, name);
  30.  
  31.         if (oResp.result !== 0) {
  32.             return oResp;
  33.         }
  34.     }
  35. }
  36.  
  37. return oScripting.eval({
  38.     script : "InstallApp",
  39.     targetAppid : APPID,
  40.     manifest : toJSON({
  41.         "jpsType" : "update",
  42.         "application" : {
  43.             "id": "Payara Server Full",
  44.             "name": "Payara Server Full",
  45.             "success": {
  46.                 "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 />"
  47.             }
  48.         }
  49.     })
  50. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement