struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From musa...@apache.org
Subject svn commit: r652098 - in /struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main: java/org/apache/struts2/osgi/admin/BundlesAction.java resources/osgi/admin/viewBundle.vm resources/osgi/admin/viewBundles.vm resources/struts.xml
Date Tue, 29 Apr 2008 20:48:18 GMT
Author: musachy
Date: Tue Apr 29 13:48:18 2008
New Revision: 652098

URL: http://svn.apache.org/viewvc?rev=652098&view=rev
Log:
* Fix action mappings
* Add "update" to actions (re-deploy without restarting Felix)

Modified:
    struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/BundlesAction.java
    struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundle.vm
    struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundles.vm
    struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/struts.xml

Modified: struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/BundlesAction.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/BundlesAction.java?rev=652098&r1=652097&r2=652098&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/BundlesAction.java
(original)
+++ struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/BundlesAction.java
Tue Apr 29 13:48:18 2008
@@ -38,6 +38,11 @@
         return view();
     }
 
+    public String update() throws BundleException {
+        Bundle bundle = bundleAccessor.getBundles().get(id);
+        bundle.update();
+        return view();
+    }
 
     public String getId() {
         return id;
@@ -90,10 +95,14 @@
     }
 
     public boolean isAllowedAction(Bundle bundle, String val) {
+        int state = bundle.getState();
         if ("start".equals(val)) {
-            return bundle.getState() == Bundle.INSTALLED;
+            return state == Bundle.RESOLVED;
         } else if ("stop".equals(val)) {
-            return bundle.getState() == Bundle.ACTIVE;
+            return state == Bundle.ACTIVE;
+        } else if ("update".equals(val)) {
+            return state == Bundle.ACTIVE || state == Bundle.INSTALLED
+                    || state == Bundle.RESOLVED;
         }
         throw new IllegalArgumentException("Invalid state");
     }

Modified: struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundle.vm
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundle.vm?rev=652098&r1=652097&r2=652098&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundle.vm
(original)
+++ struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundle.vm
Tue Apr 29 13:48:18 2008
@@ -84,6 +84,10 @@
             #if ($action.isAllowedAction($bundle, "stop"))
             <a href="bundle_${bundle.symbolicName}!stop.action">Stop</a>
             #end
+            
+            #if ($action.isAllowedAction($bundle, "update"))
+            <a href="bundle_${bundle.symbolicName}!update.action">Update</a>
+            #end
         </td>
     </tr>
 

Modified: struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundles.vm
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundles.vm?rev=652098&r1=652097&r2=652098&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundles.vm
(original)
+++ struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundles.vm
Tue Apr 29 13:48:18 2008
@@ -15,7 +15,9 @@
     <tbody>
         #foreach ($bundle in $bundles)
         <tr>
-            <td>$bundle.symbolicName</td>
+            <td>
+                <a href="bundle_${bundle.symbolicName}!view.action">$bundle.symbolicName</a>
+            </td>
             <td>$action.getBundleState($bundle)</td>
             <td>
                 #if ($action.isAllowedAction($bundle, "start"))
@@ -25,6 +27,10 @@
                 #if ($action.isAllowedAction($bundle, "stop"))
                 <a href="bundle_${bundle.symbolicName}!stop.action">Stop</a>
                 #end
+                
+                #if ($action.isAllowedAction($bundle, "update"))
+                <a href="bundle_${bundle.symbolicName}!update.action">Update</a>
+                #end
             </td>
         </tr>
         #end

Modified: struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/struts.xml
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/struts.xml?rev=652098&r1=652097&r2=652098&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/struts.xml (original)
+++ struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/struts.xml Tue
Apr 29 13:48:18 2008
@@ -4,9 +4,8 @@
     "http://struts.apache.org/dtds/struts-2.0.dtd">
 
 <struts>
-
     <package name="bundle-admin" namespace="/osgi/admin" extends="struts-default">
-        <action name="bundle_*" class="org.apache.struts2.osgi.admin.BundlesAction" method="view">
+        <action name="bundle_*!*" class="org.apache.struts2.osgi.admin.BundlesAction"
method="{2}">
             <param name="id">{1}</param>
             <result type="velocity">viewBundle.vm</result>
         </action>
@@ -14,5 +13,4 @@
             <result type="velocity">viewBundles.vm</result>
         </action>
     </package>
-
 </struts>



Mime
View raw message