From 9df35bda33987b136d4339befb90b0364e4f5767 Mon Sep 17 00:00:00 2001
From: Brian Rosenberger
Date: Tue, 5 Feb 2013 14:02:07 +0000
Subject: [PATCH] Arbeitsstand Anfang Februar
git-svn-id: https://brutex.net/svn/xservices/trunk@101 e7e49efb-446e-492e-b9ec-fcafc1997a86
---
web/WEB-INF/JCSAdmin.jsp | 319 ++++++++++++++++++++++++++++++++++++++
web/WEB-INF/cxf-beans.xml | 5 +
web/WEB-INF/web.xml | 35 +++--
3 files changed, 350 insertions(+), 9 deletions(-)
create mode 100644 web/WEB-INF/JCSAdmin.jsp
diff --git a/web/WEB-INF/JCSAdmin.jsp b/web/WEB-INF/JCSAdmin.jsp
new file mode 100644
index 0000000..ca76b39
--- /dev/null
+++ b/web/WEB-INF/JCSAdmin.jsp
@@ -0,0 +1,319 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+--%>
+<%@ page import="java.util.HashMap" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="org.apache.jcs.admin.*" %>
+<%@ page import="org.apache.jcs.*" %>
+
+
+
+
+
+
+
+
+
+ JCS Admin Servlet
+
+
+
+
+
+<%
+ String CACHE_NAME_PARAM = "cacheName";
+ String ACTION_PARAM = "action";
+ String CLEAR_ALL_REGIONS_ACTION = "clearAllRegions";
+ String CLEAR_REGION_ACTION = "clearRegion";
+ String REMOVE_ACTION = "remove";
+ String DETAIL_ACTION = "detail";
+ String REGION_SUMMARY_ACTION = "regionSummary";
+ String ITEM_ACTION = "item";
+ String KEY_PARAM = "key";
+ String SILENT_PARAM = "silent";
+
+ String DEFAULT_TEMPLATE_NAME = "DEFAULT";
+ String REGION_DETAIL_TEMPLATE_NAME = "DETAIL";
+ String ITEM_TEMPLATE_NAME = "ITEM";
+ String REGION_SUMMARY_TEMPLATE_NAME = "SUMMARY";
+
+ String templateName = DEFAULT_TEMPLATE_NAME;
+
+ HashMap context = new HashMap();
+
+ // Get cacheName for actions from request (might be null)
+ String cacheName = request.getParameter( CACHE_NAME_PARAM );
+
+ if ( cacheName != null )
+ {
+ cacheName = cacheName.trim();
+ }
+
+ // If an action was provided, handle it
+ String action = request.getParameter( ACTION_PARAM );
+
+ if ( action != null )
+ {
+ if ( action.equals( CLEAR_ALL_REGIONS_ACTION ) )
+ {
+ jcsBean.clearAllRegions();
+ }
+ else if ( action.equals( CLEAR_REGION_ACTION ) )
+ {
+ if ( cacheName == null )
+ {
+ // Not Allowed
+ }
+ else
+ {
+ jcsBean.clearRegion( cacheName );
+ }
+ }
+ else if ( action.equals( REMOVE_ACTION ) )
+ {
+ String[] keys = request.getParameterValues( KEY_PARAM );
+
+ for ( int i = 0; i < keys.length; i++ )
+ {
+ jcsBean.removeItem( cacheName, keys[ i ] );
+ }
+
+ templateName = REGION_DETAIL_TEMPLATE_NAME;
+ }
+ else if ( action.equals( DETAIL_ACTION ) )
+ {
+ templateName = REGION_DETAIL_TEMPLATE_NAME;
+ }
+ else if ( action.equals( ITEM_ACTION ) )
+ {
+ templateName = ITEM_TEMPLATE_NAME;
+ }
+ else if ( action.equals( REGION_SUMMARY_ACTION ) )
+ {
+ templateName = REGION_SUMMARY_TEMPLATE_NAME;
+ }
+ }
+
+ if ( request.getParameter( SILENT_PARAM ) != null )
+ {
+ // If silent parameter was passed, no output should be produced.
+ //return null;
+ }
+ else
+ {
+ // Populate the context based on the template
+ if ( templateName == REGION_DETAIL_TEMPLATE_NAME )
+ {
+ //context.put( "cacheName", cacheName );
+ context.put( "elementInfoRecords", jcsBean.buildElementInfo( cacheName ) );
+ }
+ else if ( templateName == DEFAULT_TEMPLATE_NAME )
+ {
+ context.put( "cacheInfoRecords", jcsBean.buildCacheInfo() );
+ }
+ }
+
+///////////////////////////////////////////////////////////////////////////////////
+ //handle display
+
+ if ( templateName == ITEM_TEMPLATE_NAME )
+ {
+ String key = request.getParameter( KEY_PARAM );
+
+ if ( key != null )
+ {
+ key = key.trim();
+ }
+
+ JCS cache = JCS.getInstance( cacheName );
+
+ org.apache.jcs.engine.behavior.ICacheElement element = cache.getCacheElement( key );
+%>
+ Item for key [<%=key%>] in region [<%=cacheName%>]
+
+Region Detail
+| All Regions
+
+
+ <%=element%>
+
+<%
+ }
+ else
+ if ( templateName == REGION_SUMMARY_TEMPLATE_NAME )
+ {
+%>
+
+ Summary for region [<%=cacheName%>]
+
+All Regions
+
+<%
+ JCS cache = JCS.getInstance( cacheName );
+ String stats = cache.getStats();
+%>
+
+
+ Stats for region [<%=cacheName%>]
+
+
+ <%=stats%>
+
+
+<%
+ }
+ else
+ if ( templateName == REGION_DETAIL_TEMPLATE_NAME )
+ {
+%>
+
+ Detail for region [<%=cacheName%>]
+
+All Regions
+
+
+
+ Key |
+ Eternal? |
+ Create time |
+ Max Life (s) |
+ Till Expiration (s) |
+
+<%
+ List list = (List)context.get( "elementInfoRecords" );
+ Iterator it = list.iterator();
+ while ( it.hasNext() ) {
+ CacheElementInfo element = (CacheElementInfo)it.next();
+%>
+
+ <%=element.getKey()%> |
+ <%=element.isEternal()%> |
+ <%=element.getCreateTime()%> |
+ <%=element.getMaxLifeSeconds()%> |
+ <%=element.getExpiresInSeconds()%> |
+
+ View
+ | Remove
+ |
+
+<%
+ }
+
+ JCS cache = JCS.getInstance( cacheName );
+ String stats = cache.getStats();
+%>
+
+
+
+ Stats for region [<%=cacheName%>]
+
+
+ <%=stats%>
+
+<%
+ }
+ else
+ {
+%>
+
+ Cache Regions
+
+
+These are the regions which are currently defined in the cache. 'Items' and
+'Bytes' refer to the elements currently in memory (not spooled). You can clear
+all items for a region by selecting 'Remove all' next to the desired region
+below. You can also Clear all regions
+which empties the entire cache.
+
+
+
+
+
+
+
+ Cache Name |
+ Items |
+ Bytes |
+ Status |
+ Memory Hits |
+ Aux Hits |
+ Not Found Misses |
+ Expired Misses |
+
+
+<%
+ List list = (List)context.get( "cacheInfoRecords" );
+ Iterator it = list.iterator();
+ while (it.hasNext() )
+ {
+ CacheRegionInfo record = (CacheRegionInfo)it.next();
+
+%>
+
+ <%=record.getCache().getCacheName()%> |
+ <%=record.getCache().getSize()%> |
+ <%=record.getByteCount()%> |
+ <%=record.getStatus()%> |
+ <%=record.getCache().getHitCountRam()%> |
+ <%=record.getCache().getHitCountAux()%> |
+ <%=record.getCache().getMissCountNotFound()%> |
+ <%=record.getCache().getMissCountExpired()%> |
+
+ Summary
+ | Detail
+ | Clear
+ |
+
+<%
+ }
+%>
+
+<%
+ }
+%>
+
+
+
+
+
diff --git a/web/WEB-INF/cxf-beans.xml b/web/WEB-INF/cxf-beans.xml
index c3aca93..67f3e47 100644
--- a/web/WEB-INF/cxf-beans.xml
+++ b/web/WEB-INF/cxf-beans.xml
@@ -72,6 +72,11 @@
+
+
+
+
diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml
index 80b600c..d496078 100644
--- a/web/WEB-INF/web.xml
+++ b/web/WEB-INF/web.xml
@@ -27,24 +27,37 @@
cache:thread-count
3
-
- cvs-config-01
- c:/temp/test.txt
-
+
+
+
+
cvs-cache-interval
- 15
+ 3
-
-
+
+
+
org.springframework.web.context.ContextLoaderListener
@@ -76,7 +89,11 @@
net.brutex.xservices.util.cache.CacheServlet
3
-
+
+ FindingsCacheServlet
+ net.brutex.xservices.util.cache.FindingsCacheServlet
+ 3
+
XServices