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.UBTLogConstants;
09: import com.sun.portal.ubt.report.data.UBTLogLine;
10: import com.sun.portal.ubt.report.data.UserID;
11:
12: import java.util.TreeMap;
13:
14: /**
15: *
16: */
17: public class ChannelRenderMiner extends DataMinerAdapter {
18: TreeMap channelWiseRender = new TreeMap(); //Map(Container, Map(channel, Map(User, count)))
19:
20: public ChannelRenderMiner() {
21:
22: }
23:
24: public void setMinerCollection(MinerCollection collection) {
25:
26: }
27:
28: public void mine(UBTLogLine logLine) throws Exception {
29: if (!(logLine.getEventID()
30: .startsWith(UBTLogConstants.EVENT_PROVIDER_RENDER))
31: || logLine.getContainerName() == null)
32: return;
33: String containerName = logLine.getContainerName();
34: String channelName = logLine.getChannelName();
35: String user = new UserID(logLine.getUserID()).getUid();
36: if (channelWiseRender.containsKey(containerName)) {
37: TreeMap containerMap = (TreeMap) channelWiseRender
38: .get(containerName);
39: if (containerMap.containsKey(channelName)) {
40: TreeMap channelMap = (TreeMap) containerMap
41: .get(channelName);
42: if (channelMap.containsKey(user)) {
43: Integer count = (Integer) channelMap.get(user);
44: count = new Integer(count.intValue() + 1);
45: channelMap.put(user, count);
46: } else {
47: channelMap.put(user, new Integer(1));
48: }
49: } else {
50: TreeMap channelMap = new TreeMap();
51: channelMap.put(user, new Integer(1));
52: containerMap.put(channelName, channelMap);
53: }
54: } else {
55: TreeMap containerMap = new TreeMap();
56: TreeMap channelMap = new TreeMap();
57: channelMap.put(user, new Integer(1));
58: containerMap.put(channelName, channelMap);
59: channelWiseRender.put(containerName, containerMap);
60: }
61: }
62:
63: public Object getData() {
64: return channelWiseRender;
65: }
66:
67: public void setData(Object data) {
68: channelWiseRender = (TreeMap) data;
69: }
70: }
|