geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r1076226 - in /geronimo/server/trunk/plugins/console/osgi-portlets/src/main: java/org/apache/geronimo/console/portlet/BundlesPortlet.java webapp/WEB-INF/view/BundlesView.jsp
Date Wed, 02 Mar 2011 14:16:08 GMT
Author: rwonly
Date: Wed Mar  2 14:16:08 2011
New Revision: 1076226

URL: http://svn.apache.org/viewvc?rev=1076226&view=rev
Log:
GERONIMO-5774 osgi portlet improvements (add start level input box)

Modified:
    geronimo/server/trunk/plugins/console/osgi-portlets/src/main/java/org/apache/geronimo/console/portlet/BundlesPortlet.java
    geronimo/server/trunk/plugins/console/osgi-portlets/src/main/webapp/WEB-INF/view/BundlesView.jsp

Modified: geronimo/server/trunk/plugins/console/osgi-portlets/src/main/java/org/apache/geronimo/console/portlet/BundlesPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/osgi-portlets/src/main/java/org/apache/geronimo/console/portlet/BundlesPortlet.java?rev=1076226&r1=1076225&r2=1076226&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/osgi-portlets/src/main/java/org/apache/geronimo/console/portlet/BundlesPortlet.java
(original)
+++ geronimo/server/trunk/plugins/console/osgi-portlets/src/main/java/org/apache/geronimo/console/portlet/BundlesPortlet.java
Wed Mar  2 14:16:08 2011
@@ -39,6 +39,7 @@ import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import javax.portlet.ResourceRequest;
 import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceURL;
 import javax.portlet.WindowState;
 
 import org.apache.commons.fileupload.FileItem;
@@ -82,6 +83,12 @@ public class BundlesPortlet extends Gene
     private PortletRequestDispatcher maximizedView;
     private PortletRequestDispatcher helpView;
 
+    private static final String BUNDLES_ACTION = "bundlesAction";
+    private static final String INSTALL_ACTION = "installAction";
+    private static final String SHOW_MANIFEST = "showManifest";
+    private static final String SHOW_SYS_BUNDLES = "showSysBundles";
+    private static final String SHOW_WIRED_BUNDLES = "showWiredBundles";
+    
    
     public void init(PortletConfig portletConfig) throws PortletException {
         super.init(portletConfig);
@@ -103,6 +110,32 @@ public class BundlesPortlet extends Gene
     protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws
IOException,
             PortletException {
         
+        //start/stop/uninstall/refresh action ajax url
+        ResourceURL ajaxURL_BundlesAction = renderResponse.createResourceURL();
+        ajaxURL_BundlesAction.setResourceID(BUNDLES_ACTION);
+        renderRequest.setAttribute("ajaxURL_BundlesAction", ajaxURL_BundlesAction);
+        
+        //install action ajax url
+        ResourceURL ajaxURL_InstallAction = renderResponse.createResourceURL();
+        ajaxURL_InstallAction.setResourceID(INSTALL_ACTION);
+        renderRequest.setAttribute("ajaxURL_InstallAction", ajaxURL_InstallAction);
+
+        //show manifest
+        ResourceURL ajaxURL_ShowManifest = renderResponse.createResourceURL();
+        ajaxURL_ShowManifest.setResourceID(SHOW_MANIFEST);
+        renderRequest.setAttribute("ajaxURL_ShowManifest", ajaxURL_ShowManifest);
+
+        //show sys bundles
+        ResourceURL ajaxURL_ShowSysBundles = renderResponse.createResourceURL();
+        ajaxURL_ShowSysBundles.setResourceID(SHOW_SYS_BUNDLES);
+        renderRequest.setAttribute("ajaxURL_ShowSysBundles", ajaxURL_ShowSysBundles);
+
+        //show wired bundle
+        ResourceURL ajaxURL_ShowWiredBundles = renderResponse.createResourceURL();
+        ajaxURL_ShowWiredBundles.setResourceID(SHOW_WIRED_BUNDLES);
+        renderRequest.setAttribute("ajaxURL_ShowWiredBundles", ajaxURL_ShowWiredBundles);
+
+        
         if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
             return;
         } else if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
@@ -147,12 +180,16 @@ public class BundlesPortlet extends Gene
         
         try {
             JSONObject grid = new BundleGridJSONObject(OSGiBundleList);
-            request.setAttribute("GridJSONObject", grid);
+            request.setAttribute("bundleGridJSONObject", grid);
+            request.setAttribute("initStartLevel", startLevelService.getInitialBundleStartLevel());
         } catch (JSONException e) {
             e.printStackTrace();
         } finally {
             bundleContext.ungetService(startLevelRef);
         }
+        
+        
+        
 
     }
     
