servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r400202 - in /incubator/servicemix/trunk/servicemix-console/src: main/java/org/apache/servicemix/console/ webapp/ webapp/WEB-INF/view/ webapp/WEB-INF/view/JBIComponents/ webapp/WEB-INF/view/JBIContainer/
Date Fri, 05 May 2006 23:09:11 GMT
Author: gnodet
Date: Fri May  5 16:09:09 2006
New Revision: 400202

URL: http://svn.apache.org/viewcvs?rev=400202&view=rev
Log:
Fix servicemix-console

Added:
    incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIComponents/comp.jsp
    incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/error.jsp
Modified:
    incubator/servicemix/trunk/servicemix-console/src/main/java/org/apache/servicemix/console/JBIComponentsPortlet.java
    incubator/servicemix/trunk/servicemix-console/src/main/java/org/apache/servicemix/console/ServiceMixPortlet.java
    incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIComponents/view.jsp
    incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIContainer/view.jsp
    incubator/servicemix/trunk/servicemix-console/src/webapp/main.css

Modified: incubator/servicemix/trunk/servicemix-console/src/main/java/org/apache/servicemix/console/JBIComponentsPortlet.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-console/src/main/java/org/apache/servicemix/console/JBIComponentsPortlet.java?rev=400202&r1=400201&r2=400202&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-console/src/main/java/org/apache/servicemix/console/JBIComponentsPortlet.java
(original)
+++ incubator/servicemix/trunk/servicemix-console/src/main/java/org/apache/servicemix/console/JBIComponentsPortlet.java
Fri May  5 16:09:09 2006
@@ -1,21 +1,30 @@
 package org.apache.servicemix.console;
 
 import java.util.ArrayList;
-import java.util.Comparator;
 import java.util.List;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
-import javax.jbi.management.LifeCycleMBean;
 import javax.management.ObjectName;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
 import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
 
 import org.apache.servicemix.jbi.management.ManagementContextMBean;
 
 public class JBIComponentsPortlet extends ServiceMixPortlet {
 
+    private static final String MODE_KEY = "mode";
+    private static final String LIST_MODE = "list";
+    private static final String COMP_MODE = "comp";
+    
+    protected PortletRequestDispatcher compView;
+    
 	   public static class ComponentInfo {
 	        private String name;
 	        private String type;
@@ -40,9 +49,29 @@
 	            this.state = state;
 	        }
 	    }
-	    
-	    protected void fillViewRequest(RenderRequest request) throws Exception {
-	        LifeCycleMBean container = getJBIContainer();
+
+        public void init(PortletConfig portletConfig) throws PortletException {
+            super.init(portletConfig);
+            PortletContext pc = portletConfig.getPortletContext();
+            compView = pc.getRequestDispatcher("/WEB-INF/view/" + getPortletName() + "/comp.jsp");
+        }
+       
+        protected void renderView(RenderRequest renderRequest, RenderResponse renderResponse)
throws Exception {
+            String mode = renderRequest.getParameter(MODE_KEY);
+            System.err.println("Mode: " + mode);
+            if (COMP_MODE.equals(mode)) {
+                renderCompRequest(renderRequest, renderResponse);
+            } else {
+                // Render list
+                renderListRequest(renderRequest, renderResponse);
+            }
+        }
+
+        protected void renderCompRequest(RenderRequest request, RenderResponse response)
throws Exception {
+            compView.include(request, response);
+        }
+        
+	    protected void renderListRequest(RenderRequest request, RenderResponse response) throws
Exception {
 	        ManagementContextMBean management = getManagementContext();
 	        SortedMap components = new TreeMap();
 	        ObjectName[] bcs = management.getBindingComponents();
@@ -67,6 +96,7 @@
 	        }
 	        List infos = new ArrayList(components.values());
 	        request.setAttribute("components", infos);
+            normalView.include(request, response);
 	    }
 	    
 	    protected String getAttribute(ObjectName name, String attribute) {

Modified: incubator/servicemix/trunk/servicemix-console/src/main/java/org/apache/servicemix/console/ServiceMixPortlet.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-console/src/main/java/org/apache/servicemix/console/ServiceMixPortlet.java?rev=400202&r1=400201&r2=400202&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-console/src/main/java/org/apache/servicemix/console/ServiceMixPortlet.java
(original)
+++ incubator/servicemix/trunk/servicemix-console/src/main/java/org/apache/servicemix/console/ServiceMixPortlet.java
Fri May  5 16:09:09 2006
@@ -53,8 +53,8 @@
     protected final Log log = LogFactory.getLog(getClass());
     
     protected PortletRequestDispatcher normalView;
-
     protected PortletRequestDispatcher helpView;
+    protected PortletRequestDispatcher errorView;
 
     private JMXConnector jmxConnector;
     private String namingHost = "localhost";
@@ -104,10 +104,7 @@
             if (this.jmxConnector == null) {
                 this.jmxConnector = getJMXConnector(getServiceURL());
             }
-            // Fill request
-            fillViewRequest(renderRequest);
-            // Render view
-            normalView.include(renderRequest, renderResponse);
+            renderView(renderRequest, renderResponse);
         } catch (PortletException e) {
             log.error("Error rendering portlet", e);
             closeConnector();
@@ -117,12 +114,24 @@
             closeConnector();
             throw e;
         } catch (Exception e) {
-            log.error("Error rendering portlet", e);
-            closeConnector();
-            throw new PortletException("Error rendering portlet", e);
+            try {
+                renderRequest.setAttribute("exception", e);
+                errorView.include(renderRequest, renderResponse);
+            } finally {
+                closeConnector();
+            }
+            //log.error("Error rendering portlet", e);
+            //throw new PortletException("Error rendering portlet", e);
         }
     }
     
