01: package com.sun.portal.netlet.monitoring.statistics;
02:
03: import com.sun.portal.monitoring.statistics.StatisticImpl;
04: import com.sun.portal.netlet.eproxy.RWGroupCrypt;
05: import com.sun.portal.netlet.eproxy.NetletGroup;
06:
07: /**
08: * author: Noble Paul
09: * Date: Feb 15, 2005, 2:58:38 PM
10: */
11: public class NetletConnectionStatisticImpl extends StatisticImpl {
12: private String userId, netletRule;
13: // private long bytesSent,bytesReceived,duration;
14: private RWGroupCrypt rwGroupcrypt;
15:
16: public NetletConnectionStatisticImpl(String user,
17: RWGroupCrypt rwGroupCrypt) {
18: this .userId = user;
19: this .rwGroupcrypt = rwGroupCrypt;
20: netletRule = NetletGroup.getRulenameForPort(new Integer(
21: rwGroupCrypt.getAppletSrcPort()));
22: }
23:
24: public String getUserId() {
25: return userId;
26: }
27:
28: public String getDestination() {
29: return rwGroupcrypt.getDestHost() + "_"
30: + rwGroupcrypt.getDestPort();
31: }
32:
33: public String getNetletRule() {
34: return netletRule;
35: }
36:
37: public long getBytesSent() {
38: if (rwGroupcrypt.getReaderWriterEncrypt() == null)
39: return 0;
40: return rwGroupcrypt.getReaderWriterEncrypt()
41: .getBytesTransferred();
42: }
43:
44: public long getBytesReceived() {
45: if (rwGroupcrypt.getReaderWriterDecrypt() == null)
46: return 0;
47: return rwGroupcrypt.getReaderWriterDecrypt()
48: .getBytesTransferred();
49: }
50:
51: public long getDuration() {
52: return System.currentTimeMillis()
53: - this .rwGroupcrypt.getStartTime();
54: }
55:
56: public long getLastSampleTime() {
57: return System.currentTimeMillis();
58: }
59: }
|