01: /*
02: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.ubt.report.data.file.raw;
06:
07: import com.sun.portal.ubt.report.data.MinerCollection;
08: import com.sun.portal.ubt.report.data.UBTLogLine;
09:
10: import java.util.TreeMap;
11:
12: /**
13: * portlets rendered in various supported modes
14: */
15: public abstract class PortletMiner extends DataMinerAdapter {
16: protected TreeMap data = new TreeMap(); //map(portlet, map(mode, map(windowstate, count))) [portlet -> entityID]
17: protected String event;
18:
19: public void setMinerCollection(MinerCollection collection) {
20:
21: }
22:
23: public void mine(UBTLogLine logLine) throws Exception {
24: if (!(event.equals(logLine.getEventID())))
25: return;
26: String portlet = logLine.getEntityID();
27: String mode = logLine.getMode();
28: String windowstate = logLine.getWindowState();
29: if (portlet == null || mode == null | windowstate == null)
30: return;
31: if (data.containsKey(portlet)) {
32: TreeMap portletMap = (TreeMap) data.get(portlet);
33: if (portletMap.containsKey(mode)) {
34: TreeMap modeMap = (TreeMap) portletMap.get(mode);
35: if (modeMap.containsKey(windowstate)) {
36: modeMap.put(windowstate, new Integer(
37: ((Integer) modeMap.get(windowstate))
38: .intValue() + 1));
39: } else {
40: modeMap.put(windowstate, new Integer(1));
41: }
42: } else {
43: TreeMap modeMap = new TreeMap();
44: modeMap.put(windowstate, new Integer(1));
45: portletMap.put(mode, modeMap);
46: }
47: } else {
48: TreeMap portletMap = new TreeMap();
49: TreeMap modeMap = new TreeMap();
50: modeMap.put(windowstate, new Integer(1));
51: portletMap.put(mode, modeMap);
52: data.put(portlet, portletMap);
53: }
54: }
55:
56: public Object getData() {
57: return data;
58: }
59: }
|