%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.statistics.impl.UserStatsImpl |
|
|
1 | /* |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 | * |
|
11 | * Unless required by applicable law or agreed to in writing, software |
|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 | * See the License for the specific language governing permissions and |
|
15 | * limitations under the License. |
|
16 | */ |
|
17 | package org.apache.jetspeed.statistics.impl; |
|
18 | ||
19 | import java.net.InetAddress; |
|
20 | import java.net.UnknownHostException; |
|
21 | ||
22 | import org.apache.jetspeed.statistics.UserStats; |
|
23 | ||
24 | /** |
|
25 | * UserStatsImpl |
|
26 | * |
|
27 | * @author <a href="mailto:chris@bluesunrise.com">Chris Schaefer </a> |
|
28 | * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a> |
|
29 | * @version $Id: $ |
|
30 | */ |
|
31 | 0 | public class UserStatsImpl implements UserStats |
32 | { |
|
33 | ||
34 | private String username; |
|
35 | ||
36 | private int numberOfSessions; |
|
37 | ||
38 | private InetAddress inetAddress; |
|
39 | ||
40 | /* |
|
41 | * (non-Javadoc) |
|
42 | * |
|
43 | * @see org.apache.jetspeed.statistics.UserStats#getNumberOfSessions() |
|
44 | */ |
|
45 | public int getNumberOfSessions() |
|
46 | { |
|
47 | 0 | return numberOfSessions; |
48 | } |
|
49 | ||
50 | /* |
|
51 | * (non-Javadoc) |
|
52 | * |
|
53 | * @see org.apache.jetspeed.statistics.UserStats#getUsername() |
|
54 | */ |
|
55 | public String getUsername() |
|
56 | { |
|
57 | ||
58 | 0 | return username; |
59 | } |
|
60 | ||
61 | /* |
|
62 | * (non-Javadoc) |
|
63 | * |
|
64 | * @see org.apache.jetspeed.statistics.UserStats#setNumberOfSession(int) |
|
65 | */ |
|
66 | public void setNumberOfSession(int number) |
|
67 | { |
|
68 | 0 | numberOfSessions = number; |
69 | ||
70 | 0 | } |
71 | ||
72 | /* |
|
73 | * (non-Javadoc) |
|
74 | * |
|
75 | * @see org.apache.jetspeed.statistics.UserStats#setUsername(java.lang.String) |
|
76 | */ |
|
77 | public void setUsername(String username) |
|
78 | { |
|
79 | 0 | this.username = username; |
80 | ||
81 | 0 | } |
82 | ||
83 | /* (non-Javadoc) |
|
84 | * @see org.apache.jetspeed.statistics.UserStats#getInetAddress() |
|
85 | */ |
|
86 | public InetAddress getInetAddress() { |
|
87 | 0 | return inetAddress; |
88 | } |
|
89 | ||
90 | /* (non-Javadoc) |
|
91 | * @see org.apache.jetspeed.statistics.UserStats#setInetAddress(java.net.InetAddress) |
|
92 | */ |
|
93 | public void setInetAddress(InetAddress inetAddress) { |
|
94 | 0 | this.inetAddress = inetAddress; |
95 | 0 | } |
96 | ||
97 | /* (non-Javadoc) |
|
98 | * @see org.apache.jetspeed.statistics.UserStats#setInetAddressFromIp(java.lang.String) |
|
99 | */ |
|
100 | public void setInetAddressFromIp(String ip) throws UnknownHostException { |
|
101 | 0 | this.inetAddress = InetAddress.getByName(ip); |
102 | 0 | } |
103 | ||
104 | /** |
|
105 | * Checks whether these two object match. Simple check for |
|
106 | * just the ipaddresse and username. |
|
107 | * |
|
108 | * @param Object instanceof UserStats |
|
109 | */ |
|
110 | public boolean equals(Object obj) { |
|
111 | ||
112 | 0 | if(!(obj instanceof UserStats)) |
113 | 0 | return false; |
114 | ||
115 | 0 | UserStats userstat = (UserStats)obj; |
116 | 0 | return this.inetAddress.equals(userstat.getInetAddress()) && class="keyword">this.username.equals(userstat.getUsername()); |
117 | } |
|
118 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |