svn commit: r1352578 - in /ofbiz/trunk/framework/webtools: config/WebtoolsUiLabels.xml webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy widget/CacheForms.xml widget/CacheScreens.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1352578 - in /ofbiz/trunk/framework/webtools: config/WebtoolsUiLabels.xml webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy widget/CacheForms.xml widget/CacheScreens.xml

jacopoc
Author: jacopoc
Date: Thu Jun 21 15:46:49 2012
New Revision: 1352578

URL: http://svn.apache.org/viewvc?rev=1352578&view=rev
Log:
Improved memory usage information in the webtools->cache screen: the approx size in bytes is now shown for each cache in the list and the total memeory used by caches is also reported at the top of the screen.

Modified:
    ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy
    ofbiz/trunk/framework/webtools/widget/CacheForms.xml
    ofbiz/trunk/framework/webtools/widget/CacheScreens.xml

Modified: ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml?rev=1352578&r1=1352577&r2=1352578&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml (original)
+++ ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml Thu Jun 21 15:46:49 2012
@@ -826,6 +826,9 @@
         <value xml:lang="zh">缓存维护</value>
         <value xml:lang="zh_TW">緩存維護</value>
     </property>
+    <property key="WebtoolsCacheMemory">
+        <value xml:lang="en">Cache Memory</value>
+    </property>
     <property key="WebtoolsCacheName">
         <value xml:lang="de">Cache Name</value>
         <value xml:lang="en">Cache Name</value>

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy?rev=1352578&r1=1352577&r2=1352578&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy Thu Jun 21 15:46:49 2012
@@ -23,13 +23,8 @@ import org.ofbiz.security.Security;
 
 context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session);
 
-rt = Runtime.getRuntime();
-context.memory = UtilFormatOut.formatQuantity(rt.totalMemory());
-context.freeMemory = UtilFormatOut.formatQuantity(rt.freeMemory());
-context.usedMemory = UtilFormatOut.formatQuantity((rt.totalMemory() - rt.freeMemory()));
-context.maxMemory = UtilFormatOut.formatQuantity(rt.maxMemory());
-
 cacheList = [];
+totalCacheMemory = 0.0;
 names = new TreeSet(UtilCache.getUtilCacheTableKeySet());
 names.each { cacheName ->
         utilCache = UtilCache.findCache(cacheName);
@@ -48,7 +43,9 @@ names.each { cacheName ->
         cache.expireTime = UtilFormatOut.formatQuantity(utilCache.getExpireTime());
         cache.useSoftReference = utilCache.getUseSoftReference().toString();
         cache.useFileSystemStore = utilCache.getUseFileSystemStore().toString();
-
+        cache.useFileSystemStore = utilCache.getUseFileSystemStore().toString();
+        cache.cacheMemory = utilCache.getSizeInBytes();
+        totalCacheMemory += cache.cacheMemory;
         cacheList.add(cache);
 }
 sortField = parameters.sortField;
@@ -57,3 +54,13 @@ if (sortField) {
 } else {
     context.cacheList = cacheList;
 }
+context.totalCacheMemory = totalCacheMemory;
+
+rt = Runtime.getRuntime();
+memoryInfo = [:];
+memoryInfo.memory = UtilFormatOut.formatQuantity(rt.totalMemory());
+memoryInfo.freeMemory = UtilFormatOut.formatQuantity(rt.freeMemory());
+memoryInfo.usedMemory = UtilFormatOut.formatQuantity((rt.totalMemory() - rt.freeMemory()));
+memoryInfo.maxMemory = UtilFormatOut.formatQuantity(rt.maxMemory());
+memoryInfo.totalCacheMemory = totalCacheMemory;
+context.memoryInfo = memoryInfo;

Modified: ofbiz/trunk/framework/webtools/widget/CacheForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/CacheForms.xml?rev=1352578&r1=1352577&r2=1352578&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/CacheForms.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/CacheForms.xml Thu Jun 21 15:46:49 2012
@@ -21,6 +21,13 @@ under the License.
 <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
 
+    <form name="MemoryInfo" type="single" default-map-name="memoryInfo">
+        <field name="memory" title="${uiLabelMap.WebtoolsTotalMemory}"><display/></field>
+        <field name="maxMemory" title="${uiLabelMap.WebtoolsMaxMemory}"><display/></field>
+        <field name="freeMemory" title="${uiLabelMap.WebtoolsFreeMemory}"><display/></field>
+        <field name="usedMemory" title="${uiLabelMap.WebtoolsUsedMemory}"><display/></field>
+        <field name="totalCacheMemory" title="${uiLabelMap.WebtoolsCacheMemory}"><display/></field>
+    </form>
     <form name="ListCache" type="list" list-name="cacheList" paginate-target="FindUtilCache" separate-columns="true" odd-row-style="alternate-row" default-table-style="basic-table hover-bar" header-row-style="header-row-2">
         <field name="cacheName" title="${uiLabelMap.WebtoolsCacheName}" sort-field="true"><display/></field>
         <field name="cacheSize" title="${uiLabelMap.WebtoolsSize}" sort-field="true"><display/></field>
@@ -31,6 +38,7 @@ under the License.
         <field name="expireTime" title="${uiLabelMap.WebtoolsExpireTime}" sort-field="true"><display/></field>
         <field name="useSoftReference" title="${uiLabelMap.WebtoolsUseSoftRef}" sort-field="true"><display/></field>
         <field name="useFileSystemStore" title="${uiLabelMap.WebtoolsUseFileStore}" sort-field="true"><display/></field>
+        <field name="cacheMemory" title="${uiLabelMap.WebtoolsCacheMemory}" sort-field="true"><display/></field>
         <field name="administration" title=" " widget-style="buttontext" use-when="hasUtilCacheEdit">
             <hyperlink description="${uiLabelMap.WebtoolsElements}" target="FindUtilCacheElements">
                 <parameter param-name="UTIL_CACHE_NAME" from-field="cacheName"/>

Modified: ofbiz/trunk/framework/webtools/widget/CacheScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/CacheScreens.xml?rev=1352578&r1=1352577&r2=1352578&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/CacheScreens.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/CacheScreens.xml Thu Jun 21 15:46:49 2012
@@ -36,9 +36,10 @@ under the License.
                                 <if-has-permission permission="UTIL_CACHE" action="_VIEW"/>
                             </condition>
                             <widgets>
+                                <screenlet title="${uiLabelMap.WebtoolsMemory}">
+                                    <include-form name="MemoryInfo" location="component://webtools/widget/CacheForms.xml"/>
+                                </screenlet>
                                 <screenlet>
-                                    <label>${uiLabelMap.WebtoolsMemory} ${uiLabelMap.WebtoolsTotalMemory} ${memory} ${uiLabelMap.WebtoolsFreeMemory} ${freeMemory} ${uiLabelMap.WebtoolsUsedMemory} ${usedMemory}
-                                        ${uiLabelMap.WebtoolsMaxMemory} ${maxMemory}</label>
                                     <include-menu name="FindCache" location="component://webtools/widget/Menus.xml"/>
                                     <include-form name="ListCache" location="component://webtools/widget/CacheForms.xml"/>
                                     <include-menu name="FindCache" location="component://webtools/widget/Menus.xml"/>