• No results found

Adding a New Robot Controller

Chapter 5 Conclusion and Future Work

A.5 Adding a New Robot Controller

////////////////////////////////////////////////////////////////////////////// Creacion de página de Biembenida (index.jsp)

///////////////////////////////////////////////////////////////////////////////

<%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <html>

<head><title>Balanceador</title></head>

<link type="text/css" rel="stylesheet" href="css/estilo.css"/> <style type="text/css"> <!-- body { background-color: #FFFFFF; } --> </style>

<script language="JavaScript" src="js/md5.js"></script> <script languaje="javascript">

//////////////////////////////////////////////////////////////////////////// Funcion Crea Ventana

//////////////////////////////////////////////////////////////////////////// function ventana(){ var valor=""; if(document.forms["form1"].txt_usuario.value.length>0){ if(document.forms["form1"].txt_clave.value.length>0){ valor=document.forms["form1"].txt_clave.value; document.forms["form1"].pass.value = hex_md5(valor); document.forms["form1"].submit(); }else{ alert("Ingrese la clave..."); } }else{ alert("Ingrese el usuario..."); } }

</script> <body>

<table width="589" height="404"

border=0 align="center" cellpadding=4 cellspacing=0> <tbody>

<tr> <td

width="100%" height="404" valign="top" nowrap class=urlo><div align="left">

<table width="550" border="1"> <tr>

<td width="581"><table width="542"> <tr>

<td colspan="3"> <table width="544"

border=0 cellpadding=4 cellspacing=0 bordercolor="0"> <tbody>

<tr> <td

width="100%" nowrap bgcolor="#CCCCCC" class=titulofondo><div align="center">INICIO DE SESION </div></td>

</tr> </tbody> </table> </td> </tr> <tr> //////////////////////////////////////////////////////////////////////////////////// Cargando imagenes (Figuras) de las Páginas ////////////////////////////////////////////////////////////////////////////////////

<td width="180" align="center"><img

src="imagenes/candado.png" width="110" height="128"></td>

<td width="153" align="center" bgcolor="#FFFFFF"><p><img src="imagenes/User.png" width="82" height="72"></p></td>

<td width="193" align="center" bgcolor="#FFFFFF"><div align="center"> <img src="imagenes/network.png" width="122" height="128"></div></td>

</tr>

<tr align="center">

<td colspan="3" bgcolor="#CCCCCC"><div align="center"> </div>

<div align="center"></div> <table width="223" height="108"

border=0 cellpadding=0 cellspacing=1> <tbody>

<tr>

<td width="215" height="102" class=menu_titu> clave/ <form action="verifica.jsp" method="post" name="form1">

<table width="97%"> <tbody> <tr> <td colspan="2" style="color:#ff0000;font- weight:bold;"> </td> </tr> <tr> <td class=titulofondo align=left width="34%">Usuario: </td>

<td class=titulofondo align=right width="66%"><input name="txt_usuario" type="text" maxlength="10"></td>

</tr> <tr>

<td class=titulofondo align=left width="34%">Clave:</td>

<td class=titulofondo align=right width="66%"><input name="txt_clave" type="password" maxlength="10"></td>

</tr> <tr>

<td colspan="2" align=left class=menu_titu><div align="center">

////////////////////////////////////////////////////////////////////////////////////////////// Valida clave

//////////////////////////////////////////////////////////////////////////////////////////////

<input type="hidden" name="pass" id="pass"> <input class=mkbutton type=button value=Ingresar name=submit2 onclick="ventana()"> </div></td> </tr> </tbody> </table> </form></td> </tr>index.jsp

</tbody>

</table> <div align="center"></div>

<div align="center"></div> <div align="center"></div></td> </tr> </table></td> </tr> </table> </div></td> </tr> </tbody> </table> </body> </html> /////////////////////////////////////////////////////////////////////////////////////// Creación de Pagina de bienvenida (jbienvenida.jsp)

/////////////////////////////////////////////////////////////////////////////////////// /////////// Creación Nombre Barra de titulo /////////////

<html> <head>

<title>Bienvenidos</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link type="text/css" rel="stylesheet" href="css/estilo.css"/>

<style type="text/css"> <!-- body { background-color: #FFFFFF; } .Estilo4 { color: #CC0000; font-size: 12px; font-weight: bold;

font-family: "Times New Roman", Times, serif; }

.Estilo7 {font-size: 12px; font-family: "Times New Roman", Times, serif; color: #CC0000;}

.Estilo8 {color: #CC0000} -->

<body>

<jsp:include page="jcabecera.jsp" flush="true"/>

//////// Crea cabecera Principal/////

<jsp:include page="jizquierdomenu.jsp" flush="true"/>

//////// Crea Botones Menu principal ///

<table width="275" height="473" border="0"> <tr> <td width="10" rowspan="2">&nbsp; </td> <td width="255" height="20">&nbsp;</td> </tr> <tr> <td>

///// valida Ip Conectatda Genera mune principal/////////////

<table width="512" height="408" border="0" onClick="window.location='jservidor.jsp'">

<tr>

<td width="195" height="152" align="center" valign="top"><table width="172" height="150" border="1">

<tr>

<td width="162" height="169" align="center" valign="top"><p class="Estilo4">NUEVO SERVIDOR </p>

<p class="Estilo8"><span class="Estilo7">Permitir configurar por medio de un Wizard el servidor Real, a&ntilde;adiendolo al balanceo</span> </p>

<p class="Estilo7"><img src="imagenes/servidor.png" width="90" height="91"></p></td>

</tr> </table></td>

<td colspan="2" align="center" valign="top"><table width="163" height="150" border="1">

<tr>

<td height="169" align="center" valign="top"><p><span class="Estilo4">MONITOREO</span></p>

<p><span class="Estilo7">Permitira Seleccionar la forma de monitorear , los servidores web </span></p>

<p class="Estilo7"><img src="imagenes/monitoreo.png" width="90" height="91"></p></td>

</table></td>

<td width="163" colspan="2" align="center" valign="top"><table width="163" height="150" border="1">

<tr>

<td align="center" valign="top"><p><span class="Estilo4">REPORTES</span></p>

<p> <span class="Estilo7"> Muestra Reportes de Balanceo por Trafico </span></p>

<p class="Estilo7"><img src="imagenes/reporte.png" width="90" height="91"></p></td>

</tr> </table></td> </tr>

<tr>

<td height="201" colspan="2" align="center"><table width="163" height="150" border="1">

<tr>

<td align="center" valign="top"><p><span class="Estilo4">RESPALDO</span> </p>

<p><span class="Estilo7">Permite Respaldar los Archivos de Configuracion de los Servidores Reales </span></p>

<p class="Estilo7"><img src="imagenes/respaldo.png" width="90" height="91"></p></td>

</tr> </table></td>

<td colspan="3" align="center"><table width="163" height="150" border="1" >

<tr>

<td align="center" valign="top"><p><span class="Estilo4">PERFIL ADM </span> </p>

<p><span class="Estilo7">Permitira Realizar Cambios al Perfil de Usuario ADM </span></p>

<p class="Estilo7"><img src="imagenes/adm.png" width="90" height="91"></p></td> </tr> </table></td> </tr> </table> <p align="justify">&nbsp;</p></td> </tr> </table>

<jsp:include page="verifica_correo.jsp" flush="true"/> </body>

///////////////////////////////////////////////////////////////////////////////// Ventana Nueva Servidor (jservidor.jsp) ////////////////////////////////////////////////////////////////////////////////

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ page contentType="text/html;charset=iso-8859-1" language="java" import="java.lang.*"%>

<jsp:useBean id="servidor" class="com.wrow.database.Servidores"/> <jsp:useBean id="base" class="com.wrow.database.Base"/>

<jsp:useBean id="comando" class="com.wrow.database.Comandos"/> <% if(null!=request.getParameter("txt_ip")){ String ip=request.getParameter("txt_ip"); Boolean b=true; String nombre=request.getParameter("txt_nombre"); base.conectar();

if(b.compareTo(base.verificaconsultas("select * from servidor where ip='"+ip+"' or nombre='"+nombre+"'"))!=0){

base.mantenimiento("insert into servidor values('"+ip+"','"+nombre+"')"); base.desconectar();

out.print("<script>alert('Servidor fue ingreso a la base de datos')</script>");

b=servidor.devuelve_ping(ip);

if(b.compareTo(new Boolean(true))==0){ comando.agregar_servidor(ip);

out.print("<script>alert('Estableciendo comunicacion con el servidor')</script>");

}else{

out.print("<script>alert('No responde el Servidor tiempo fuera\\n Por favor verificar si el servidor esta conectado')</script>");

} }else{

out.print("<script>alert('La direccion IP o el nombre ya esta registrado por otro servidor ')</script>");

} } %> <html> <head> <title>Nuevo Servidor</title>

<link type="text/css" rel="stylesheet" href="css/estilo.css"/> <style type="text/css"> <!-- body { background-color: #FFFFFF; } .Estilo1 {color: #333333} .Estilo4 { color: #CC0000; font-size: 12px; font-weight: bold;

font-family: "Times New Roman", Times, serif; }

.Estilo7 {font-size: 12px; font-family: "Times New Roman", Times, serif; color: #CC0000;} Estilo8 {color: #CC0000} --> </style> <script languaje="javascript"> ////////////Función Verifica IP /////////////////////// function validar(ip) { partes=ip.split('.'); if (partes.length!=4) { return false; } for (i=0;i<4;i++) { num=partes[i];

if (num>255 || num<0 || num.length==0 || isNaN(num)){ return false;

} }

return true; }

///////////////////// Función Verifica _ datos /////////////////////////////

function verifica_datos(){ var valor=""; if(document.forms["form1"].txt_ip.value.length>0){ if(validar(document.forms["form1"].txt_ip.value)==true){ if(document.forms["form1"].txt_nombre.value.length>0){ document.forms["form1"].submit();

}else{

alert("Ingrese el nombre de Servidor..."); }

}else{

alert("La IP ingresada es invalida"); }

}else{

alert("Ingrese la ip del Servidor..."); }

}

</script> </head>

//////////////// Llama Cabecera y menú principal /////////////////////

<body>

<jsp:include page="jcabecera.jsp" flush="true"/> <jsp:include page="jizquierdomenu.jsp" flush="true"/>

///////////////////////////////Generandpo pagina Nuevo Servidor//////////////////

<table width="518" height="473" border="0"> <tr> <td width="44" rowspan="2">&nbsp; </td> <td width="464" height="20">&nbsp;</td> </tr> <tr> <td valign="top">

<table width="512" height="314" border="0"> <tr>

<td width="195" height="103" align="center" valign="top"><table width="172" height="101" border="1">

<tr>

<td width="162" height="95" align="center" valign="top"><p class="Estilo4"><img src="imagenes/servidor.png" width="90"

height="91"></p></td> </tr>

</table></td>

<td align="center" valign="top"><p class="Estilo4">NUEVO SERVIDOR </p>

<p class="Estilo8"><span class="Estilo7">Permitir configurar por medio de un Wizard el servidor real web a&ntilde;adiendole al sistema de balanceo automaticamente</span></p></td>

</tr> <tr>

<td height="201" colspan="2" align="center"><form name="form1" method="post" action="jservidor.jsp"> <table width="51%"> <tbody> <tr> <td colspan="2" style="color:#ff0000;font-weight:bold;">&nbsp; </td> </tr> <tr>

<td class="titulofondo" align="left" width="43%">Direccion IP: </td> <td class="titulofondo" align="right" width="57%"><input type="text" name="txt_ip"></td>

</tr> <tr>

<td class="titulofondo" align="left" width="43%">Nombre:</td> <td class="titulofondo" align="right" width="57%"><input type="text" name="txt_nombre"></td>

</tr> <tr>

<td colspan="2" align="left" class="menu_titu"><div align="center"> <input class="mkbutton" type="button" value="Ingresar"

name="submit2" onClick="verifica_datos()"> </div></td> </tr> </tbody> </table> </form> </td> </tr> </table> <p align="justify">&nbsp;</p></td> </tr> </table> </body> </html>

//////////////////////////////////////////////////////////////////////////////// Ventana Elimina Servidor (delete_servidor.jsp) ////////////////////////////////////////////////////////////////////////////////

<%@ page contentType="text/html;charset=iso-8859-1" language="java" import="java.lang.*,java.sql.*;"%>

<jsp:useBean id="base" class="com.wrow.database.Base"/>

<jsp:useBean id="comando" class="com.wrow.database.Comandos"/>

<%

ResultSet res;

if(null!=request.getParameter("maquina")){ String ip=request.getParameter("maquina"); base.conectar();

base.mantenimiento("delete from servidor where ip='"+ip+"'"); comando.delete_servidor(ip); base.desconectar(); } %> <html> <head> <title>Nuevo Servidor</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link type="text/css" rel="stylesheet" href="css/estilo.css"/>

<style type="text/css"> <!-- body { background-color: #FFFFFF; } .Estilo1 {color: #333333} .Estilo4 { color: #CC0000; font-size: 12px; font-weight: bold;

font-family: "Times New Roman", Times, serif; }

.Estilo7 {font-size: 12px; font-family: "Times New Roman", Times, serif; color: #CC0000;}

.Estilo8 {color: #CC0000} -->

</style>

///////////////////////function verifica_datos()////////////////////////////

function verifica_datos(){ var valor="";

if(confirm("Esta seguro de eliminar el servidor")){ document.forms["form1"].submit();

} }

</script> </head>

//////////////// llama Cabecera y menu principal /////////////////////

<body>

<jsp:include page="jcabecera.jsp" flush="true"/> <jsp:include page="jizquierdomenu.jsp" flush="true"/>

<table width="518" height="473" border="0"> <tr> <td width="44" rowspan="2">&nbsp; </td> <td width="464" height="20">&nbsp;</td> </tr> <tr> <td valign="top">

<table width="512" height="314" border="0"> <tr>

<td width="195" height="103" align="center" valign="top"><table width="172" height="101" border="1">

<tr>

<td width="162" height="95" align="center" valign="top"><p class="Estilo4"><img src="imagenes/servidor.png" width="90"

height="91"></p></td> </tr>

</table></td>

<td align="center" valign="top"><p class="Estilo4">ELIMINAR SERVIDOR </p>

<p class="Estilo8"><span class="Estilo7">Permitir eliminar por medio de un Wizard el servidor real web </span></p></td>

</tr> <tr>

<td height="201" colspan="2" align="center"><form name="form1" method="post" action="delete_servidor.jsp"> <table width="51%"> <tbody> <tr> <td colspan="2" style="color:#ff0000;font-weight:bold;">&nbsp; </td> </tr> <tr>

<td class="titulofondo" align="left" width="43%">Direccion IP: </td> <td class="titulofondo" align="right" width="57%">

<select name="maquina" id="select">

//////////////// Conectar y desconectar de la Base /////////////////////

<%

base.conectar();

res=base.Consultas("select * from servidor"); while(res.next()){ out.println(" <option value='"+res.getString("ip")+"'>"+res.getString("nombre")+"</option>"); } base.desconectar(); %> </select> </td> </tr> <tr>

<td class="titulofondo" align="left" width="43%">&nbsp;</td> <td class="titulofondo" align="right" width="57%">&nbsp;</td> </tr>

<tr>

<td colspan="2" align="left" class="menu_titu"><div align="center"> <input class="mkbutton" type="button" value="Eliiminar"

name="submit2" onClick="verifica_datos()"> </div></td> </tr> </tbody> </table> </form>

</td> </tr> </table> <p align="justify">&nbsp;</p></td> </tr> </table> </body> </html> ///////////////////////////////////////////////////////////////////////////////////// Ventana de Monitores (jmonitoreo.jsp)

//////////////////////////////////////////////////////////////////////////////////////////

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"> <head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>MONITOREO</title> <script language="javascript"> function abrir_ventana(valor){ //////////////////////////////Evalua ChetBox //////////////////////////// if(document.form1.radio1.value==0){ window.location='servicios.jsp'; } if(document.form1.radio1.value==1){ window.location='trafico.jsp'; } if(document.form1.radio1.value==2){ window.location='disco.jsp'; } if(document.form1.radio1.value==3){ } } </script> <style type="text/css"> <!-- .Estilo4 {color: #CC0000;

font-size: 12px; font-weight: bold;

font-family: "Times New Roman", Times, serif; }

.Estilo7 {font-size: 12px; font-family: "Times New Roman", Times, serif; color: #CC0000;} .Estilo8 {color: #CC0000} .style1 {color: #000000} --> </style> </head> <body>

<jsp:include page="jcabecera.jsp" flush="true"/> <jsp:include page="jizquierdomenu.jsp" flush="true"/> <form id="form1" name="form1" method="post" action="">

<table width="489" border="0"> <tr>

<td width="389"><table width="422" height="101" border="1" align="center">

<tr>

//////////////////////Genera Imagen de la Ventana////////////////////////////////

<td width="90" height="95" align="center" valign="top"><p

class="Estilo4"><img src="imagenes/monitoreo.png" width="90" height="91" /></p></td>

<td width="240" align="center" valign="top"><p class="Estilo4">MONITOREO</p>

<p class="Estilo8"><span class="Estilo7">Permitira Seleccionar la forma de monitorear , los servidores web</span></p></td>

</tr> </table> <p class="Estilo4">&nbsp;</p> </td> </tr> <tr> <td><div align="center">

<table width="287" border="0"> <tr>

/////////////////////////////Ciclo de Validacion de los ChekBox///////////////////

<td width="24"><input name="radio1" type="radio" id="radio1" value="0" onclick="window.location='servicios.jsp'" /></td>

<td width="253"><div align="left"><span class="style1">Servicios </span></div></td>

</tr> <tr>

<td><input type="radio" name="radio1" id="radio2" value="1" onclick="window.location='trafico.jsp'"/></td>

<td><div align="left"><span class="style1">Nodos Conectados</span></div></td>

</tr> <tr>

<td><input type="radio" name="radio1" id="radio3" value="2" onclick="window.location='dmc.jsp'"/></td>

<td><div align="left"><span class="style1">Capacidad HDD, Memoria y CPU</span></div></td>

</tr> <tr>

<td><input type="radio" name="radio1" id="radio4" value="3" onclick="window.location='balanceo.jsp'"/></td>

Related documents