+    protected void renderView(RenderRequest renderRequest, RenderResponse renderResponse)
throws Exception {
+        // Fill request
+        fillViewRequest(renderRequest);
+        // Render view
+        normalView.include(renderRequest, renderResponse);
+    }
+    
     /**
      * Get a servicemix internal system management instance, from it's class name
      * @param systemClass
@@ -142,6 +151,7 @@
         PortletContext pc = portletConfig.getPortletContext();
         normalView = pc.getRequestDispatcher("/WEB-INF/view/" + getPortletName() + "/view.jsp");
         helpView = pc.getRequestDispatcher("/WEB-INF/view/" + getPortletName() + "/help.jsp");
+        errorView = pc.getRequestDispatcher("/WEB-INF/view/error.jsp");
     }
 
     public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortletException, IOException {

Added: incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIComponents/comp.jsp
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIComponents/comp.jsp?rev=400202&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIComponents/comp.jsp
(added)
+++ incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIComponents/comp.jsp
Fri May  5 16:09:09 2006
@@ -0,0 +1,14 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<portlet:defineObjects/>
+<table width="100%">
+  <tr>
+    <td>
+      <a href="<portlet:renderURL><portlet:param name="mode" value="comp"/><portlet:param
name="action" value="refresh"/></portlet:renderURL>">Refresh</a> 
+      &nbsp;
+      <a href="<portlet:renderURL><portlet:param name="mode" value="list"/></portlet:renderURL>">List</a>

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

Modified: incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIComponents/view.jsp
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIComponents/view.jsp?rev=400202&r1=400201&r2=400202&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIComponents/view.jsp
(original)
+++ incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIComponents/view.jsp
Fri May  5 16:09:09 2006
@@ -18,7 +18,15 @@
   </tr>
   <c:forEach var="component" items="${components}">
     <tr>
-      <td>${component.name}</td>
+      <td>
+        <portlet:renderURL var="componentUrl">
+            <portlet:param name="mode" value="comp" />
+            <portlet:param name="name" value="${component.name}" />
+        </portlet:renderURL>
+        <a href="${componentUrl}">
+          ${component.name}
+        </a> 
+      </td>
       <td>${component.type}</td>
       <td>${component.state}</td>
       <td>
@@ -30,7 +38,7 @@
             <a href="<portlet:actionURL><portlet:param name="action" value="shutdown"/><portlet:param
name="name" value="${component.name}"/></portlet:actionURL>">shutdown</a>&nbsp;
             <a href="<portlet:actionURL><portlet:param name="action" value="start"/><portlet:param
name="name" value="${component.name}"/></portlet:actionURL>">start</a>
           </c:when>
-          <c:when test="${component.state == 'Running'}">
+          <c:when test="${component.state == 'Started'}">
             <a href="<portlet:actionURL><portlet:param name="action" value="stop"/><portlet:param
name="name" value="${component.name}"/></portlet:actionURL>">stop</a>
           </c:when>
         </c:choose>

Modified: incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIContainer/view.jsp
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIContainer/view.jsp?rev=400202&r1=400201&r2=400202&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIContainer/view.jsp
(original)
+++ incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/JBIContainer/view.jsp
Fri May  5 16:09:09 2006
@@ -42,7 +42,7 @@
             <a href="<portlet:actionURL><portlet:param name="action" value="shutdown"/><portlet:param
name="name" value="${service.name}"/></portlet:actionURL>">shutdown</a>&nbsp;
             <a href="<portlet:actionURL><portlet:param name="action" value="start"/><portlet:param
name="name" value="${service.name}"/></portlet:actionURL>">start</a>
           </c:when>
-          <c:when test="${service.state == 'Running'}">
+          <c:when test="${service.state == 'Started'}">
             <a href="<portlet:actionURL><portlet:param name="action" value="stop"/><portlet:param
name="name" value="${service.name}"/></portlet:actionURL>">stop</a>
           </c:when>
         </c:choose>

Added: incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/error.jsp
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/error.jsp?rev=400202&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/error.jsp (added)
+++ incubator/servicemix/trunk/servicemix-console/src/webapp/WEB-INF/view/error.jsp Fri May
 5 16:09:09 2006
@@ -0,0 +1,5 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<portlet:defineObjects/>
+An exception occured while rendering porlet. <br/>
+${exception.message}

Modified: incubator/servicemix/trunk/servicemix-console/src/webapp/main.css
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-console/src/webapp/main.css?rev=400202&r1=400201&r2=400202&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-console/src/webapp/main.css (original)
+++ incubator/servicemix/trunk/servicemix-console/src/webapp/main.css Fri May  5 16:09:09
2006
@@ -278,6 +278,7 @@
 {
 	font-weight: bold;  
 	font-size: 12px;
+	text-align: left;
 }
 
 .Content .Body .LightBackground
@@ -422,4 +423,4 @@
 .Box
 {
 	border: thin solid #333333;
-}
\ No newline at end of file
+}



Mime
View raw message