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: import com.sun.portal.ubt.report.data.UserID;
10:
11: import java.util.*;
12:
13: /**
14: *
15: */
16: public class UserIdentityMiner extends DataMinerAdapter {
17: TreeMap userIdenData = new TreeMap(new ArrayComparator()); //([server,domain,rdn,user],lastaccess)
18: Vector miners = null;
19: long startTime = 0;
20: long endTime = Long.MAX_VALUE;
21: String serverName = "default";
22: private boolean available = true;
23: Set userSet = new TreeSet();
24:
25: public UserIdentityMiner() {
26: //tMap.put(serverName, )
27: }
28:
29: public void setDuartion(long startTime, long endTime) {
30: this .startTime = startTime;
31: this .endTime = endTime;
32: }
33:
34: public void setMinerCollection(MinerCollection collection) {
35: miners = collection.getCollection();
36: }
37:
38: public void mine(UBTLogLine logLine) {
39: //if time is less than starttime || more than endtime return
40: long time = Long.parseLong(logLine.getTimestamp());
41: if (time < startTime || time > endTime)
42: return;
43: //if servername is not there, we have a case of either data for a server
44: // or inconsistent data. Both the cases, server names are not considered
45: // use default
46: String server = serverName;
47: if (logLine.getServerHost() != null) {
48: server = logLine.getServerHost();
49: String port = null;
50: if ((port = logLine.getServerPort()) != null)
51: server = server + ":" + port;
52: }
53: if (logLine.getUserID() == null) {
54: available = false;
55: return; // this mining is not for this log
56: }
57: UserID user = new UserID(logLine.getUserID());
58: //userIdenData.put(user.getUid(),new String[]{server,user.getDc(),user.getRdn(),logLine.getTimestamp()});
59: userIdenData.put(new String[] { server, user.getDc(),
60: user.getRdn(), user.getUid() }, logLine.getTimestamp());
61: }
62:
63: public Object getData() {
64: return this .userIdenData; //To change body of implemented methods use File | Settings | File Templates.
65: }
66:
67: public void setData(Object data) {
68: userIdenData = (TreeMap) data;
69: }
70:
71: public long getStartTime() {
72: return this .startTime;
73: }
74:
75: public long getEndTime() {
76: return this .endTime;
77: }
78:
79: public boolean available() {
80: return available;
81: }
82: }
|