1 17 package org.alfresco.filesys.server.auth.passthru; 18 19 import java.net.*; 20 import java.util.*; 21 22 28 public class PassthruServerDetails 29 { 30 32 private String m_name; 33 private String m_domain; 34 private InetAddress m_address; 35 36 38 private boolean m_online; 39 40 42 private int m_authCount; 43 private long m_lastAuthTime; 44 45 53 PassthruServerDetails(String name, String domain, InetAddress addr, boolean online) 54 { 55 m_name = name; 56 m_domain = domain; 57 m_address = addr; 58 m_online = online; 59 } 60 61 66 public final String getName() 67 { 68 return m_name; 69 } 70 71 76 public final String getDomain() 77 { 78 return m_domain; 79 } 80 81 86 public final InetAddress getAddress() 87 { 88 return m_address; 89 } 90 91 96 public final boolean isOnline() 97 { 98 return m_online; 99 } 100 101 106 public final int getAuthenticationCount() 107 { 108 return m_authCount; 109 } 110 111 116 public final long getAuthenticationDateTime() 117 { 118 return m_lastAuthTime; 119 } 120 121 126 public final void setOnline(boolean online) 127 { 128 m_online = online; 129 } 130 131 134 public synchronized final void incrementAuthenticationCount() 135 { 136 m_authCount++; 137 m_lastAuthTime = System.currentTimeMillis(); 138 } 139 140 145 public int hashCode() 146 { 147 return m_address.hashCode(); 148 } 149 150 155 public String toString() 156 { 157 StringBuilder str = new StringBuilder (); 158 159 str.append("["); 160 if ( getDomain() != null) 161 { 162 str.append(getDomain()); 163 str.append("\\"); 164 } 165 str.append(getName()); 166 167 str.append(":"); 168 str.append(getAddress().getHostAddress()); 169 170 str.append(isOnline() ? ":Online" : ":Offline"); 171 172 str.append(":"); 173 str.append(getAuthenticationCount()); 174 str.append(","); 175 str.append(getAuthenticationDateTime() != 0L ? new Date(getAuthenticationDateTime()) : "0"); 176 str.append("]"); 177 178 return str.toString(); 179 } 180 } 181 | Popular Tags |