KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > admingui > handlers > LogAnalyzerHandler


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.tools.admingui.handlers;
25
26 import java.util.ArrayList JavaDoc;
27 import java.util.EventObject JavaDoc;
28 import java.util.Iterator JavaDoc;
29 import java.util.Calendar JavaDoc;
30 import java.util.Date JavaDoc;
31 import java.util.Set JavaDoc;
32 import java.util.Map JavaDoc;
33 import java.util.HashMap JavaDoc;
34 import java.util.Random JavaDoc;
35 import java.text.DateFormat JavaDoc;
36 import java.util.logging.Level JavaDoc;
37 import java.lang.Integer JavaDoc;
38
39 import com.iplanet.jato.view.View;
40 import com.iplanet.jato.view.ViewBase;
41 import com.iplanet.jato.view.ViewBean;
42 import com.iplanet.jato.RequestContext;
43 import com.iplanet.jato.RequestManager;
44 import com.iplanet.jato.model.DefaultModel;
45 import com.iplanet.jato.model.Model;
46 import com.iplanet.jato.model.ModelControlException;
47
48 import javax.management.MBeanException JavaDoc;
49 import javax.management.ObjectName JavaDoc;
50 import javax.management.AttributeList JavaDoc;
51 import javax.management.Attribute JavaDoc;
52
53 import com.sun.enterprise.tools.admingui.util.Util;
54
55 import com.sun.enterprise.tools.guiframework.exception.FrameworkException;
56 import com.sun.enterprise.tools.guiframework.model.ModelManager;
57 import com.sun.enterprise.tools.guiframework.view.DescriptorCCPageTitle;
58 import com.sun.enterprise.tools.guiframework.view.DescriptorContainerView;
59 import com.sun.enterprise.tools.guiframework.view.HandlerContext;
60 import com.sun.enterprise.tools.guiframework.view.descriptors.ViewDescriptor;
61 import com.sun.enterprise.tools.guiframework.view.descriptors.CCActionTableDescriptor;
62 import com.sun.enterprise.tools.guiframework.view.event.BeforeCreateEvent;
63
64 import com.sun.web.ui.model.CCActionTableModelInterface;
65 import com.sun.enterprise.tools.admingui.util.MBeanUtil;
66 import com.sun.enterprise.tools.admingui.util.AMXUtil;
67
68 //need for constants
69
import com.sun.appserv.management.monitor.ServerRootMonitor;
70 import com.sun.appserv.management.ext.logging.LogAnalyzer;
71
72
73 public class LogAnalyzerHandler {
74     
75     private static final String JavaDoc DEMO_INSTANCE_NAME="@demo@";
76     private CCActionTableModelInterface getModel(HandlerContext handlerCtx, ViewDescriptor desc) {
77         
78         CCActionTableModelInterface model =
79             (CCActionTableModelInterface)handlerCtx.getInputValue("model");
80         if (model == null) {
81             throw new FrameworkException("LogAnalyzerHandler.getModel: No Model Specified.",
82                 desc, handlerCtx.getView());
83         }
84         
85         return model;
86     }
87     
88
89     private void populateTable(RequestContext ctx, CCActionTableModelInterface model, Map JavaDoc[] attrsMap, Date JavaDoc selectedTimeStamp)
90         throws ModelControlException {
91         //System.out.println("!!!!! populateTable !!!");
92
model.beforeFirst();
93         DateFormat JavaDoc dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, ctx.getRequest().getLocale());
94           
95         for(int rowNo=0; rowNo < attrsMap.length; rowNo++){
96             model.appendRow();
97             Map JavaDoc attrs = attrsMap[rowNo];
98             
99             Long JavaDoc ms = (Long JavaDoc) attrs.get(LogAnalyzer.TIMESTAMP_KEY);
100             model.setValue("timeStamp", ms);
101             String JavaDoc formattedTime = dateFormat.format(new Date JavaDoc(ms.longValue()));
102             model.setValue("timeStampFormatted", formattedTime);
103             
104             Integer JavaDoc severe = (Integer JavaDoc) attrs.get(LogAnalyzer.SEVERE_COUNT_KEY);
105             Object JavaDoc obj = severe;
106             if (severe.intValue() < 0){
107                 obj = Util.getMessage("common.NA");
108             }
109             model.setValue("severeCount", obj);
110
111             Integer JavaDoc warning = (Integer JavaDoc) attrs.get(LogAnalyzer.WARNING_COUNT_KEY);
112             obj = warning;
113             if (warning.intValue() < 0){
114                 obj = Util.getMessage("common.NA");
115             }
116             model.setValue("warningCount", obj);
117
118         }
119     }
120     
121     private void printout(CCActionTableModelInterface model)
122     {
123         Object JavaDoc timeS = model.getValue("timeStamp");
124         String JavaDoc timeSClassName= timeS.getClass().getName();
125         String JavaDoc tformat = (String JavaDoc) model.getValue("timeStampFormatted");
126         Integer JavaDoc sc = (Integer JavaDoc) model.getValue("severeCount");
127         Integer JavaDoc wc = (Integer JavaDoc) model.getValue("warningCount");
128         //System.out.println("timeSClassName=" + timeSClassName + " timeS="+timeS + " tformat="+tformat + " sc="+sc + " wc="+wc );
129
}
130   
131     public void loadLogAnalyzerTable(RequestContext ctx, HandlerContext handlerCtx) {
132         //System.out.println("!!!!! loadLogAnalyzerTable !!!");
133
View view = handlerCtx.getView();
134         ViewDescriptor desc = null;
135         if (handlerCtx.getEvent() instanceof BeforeCreateEvent) {
136             desc = ((BeforeCreateEvent)handlerCtx.getEvent()).getViewDescriptor();
137     } else {
138             DescriptorContainerView descView = (DescriptorContainerView)
139                 (((ViewBase)view).getParentViewBean());
140             desc = descView.getViewDescriptor();
141         }
142
143         Map JavaDoc[] attrsMap = (Map JavaDoc[])handlerCtx.getInputValue("statisticsMap");
144         if (attrsMap == null || attrsMap.length == 0){
145             return;
146         }
147         Date JavaDoc selectedTimeStamp = (Date JavaDoc) handlerCtx.getInputValue("selectedTimeStamp");
148         try {
149             CCActionTableModelInterface model = getModel(handlerCtx, desc);
150             ((DefaultModel)model).clear();
151             model.setRowSelectionType("single");
152             populateTable(ctx, model, attrsMap, selectedTimeStamp);
153         } catch (Exception JavaDoc ex) {
154             throw new FrameworkException("loadAnalyzerTable: Loading error. ", ex, desc, view);
155         }
156     }
157     
158     static Map JavaDoc[] map68 = null;
159     static Map JavaDoc[] map10 = null;
160     
161     public void getStatisticsMap(RequestContext ctx, HandlerContext handlerCtx) {
162         //System.out.println("!!!!! getStatisticsMap !!!");
163
String JavaDoc objectName = (String JavaDoc)handlerCtx.getInputValue("objectName");
164         try{
165             ObjectName JavaDoc currentObjName = new ObjectName JavaDoc(objectName);
166             String JavaDoc serverName = currentObjName.getKeyProperty("server");
167             int count = (DEMO_INSTANCE_NAME.equals(serverName)) ? 68 : 5;
168             if (count == 68){
169                 if(map68 == null)
170                     map68 = getMap(count);
171                 handlerCtx.setOutputValue("output", map68);
172             }
173             else
174             if (count == 5){
175                 if(map10 == null)
176                     map10 = getMap(count);
177                 handlerCtx.setOutputValue("output", map10);
178             }
179         }catch (Exception JavaDoc ex){
180             ;
181         }
182     }
183     
184     private Map JavaDoc[] getMap(int count){
185         HashMap JavaDoc[] aMap = new HashMap JavaDoc[count];
186         Calendar JavaDoc rightNow = Calendar.getInstance();
187         rightNow.add(Calendar.HOUR, -count);
188         Random JavaDoc random = new Random JavaDoc();
189         for(int i=0; i<count; i++){
190             rightNow.add(Calendar.HOUR, 1);
191             long tt = rightNow.getTimeInMillis();
192             Long JavaDoc tLong = new Long JavaDoc(tt);
193             String JavaDoc tkey = LogAnalyzer.TIMESTAMP_KEY;
194             String JavaDoc wKey = LogAnalyzer.WARNING_COUNT_KEY;
195             String JavaDoc sKey = LogAnalyzer.SEVERE_COUNT_KEY;
196            
197             HashMap JavaDoc hm = new HashMap JavaDoc();
198             hm.put(tkey, tLong);
199             
200             int xx = Math.abs(random.nextInt()%30);
201             Integer JavaDoc xInt = new Integer JavaDoc(xx);
202             hm.put(wKey, xInt);
203             
204             int yy = Math.abs(random.nextInt()%30);
205             Integer JavaDoc yInt = new Integer JavaDoc(yy);
206             hm.put(sKey, yInt);
207             aMap[i] = hm;
208         }
209         return aMap;
210     }
211     
212     
213     public void revertArrayMap(RequestContext ctx, HandlerContext handlerCtx) {
214         Map JavaDoc[] inMap = (Map JavaDoc[])handlerCtx.getInputValue("inMap");
215         HashMap JavaDoc[] outMap = new HashMap JavaDoc[0];
216         
217         if(inMap != null && inMap.length > 0){
218             outMap = new HashMap JavaDoc[inMap.length];
219             for(int i=0, oix=inMap.length-1; i<inMap.length; i++, oix--){
220                 outMap[oix] = (HashMap JavaDoc) inMap[i];
221             }
222         }
223         handlerCtx.setOutputValue("outMap", outMap);
224
225     }
226     
227     public void convertToTimeStampArray(RequestContext ctx, HandlerContext handlerCtx) {
228         
229         Map JavaDoc[] attrsMap = (Map JavaDoc[])handlerCtx.getInputValue("inputMap");
230         View view = handlerCtx.getView();
231         DescriptorContainerView descView = (DescriptorContainerView)(((ViewBase)view).getParentViewBean());
232         ViewDescriptor desc = descView.getViewDescriptor();
233         if (attrsMap == null) {
234             throw new FrameworkException("LogAnalyzerHandler.convertToTimeStampArray: No attrsMap specified.",
235                 desc, handlerCtx.getView());
236         }
237         ArrayList JavaDoc timeStampArray = new ArrayList JavaDoc();
238         for (int rowNo = 0; rowNo < attrsMap.length; rowNo++) {
239             Map JavaDoc attrs = attrsMap[rowNo];
240             Long JavaDoc ms = (Long JavaDoc) attrs.get(LogAnalyzer.TIMESTAMP_KEY);
241             timeStampArray.add(ms.toString());
242         }
243         handlerCtx.setOutputValue("output", timeStampArray);
244     }
245     
246
247     public void getSelectedTimeStamp(RequestContext ctx, HandlerContext handlerCtx) {
248         //System.out.println("!!!!! getSelectedTimeStamp !!!");
249
View view = handlerCtx.getView();
250         DescriptorContainerView descView = (DescriptorContainerView)(((ViewBase)view).getParentViewBean());
251         ViewDescriptor desc = descView.getViewDescriptor();
252         CCActionTableModelInterface model =
253             (CCActionTableModelInterface)handlerCtx.getInputValue("model");
254         if (model == null) {
255             throw new FrameworkException("LogAnalyzerHandler.getSelectedTimeStamp: No Model Specified.",
256                 desc, handlerCtx.getView());
257         }
258         
259         model.setRowSelectionType("single");
260         try{
261             model.beforeFirst();
262             Object JavaDoc timeStamp = null;
263             Object JavaDoc fromKey = null;
264             while(model.next()) {
265                 if (model.isRowSelected()) {
266                     int index = model.getRowIndex();
267                     timeStamp = model.getValue("timeStamp");
268                     String JavaDoc classname = timeStamp.getClass().getName();
269                     //System.out.println( "from model, classname=" + classname);
270
}
271             }
272             if (timeStamp == null){
273                 //System.out.println("+++ in getSelectedTimeStamp: No timeStamp selected ");
274
}
275             handlerCtx.setOutputValue("selected", timeStamp);
276             
277         }catch(Exception JavaDoc ex) {
278         throw new FrameworkException("Unable to get Selected TimeStamp:", null, handlerCtx.getView());
279     }
280     }
281     
282    
283      public void setupChart(RequestContext ctx, HandlerContext handlerCtx) {
284         
285         View view = handlerCtx.getView();
286         DescriptorContainerView descView = (DescriptorContainerView)(((ViewBase)view).getParentViewBean());
287         ViewDescriptor desc = descView.getViewDescriptor();
288         
289         Map JavaDoc[] data = (Map JavaDoc[])handlerCtx.getInputValue("statisticsMap");
290         ArrayList JavaDoc timeStampArray = (ArrayList JavaDoc)handlerCtx.getInputValue("timeStampArray");
291         if (data == null ) {
292                 throw new FrameworkException("LogAnalyzerHandler.setupChart: No statisticsMap specified", desc, handlerCtx.getView());
293             }
294         if (timeStampArray == null ) {
295                 throw new FrameworkException("LogAnalyzerHandler.setupChart: No timeStampArray specified", desc, handlerCtx.getView());
296             }
297         
298         
299         
300         String JavaDoc selectedTime = (String JavaDoc)handlerCtx.getInputValue("selectedTime");
301         boolean showPrevious10 = Boolean.parseBoolean((String JavaDoc)handlerCtx.getInputValue("showPrevious10"));
302         boolean showNext10 = Boolean.parseBoolean((String JavaDoc)handlerCtx.getInputValue("showNext10"));
303         boolean useStartEnd = Boolean.parseBoolean((String JavaDoc)handlerCtx.getInputValue("useStartEnd"));
304         boolean showAll = Boolean.parseBoolean((String JavaDoc)handlerCtx.getInputValue("showAll"));
305         String JavaDoc startT = (String JavaDoc)handlerCtx.getInputValue("start");
306         String JavaDoc endT = (String JavaDoc)handlerCtx.getInputValue("end");
307         int selected = 0;
308         
309         boolean showPartial = false;
310         
311         if ( (selectedTime != null) || showPrevious10 || showNext10 || useStartEnd)
312             showPartial=true;
313     
314         if (!showPartial || showAll){
315              handlerCtx.setOutputValue("disableNext10", new Boolean JavaDoc("true"));
316              handlerCtx.setOutputValue("disablePrevious10", new Boolean JavaDoc("true"));
317              handlerCtx.setOutputValue("disableShowAll", "true");
318              handlerCtx.setOutputValue("output", data);
319              if (timeStampArray.size() < 11)
320                 handlerCtx.setOutputValue("disableZoomIn", "true");
321              else
322                 handlerCtx.setOutputValue("disableZoomIn", "false");
323              handlerCtx.setOutputValue("startTime", (String JavaDoc)timeStampArray.get(0));
324              handlerCtx.setOutputValue("endTime", (String JavaDoc)timeStampArray.get(timeStampArray.size()-1));
325              return;
326         }
327         
328         int start =0;
329         int end = timeStampArray.size()-1;
330         
331         if (useStartEnd && !showPrevious10 && !showNext10){
332             for(int i=0; i< timeStampArray.size(); i++){
333                  if ( ((String JavaDoc)timeStampArray.get(i)).equals( startT)){
334                      start = i;
335                      break;
336                  }
337              }
338             for(int i=0; i< timeStampArray.size(); i++){
339                  if ( ((String JavaDoc)timeStampArray.get(i)).equals( endT)){
340                      end = i;
341                      break;
342                  }
343              }
344             
345         }else{
346              if(showPrevious10){
347                  selectedTime = (String JavaDoc)handlerCtx.getInputValue("start");
348                  if (selectedTime == null) {
349                     throw new FrameworkException("LogAnalyzerHandler.setupChart: No start specified with showPrevious", desc, handlerCtx.getView());
350                 }
351              }else
352              if (showNext10){
353                  selectedTime = (String JavaDoc)handlerCtx.getInputValue("end");
354                  if (selectedTime == null) {
355                     throw new FrameworkException("LogAnalyzerHandler.setupChart: No end specified with showNext10", desc, handlerCtx.getView());
356                  }
357              }
358                  
359              for(int i=0; i< timeStampArray.size(); i++){
360                  if ( ((String JavaDoc)timeStampArray.get(i)).equals( selectedTime)){
361                      selected = i;
362                      break;
363                  }
364              }
365              
366              if (showPrevious10){
367                  if ( (selected-10) <= 0){
368                      start = 0;
369                      end = 9;
370                  }else{
371                      start = selected - 10;
372                      end = start + 9;
373                  }
374              }else
375              if (showNext10){
376                  start = selected + 1;
377                  if ( (start+9 ) >= end){
378                  }else{
379                      end = start+9;
380                  }
381              }
382              else
383              {
384                  //the size should always be > 10 when gets to here.
385
if ( (selected-5)>0 && ((selected+4)< timeStampArray.size()-1)){
386                     start = selected-5;
387                     end = selected+4;
388                  }else
389                  if ( (selected-5)<= 0){
390                      end = start +9;
391                  }else{
392                      start = end-9;
393                  }
394               }
395             }
396              
397              int s = start;
398              Map JavaDoc[] chartMap = new Map JavaDoc[end-start+1];
399              for(int i=0; i<chartMap.length; i++){
400                  chartMap[i] = data[s++];
401              }
402              
403              
404              handlerCtx.setOutputValue("disablePrevious10", new Boolean JavaDoc((start!=0) ? "false" : "true"));
405              handlerCtx.setOutputValue("disableNext10", new Boolean JavaDoc( (end < timeStampArray.size()-1) ? "false" : "true"));
406              handlerCtx.setOutputValue("output", chartMap);
407              handlerCtx.setOutputValue("startTime", (String JavaDoc)timeStampArray.get(start));
408              handlerCtx.setOutputValue("endTime", (String JavaDoc)timeStampArray.get(end));
409              handlerCtx.setOutputValue("useStartEnd", "true");
410              
411              handlerCtx.setOutputValue("disableZoomIn", (timeStampArray.size()<11) ? "true" : "false");
412              if(chartMap.length < timeStampArray.size())
413                  handlerCtx.setOutputValue("disableShowAll", "false");
414              else
415                  handlerCtx.setOutputValue("disableShowAll", "true");
416      }
417      
418       public void getFormatedTime(RequestContext ctx, HandlerContext handlerCtx) {
419           String JavaDoc ms = (String JavaDoc )handlerCtx.getInputValue("ms");
420           Date JavaDoc useThis = null;
421           if (ms == null || "".equals(ms)){
422             useThis = new Date JavaDoc(System.currentTimeMillis());
423           }else{
424               useThis = new Date JavaDoc( Long.parseLong(ms));
425           }
426           DateFormat JavaDoc dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, ctx.getRequest().getLocale());
427           String JavaDoc currentTime = dateFormat.format(useThis);
428           handlerCtx.setOutputValue("value", currentTime);
429        }
430
431       public void setupDistribution(RequestContext ctx, HandlerContext handlerCtx) {
432         
433         View view = handlerCtx.getView();
434         DescriptorContainerView descView = (DescriptorContainerView)(((ViewBase)view).getParentViewBean());
435         ViewDescriptor desc = descView.getViewDescriptor();
436         
437         Long JavaDoc selectedTime = new Long JavaDoc ((String JavaDoc )handlerCtx.getInputValue("selectedTime"));
438         String JavaDoc level = "SEVERE";
439         
440         if (selectedTime == null ) {
441             throw new FrameworkException("LogAnalyzerHandler.setupDistribution: No selectedTime specified", desc, handlerCtx.getView());
442         }
443         String JavaDoc serverName=(String JavaDoc)handlerCtx.getInputValue("instanceName") ;
444         
445         Map JavaDoc warningMap = null;
446         Map JavaDoc severeMap = null;
447         if (serverName.equals(DEMO_INSTANCE_NAME)){
448             warningMap = getDistributionSampleData(""+Level.WARNING);
449             severeMap = getDistributionSampleData(""+Level.SEVERE);
450         }else {
451             Map JavaDoc amp = (Map JavaDoc) AMXUtil.getMonitoringRoot().getServerRootMonitorMap();
452             ServerRootMonitor srm = (ServerRootMonitor) amp.get(serverName);
453             LogAnalyzer la = (LogAnalyzer) srm.getLogging();
454             warningMap = la.getErrorDistribution(selectedTime.longValue(), ""+Level.WARNING);
455             severeMap = la.getErrorDistribution(selectedTime.longValue(), ""+Level.SEVERE);
456         }
457         
458         
459         HashMap JavaDoc combinedMap = new HashMap JavaDoc();
460         // combine date from both map
461
Iterator JavaDoc iter = severeMap.keySet().iterator();
462         while (iter.hasNext()){
463             Object JavaDoc key = iter.next();
464             Integer JavaDoc value = (Integer JavaDoc) severeMap.get(key);
465             Integer JavaDoc counts[]={value, null};
466             combinedMap.put(key, counts);
467         }
468         
469         iter = warningMap.keySet().iterator();
470         while (iter.hasNext()){
471             Object JavaDoc key = iter.next();
472             Integer JavaDoc value = (Integer JavaDoc) warningMap.get(key);
473             Integer JavaDoc[] counts = (Integer JavaDoc[]) combinedMap.get(key);
474             if (counts == null){
475                 Integer JavaDoc[] vv = {null, value};
476                 combinedMap.put(key, vv);
477             }else{
478                 counts[1]=value;
479             }
480         }
481         handlerCtx.setOutputValue("combinedMap", combinedMap);
482       }
483       
484       private Map JavaDoc getDistributionSampleData(String JavaDoc level){
485           Map JavaDoc dMap = new HashMap JavaDoc();
486           Random JavaDoc random = new Random JavaDoc();
487           if (level.equals("SEVERE")){
488               dMap.put("javax.enterprise.system.container.web", new Integer JavaDoc(Math.abs(random.nextInt()%100)));
489               dMap.put("javax.enterprise.resource.corba.S1AS-ORB.rpc.transport", new Integer JavaDoc(Math.abs(random.nextInt()%100)));
490               dMap.put("javax.enterprise.system.core.transaction", new Integer JavaDoc(Math.abs(random.nextInt()%100)));
491               dMap.put("javax.enterprise.system.tools.admin", new Integer JavaDoc(Math.abs(random.nextInt()%100)));
492               dMap.put("javax.enterprise.system.container.ejb", new Integer JavaDoc(Math.abs(random.nextInt()%100)));
493               dMap.put("org.apache.catalina.startup.ContextConfig", new Integer JavaDoc(Math.abs(random.nextInt()%100)));
494               dMap.put("javax.enterprise.system.core", new Integer JavaDoc(Math.abs(random.nextInt()%100)));
495               
496           }else
497           {
498               dMap.put("org.apache.catalina.core.StandardEngine", new Integer JavaDoc(Math.abs(random.nextInt()%100)));
499               dMap.put("javax.enterprise.system.container.web", new Integer JavaDoc(Math.abs(random.nextInt()%100)));
500               dMap.put("javax.enterprise.resource.corba.S1AS-ORB.rpc.transport", new Integer JavaDoc(Math.abs(random.nextInt()%100)));
501               dMap.put("javax.enterprise.system.core.transaction", new Integer JavaDoc(Math.abs(random.nextInt()%100)));
502               dMap.put("javax.enterprise.system.tools.admin", new Integer JavaDoc(Math.abs(random.nextInt()%100)));
503           }
504           return dMap;
505       }
506
507       public void loadDistributionTable(RequestContext ctx, HandlerContext handlerCtx) {
508     View view = handlerCtx.getView();
509         ViewDescriptor desc = null;
510         if (handlerCtx.getEvent() instanceof BeforeCreateEvent) {
511             desc = ((BeforeCreateEvent)handlerCtx.getEvent()).getViewDescriptor();
512     } else {
513             DescriptorContainerView descView = (DescriptorContainerView)
514                 (((ViewBase)view).getParentViewBean());
515             desc = descView.getViewDescriptor();
516         }
517
518         Map JavaDoc combinedMap = (Map JavaDoc)handlerCtx.getInputValue("combinedMap");
519         try {
520             CCActionTableModelInterface model = getModel(handlerCtx, desc);
521             ((DefaultModel)model).clear();
522             model.beforeFirst();
523             Iterator JavaDoc iters = combinedMap.keySet().iterator();
524             while (iters.hasNext()){
525                 model.appendRow();
526                 Object JavaDoc key = iters.next();
527                 Integer JavaDoc[] value = (Integer JavaDoc[]) combinedMap.get(key);
528                 model.setValue("moduleId", key);
529                 if (value[0] != null)
530                     model.setValue("severeCount", value[0]);
531                 if (value[1] != null)
532                     model.setValue("warningCount", value[1]);
533             }
534         } catch (Exception JavaDoc ex) {
535             throw new FrameworkException("loadAnalyzerTable: Loading error. ", ex, desc, view);
536         }
537     }
538       
539 }
540
Popular Tags