1 5 6 7 package com.raptus.vr; 8 9 import java.io.IOException ; 10 import java.sql.*; 11 12 import javax.servlet.*; 13 import javax.servlet.http.*; 14 import javax.sql.DataSource ; 15 16 import org.apache.struts.action.*; 17 18 import com.raptus.owxv3.*; 19 20 42 public class VRWatchAction extends org.apache.struts.action.Action 43 { 44 47 private static String VRWATCH_OWXV3 = "owxv3"; 48 49 52 public ActionForward perform(ActionMapping mapping, 53 ActionForm form, 54 HttpServletRequest request, 55 HttpServletResponse response) 56 throws IOException , ServletException 57 { 58 70 HttpSession session = request.getSession(); 71 ServletContext context = session.getServletContext(); 72 VRWatchBean myform = (VRWatchBean) form; 73 String cmd = myform.getCmd(); 74 String owxid = context.getServletContextName().toLowerCase(); 75 76 85 86 if(cmd.equals("checkowx")) 87 { 88 if(owxid.equals(VRWATCH_OWXV3)) 89 { 90 try 91 { 92 VModuleManager vmm = VModuleManager.getInstance(); 93 if(vmm == null) 94 throw new ServletException("Problems with the VModuleManager"); 95 96 XMLConfigManager cm = XMLConfigManager.getInstance(); 97 if(cm != null) 98 { 99 String gresDatasrc = cm.getPropertyByTree("virtualhost/global_resource/property?name=datasource", "value"); 100 DataSource ds = servlet.findDataSource(gresDatasrc); 101 Connection con = ds.getConnection(); 102 Statement stmt = con.createStatement(); 103 ResultSet rs = stmt.executeQuery("select count(*) from owxmsgs ;"); 104 while(rs.next()) 105 LoggingManager.log("Found " + rs.getInt(1) + " rows in owxmsgs table", this); 106 107 LoggingManager.log("OWXV3 FOR " + request.getServerName() + 108 " IS FULLY FUNCTIONAL AT " + new java.util.Date (), this); 109 110 myform.setResult("99VIRTUALHOSTOK99"); 111 return mapping.findForward("result"); 112 } 113 } 114 catch(Exception e) { 115 LoggingManager.log("EXCEPTION! " + e.getMessage(), this); 116 } 117 } 118 } 119 120 return null; 121 } 122 } 123 124 | Popular Tags |