home *** CD-ROM | disk | FTP | other *** search
- import java.net.InetAddress;
- import java.util.Date;
- import java.util.Hashtable;
- import java.util.Vector;
-
- public class JDPJaggUser {
- Hashtable info = new Hashtable();
- Vector requests = new Vector();
- int totalRequests;
- long totalReceived;
- long totalTransmitted;
- public static final int ACTIVE = 0;
- public static final int IDLE = 1;
- public static final int DISCONNECTED = 2;
- public static final int SUCCESS = 10;
- public static final int FAIL = 11;
- public static final int UNKNOWN = 12;
-
- public InetAddress getInetAddress() {
- return this.info.get("InetAddress") == null ? null : (InetAddress)this.info.get("InetAddress");
- }
-
- public void setInetAddress(InetAddress var1) {
- if (var1 != null) {
- this.info.put("InetAddress", var1);
- }
-
- }
-
- public void addActiveRequest(JaggServerCxn var1) {
- this.setUserStatus(0);
- this.requests.addElement(var1);
- }
-
- public int getUserStatus() {
- return (Integer)this.info.get("UserStatus");
- }
-
- public void setUserStatus(int var1) {
- if (var1 >= 0 && var1 <= 2) {
- this.info.put("UserStatus", new Integer(var1));
- }
-
- }
-
- public long getLastConnectionDuration() {
- return (Long)this.info.get("lastConnectionDuration");
- }
-
- public void setLastConnectionDuration(long var1) {
- this.info.put("lastConnectionDuration", new Long(var1));
- }
-
- public synchronized void incrementTotalRequest() {
- ++this.totalRequests;
- }
-
- public long getBytesReceived() {
- return this.totalReceived;
- }
-
- public synchronized void incrementBytesTransmitted(long var1) {
- this.totalTransmitted += var1;
- }
-
- public Date getLastConnectionEnd() {
- return (Date)this.info.get("lastConnectionEnd");
- }
-
- public void setLastConnectionEnd(Date var1) {
- if (var1 == null) {
- this.info.remove("lastConnectionEnd");
- } else {
- this.setUserStatus(1);
- this.info.put("lastConnectionEnd", var1);
- }
- }
-
- public String getJDPSystem() {
- return (String)this.info.get("JDPSystem");
- }
-
- public void setJDPSystem(String var1) {
- this.info.put("JDPSystem", var1);
- }
-
- public long getIdleFor() {
- Date var1 = this.getLastConnectionStart();
- Date var2 = this.getLastConnectionEnd();
- if (var1 != null && var2 != null) {
- return var1.getTime() > var2.getTime() ? (new Date()).getTime() - var1.getTime() : (new Date()).getTime() - var2.getTime();
- } else if (var2 != null) {
- return (new Date()).getTime() - var2.getTime();
- } else {
- return var1 != null ? (new Date()).getTime() - var1.getTime() : 0L;
- }
- }
-
- public Date getLastConnectionStart() {
- return (Date)this.info.get("lastConnectionStart");
- }
-
- public void setLastConnectionStart(Date var1) {
- if (var1 == null) {
- this.info.remove("lastConnectionStart");
- } else {
- this.info.put("lastConnectionStart", var1);
- }
- }
-
- public JDPJaggUser(InetAddress var1, int var2, String var3) {
- this.setInetAddress(var1);
- this.setJDPUser(var2);
- this.setJDPSystem(var3);
- this.setLastConnectionDuration(0L);
- }
-
- public int getJDPUser() {
- return (Integer)this.info.get("JDPUser");
- }
-
- public void setJDPUser(int var1) {
- this.info.put("JDPUser", new Integer(var1));
- }
-
- public synchronized void incrementBytesReceived(long var1) {
- this.totalReceived += var1;
- }
-
- public Vector getActiveRequests() {
- return this.requests;
- }
-
- public void removeActiveRequest(JaggServerCxn var1) {
- this.setUserStatus(2);
- this.requests.removeElement(var1);
- }
-
- public int getTotalRequests() {
- return this.totalRequests;
- }
-
- public long getBytesTransmitted() {
- return this.totalTransmitted;
- }
- }
-