@@ -219,7 +256,8 @@ public class BundlesPortlet extends Gene
                 || symbolicName.indexOf("org.apache.aries") != -1
                 || symbolicName.indexOf("org.tranql") != -1
                 || symbolicName.indexOf("org.apache.commons") != -1
-
+                || symbolicName.indexOf("org.apache.juddy") != -1
+                || symbolicName.indexOf("org.apache.activemq") != -1
                 ){
                 return true;
             }
@@ -258,7 +296,7 @@ public class BundlesPortlet extends Gene
         
         String resourceId = request.getResourceID();
   
-        if (resourceId.equals("bundlesAction")) {
+        if (resourceId.equals(BUNDLES_ACTION)) {
             
             String jsonData = request.getParameter("bundlesActionParam");
             try {
@@ -331,7 +369,7 @@ public class BundlesPortlet extends Gene
             }
             
             
-        } else if (resourceId.equals("showManifest")) {
+        } else if (resourceId.equals(SHOW_MANIFEST)) {
             String str_id = request.getParameter("id");
             long id = Long.parseLong(str_id);
 
@@ -342,7 +380,7 @@ public class BundlesPortlet extends Gene
                 e.printStackTrace();
             }
             
-        } else if (resourceId.equals("showWiredBundles")) {
+        } else if (resourceId.equals(SHOW_WIRED_BUNDLES)) {
             String str_id = request.getParameter("id");
             long id = Long.parseLong(str_id);
             Bundle bundle = bundleContext.getBundle(id);
@@ -402,14 +440,14 @@ public class BundlesPortlet extends Gene
             }
                 
                 
