From: Ulf S. <sc...@us...> - 2003-06-17 07:29:23
|
User: schrouf Date: 03/06/17 00:29:22 Modified: varia/src/main/org/jboss/jmx/adaptor/html Tag: Branch_3_2 ClusteredConsoleServlet.java Log: Some refactoring for frame based cluster node view bootstrap (see bootstrap.html) Revision Changes Path No revision No revision 1.1.2.2 +54 -8 contrib/varia/src/main/org/jboss/jmx/adaptor/html/Attic/ClusteredConsoleServlet.java Index: ClusteredConsoleServlet.java =================================================================== RCS file: /cvsroot/jboss/contrib/varia/src/main/org/jboss/jmx/adaptor/html/Attic/ClusteredConsoleServlet.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- ClusteredConsoleServlet.java 27 May 2003 05:19:17 -0000 1.1.2.1 +++ ClusteredConsoleServlet.java 17 Jun 2003 07:29:21 -0000 1.1.2.2 @@ -29,16 +29,21 @@ * jmx-console cluster frame. * * @author Sco...@jb... - * @version $Revision: 1.1.2.1 $ + * @version $Revision: 1.1.2.2 $ */ public class ClusteredConsoleServlet extends HttpServlet { private static Logger log = Logger.getLogger(ClusteredConsoleServlet.class); - private static final String BOOTSTRAP_PARAM = "bootstrap"; - private static final String PARTITION_PARAM = "partition"; - private static final String HOSTNAME_PARAM = "hostname"; - private static final String PORT_PARAM = "port"; - private static final String DISCOVERY_GROUP_PARAM = "discoveryGroup"; + + private static final String ACTION_PARAM = "action"; + private static final String CLUSTER_BOOTSTRAP_ACTION = "bootstrap"; + private static final String CLUSTER_INDEX_ACTION = "index"; + + private static final String BOOTSTRAP_PARAM = "bootstrap"; + private static final String PARTITION_PARAM = "partition"; + private static final String HOSTNAME_PARAM = "hostname"; + private static final String PORT_PARAM = "port"; + private static final String DISCOVERY_GROUP_PARAM = "discoveryGroup"; private static final String DISCOVERY_TIMEOUT_PARAM = "discoveryTimeout"; private String jgProps; @@ -51,6 +56,7 @@ public void init(ServletConfig config) throws ServletException { super.init(config); + jgProps = config.getInitParameter("jgProps"); if( jgProps == null ) throw new ServletException("No jgProps init-param specified"); @@ -89,6 +95,45 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String action = request.getParameter(ACTION_PARAM); + + if( action == null ) + action = CLUSTER_INDEX_ACTION; + + if( action.equals(CLUSTER_INDEX_ACTION) ) + clusterIndex(request, response); + else if( action.equals(CLUSTER_BOOTSTRAP_ACTION) ) + clusterBootstrap(request, response); + } + + + /** cluster index view + */ + private void clusterIndex(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException + { + try + { + // Query for the membership of the partition cluster + String[] hosts = {}; + request.setAttribute("partition", "none"); + request.setAttribute("partitionHosts", hosts); + RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/cluster/clusterView.jsp"); + rd.forward(request, response); + } + catch(Exception e) + { + log.debug("Failed to get partition view", e); + response.sendError(HttpServletResponse.SC_NO_CONTENT, "No partition view found"); + } + } + + + /** bootstrap cluster node view + */ + private void clusterBootstrap(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException + { String bootstrap = request.getParameter(BOOTSTRAP_PARAM); log.debug("processRequest, parameters:"); Enumeration params = request.getParameterNames(); @@ -150,10 +195,11 @@ } catch(Exception e) { - log.debug("Failed to get parition view", e); - response.sendError(HttpServletResponse.SC_NO_CONTENT, "No parition view found"); + log.debug("Failed to get partition view", e); + response.sendError(HttpServletResponse.SC_NO_CONTENT, "No partition view found"); } } + private String[] discoverHosts(Properties env) throws NamingException, IOException |