1 package enhydraManager.presentation; 2 3 4 import enhydraManager.spec.*; 5 import java.util.Vector ; 7 import java.io.IOException ; 8 9 import com.lutris.appserver.server.httpPresentation.HttpPresentation; 11 import com.lutris.appserver.server.httpPresentation.HttpPresentationComms; 12 import com.lutris.appserver.server.httpPresentation.HttpPresentationException; 13 import org.w3c.dom.html.HTMLAnchorElement; 14 import org.w3c.dom.Node ; 15 import com.lutris.appserver.server.httpPresentation.*; 16 public class ActionPresentation implements HttpPresentation { 17 18 private static ActionHTML actionPage; 19 20 public void run(HttpPresentationComms comms) throws HttpPresentationException, IOException { 21 22 try{ 23 try { 24 String started = comms.request.getParameter("started"); 25 String deployed = comms.request.getParameter("deployed"); 26 String service = comms.request.getParameter("service"); 27 String host = comms.request.getParameter("host"); 28 String id = comms.request.getParameter("id"); 29 30 if(started==null||deployed==null||service==null||host==null||id==null) 31 throw new ClientPageRedirectException( 32 comms.request.getAppFileURIPath("ListPresentation.po")); 33 34 actionPage = (ActionHTML)comms.xmlcFactory.create(ActionHTML.class); 35 36 HTMLAnchorElement anchorStart = actionPage.getElementStart(); 37 HTMLAnchorElement anchorStop = actionPage.getElementStop(); 38 HTMLAnchorElement anchorReload = actionPage.getElementReload(); 39 HTMLAnchorElement anchorUndeploy = actionPage.getElementUndeploy(); 40 HTMLAnchorElement anchorDeploy = actionPage.getElementDeploy(); 41 HTMLAnchorElement anchorDelete = actionPage.getElementDelete(); 42 43 actionPage.setTextName1(" Application Tasks "); 44 actionPage.setTextName2(id); 45 46 if(deployed.equals("true")) 47 { 48 if(started.equals("true")) 49 { 50 actionPage.setTextDeploySpan("Deploy"); 52 actionPage.setTextStartSpan("Start"); 53 actionPage.setTextReloadSpan(""); 54 actionPage.setTextStopSpan(""); 55 actionPage.setTextUndeploySpan(""); 56 57 anchorStart.getParentNode().removeChild(anchorStart); 58 anchorDeploy.getParentNode().removeChild(anchorDeploy); 59 60 61 anchorStop.setHref("javascript:doStop('ApplicationManager.po?service="+service+"&host="+host+"&id="+id+"&action=stop"+"');"); 62 63 anchorReload.setHref("javascript:doReload('ApplicationManager.po?service="+service+"&host="+host+"&id="+id+"&action=reload"+"');"); 64 65 anchorUndeploy.setHref("javascript:doUnDeploy('ApplicationManager.po?service="+service+"&host="+host+"&id="+id+"&action=undeploy"+"');"); 66 67 anchorDelete.setHref("javascript:doDelete('ApplicationManager.po?service="+service+"&host="+host+"&id="+id+"&action=delete"+"');"); 68 69 70 } 71 else 72 { 73 actionPage.setTextDeploySpan("Deploy"); 74 actionPage.setTextStartSpan(""); 75 actionPage.setTextReloadSpan("Reload"); 76 actionPage.setTextStopSpan("Stop"); 77 actionPage.setTextUndeploySpan(""); 78 79 anchorStop.getParentNode().removeChild(anchorStop); 80 anchorDeploy.getParentNode().removeChild(anchorDeploy); 81 anchorReload.getParentNode().removeChild(anchorReload); 82 83 anchorStart.setHref("javascript:doStart('ApplicationManager.po?service="+service+"&host="+host+"&id="+id+"&action=start"+"');"); 84 85 anchorUndeploy.setHref("javascript:doUnDeploy('ApplicationManager.po?service="+service+"&host="+host+"&id="+id+"&action=undeploy"+"');"); 86 87 anchorDelete.setHref("javascript:doDelete('ApplicationManager.po?service="+service+"&host="+host+"&id="+id+"&action=delete"+"');"); 88 89 } 90 91 } 92 else 93 { 94 actionPage.setTextDeploySpan(""); 95 actionPage.setTextStartSpan("Start"); 96 actionPage.setTextReloadSpan("Reload"); 97 actionPage.setTextStopSpan("Stop"); 98 actionPage.setTextUndeploySpan("Undeploy"); 99 100 anchorStop.getParentNode().removeChild(anchorStop); 101 anchorReload.getParentNode().removeChild(anchorReload); 102 anchorUndeploy.getParentNode().removeChild(anchorUndeploy); 103 anchorStart.getParentNode().removeChild(anchorStart); 104 105 106 anchorDeploy.setHref("javascript:doDeploy('ApplicationManager.po?service="+service+"&host="+host+"&id="+id+"&action=deploy"+"');"); 107 108 anchorDelete.setHref("javascript:doDelete('ApplicationManager.po?service="+service+"&host="+host+"&id="+id+"&action=delete"+"');"); 109 110 } 111 112 113 114 115 comms.response.writeDOM(actionPage); 116 117 118 119 120 } catch (Exception e) { 121 e.printStackTrace(); 122 } 123 }catch(Exception e){ 124 e.printStackTrace(); 125 } 126 } 127 128 129 } 130 131 | Popular Tags |