-        } else if (resourceId.equals("installAction")) {
+        } else if (resourceId.equals(INSTALL_ACTION)) {
             String result = processInstallAction(new ActionResourceRequest(request), bundleContext);
             PrintWriter writer = response.getWriter();
             writer.print(result);
             
             
             
-        } else if (resourceId.equals("showSysBundles")) {
+        } else if (resourceId.equals(SHOW_SYS_BUNDLES)) {
             
             //get the StartLeval object
             ServiceReference startLevelRef = bundleContext.getServiceReference(StartLevel.class.getCanonicalName());

Modified: geronimo/server/trunk/plugins/console/osgi-portlets/src/main/webapp/WEB-INF/view/BundlesView.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/osgi-portlets/src/main/webapp/WEB-INF/view/BundlesView.jsp?rev=1076226&r1=1076225&r2=1076226&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/osgi-portlets/src/main/webapp/WEB-INF/view/BundlesView.jsp
(original)
+++ geronimo/server/trunk/plugins/console/osgi-portlets/src/main/webapp/WEB-INF/view/BundlesView.jsp
Wed Mar  2 14:16:08 2011
@@ -19,7 +19,6 @@
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
 <%@ taglib prefix="portlet" uri="http://java.sun.com/portlet"%>
-<%@ page import="javax.portlet.*" %>
 
 <!-- set i18n properties file name -->
 <fmt:setBundle basename="osgiportlets"/>
@@ -80,31 +79,7 @@ function hideLoadingDIV(){
 </style>
 
 
-<%
-	//start/stop/uninstall action ajax url
-    ResourceURL ajaxResourceURL = renderResponse.createResourceURL();
-    ajaxResourceURL.setResourceID("bundlesAction");
-%>
-<%
-	//install action ajax url
-    ResourceURL ajaxResourceURL2 = renderResponse.createResourceURL();
-    ajaxResourceURL2.setResourceID("installAction");
-%>
-<%
-	//show single bundle
-    ResourceURL ajaxResourceURL3 = renderResponse.createResourceURL();
-    ajaxResourceURL3.setResourceID("showManifest");
-%>
-<%
-	//show sys bundle
-    ResourceURL ajaxResourceURL4 = renderResponse.createResourceURL();
-    ajaxResourceURL4.setResourceID("showSysBundles");
-%>
-<%
-	//show wired bundle
-    ResourceURL ajaxResourceURL5 = renderResponse.createResourceURL();
-    ajaxResourceURL5.setResourceID("showWiredBundles");
-%>
+
 
 
 <script type="text/javascript">
@@ -136,7 +111,7 @@ function hideLoadingDIV(){
     	
     	//ajax call to portlet's serveResource()
     	var postArgs={
-    		url:"<%=ajaxResourceURL%>formId="+formID,
+    		url:"${ajaxURL_BundlesAction}formId="+formID,
     		handleAs:"json",
     		content:{bundlesActionParam:actionJsonStr},
     		//sync:true,
@@ -191,7 +166,7 @@ function hideLoadingDIV(){
         
 		//ajax call to portlet's serveResource()
 		var postArgs={
-			url:"<%=ajaxResourceURL3%>formId="+formID,
+			url:"${ajaxURL_ShowManifest}formId="+formID,
 			handleAs:"text",
 			content:{id:id},
 			//sync:true,
@@ -218,7 +193,7 @@ function hideLoadingDIV(){
         
 		//ajax call to portlet's serveResource()
 		var postArgs={
-			url:"<%=ajaxResourceURL5%>formId="+formID,
+			url:"${ajaxURL_ShowWiredBundles}formId="+formID,
 			handleAs:"json",
 			content:{id:id},
 			//sync:true,
@@ -321,7 +296,7 @@ function hideLoadingDIV(){
 	
 		    //ajax call to portlet's serveResource()
 		    var postArgs={
-				url:"<%=ajaxResourceURL4%>",
+				url:"${ajaxURL_ShowSysBundles}",
 				handleAs:"text",
 				//sync:true,
 				load:function(response, ioArgs){
@@ -340,10 +315,17 @@ function hideLoadingDIV(){
 
 	
 	function installBundle(){
+
+		if (dijit.byId("startLevel").get("value") < ${initStartLevel}) {
+			if (!confirm("The start-level you are setting is less than the framework initial start-level("
+ ${initStartLevel} + "). Will you continue?")) {
+				return;
+			}
+		}	
+		
 		showLoadingDIV();
 		
 		dojo.io.iframe.send({
-			url: "<%=ajaxResourceURL2%>formId="+formID,
+			url: "${ajaxURL_InstallAction}formId="+formID,
 			method: "post",
 			handleAs: "text",
 			form: dojo.byId("installForm"),
@@ -384,11 +366,11 @@ This portlet shows the general user bund
 		        <input type="checkbox" dojoType="dijit.form.CheckBox" name="startAfterInstalled"
value="yes" />
 		        &nbsp;
 		        
-		        <!-- Don't allow user set start level for now
+
 		        <fmt:message key="osgi.bundle.startLevel" />:
-		        <input type="text" dojoType="dijit.form.TextBox" style="width: 3em;" name="startLevel"
size="4" />
+		        <input type="text" id="startLevel" name="startLevel" dojoType="dijit.form.TextBox"
displayedValue="${initStartLevel}" style="width: 3em;" size="4" />
 		        &nbsp;
-		        -->
+
 		        <!--  can not align in IE
 		        <button dojoType="dijit.form.Button">
 			    	<script type="dojo/method" event="onClick" args="evt">
@@ -423,7 +405,7 @@ This portlet shows the general user bund
 	
 	<!-- bundles grid -->
 	<script>
-		jsonData=${GridJSONObject};
+		jsonData=${bundleGridJSONObject};
 		usrBundlesStroe=new dojo.data.ItemFileWriteStore({data:jsonData});
 		
 	    function fmtActionsCell(item, idx){



Mime
View raw message