1 17 package org.alfresco.filesys.netbios.server; 18 19 import org.alfresco.filesys.netbios.NetBIOSName; 20 21 26 class NetBIOSRequest 27 { 28 29 31 public final static int AddName = 0; 32 public final static int DeleteName = 1; 33 public final static int RefreshName = 2; 34 35 37 public final static int DefaultRetries = 5; 38 public final static long DefaultInterval = 2000; 40 42 private final static String [] _typeNames = { "AddName", "DelName", "RefreshName" }; 43 44 46 private int m_type; 47 48 50 private NetBIOSName m_nbName; 51 52 54 private int m_retry; 55 private long m_retryIntvl; 56 57 59 private boolean m_error; 60 61 63 private int m_tranId; 64 65 72 public NetBIOSRequest(int typ, NetBIOSName nbName, int tranId) 73 { 74 m_type = typ; 75 m_nbName = nbName; 76 m_tranId = tranId; 77 78 m_retry = DefaultRetries; 79 m_retryIntvl = DefaultInterval; 80 81 m_error = false; 82 } 83 84 92 public NetBIOSRequest(int typ, NetBIOSName nbName, int tranId, int retry) 93 { 94 m_type = typ; 95 m_nbName = nbName; 96 m_tranId = tranId; 97 98 m_retry = retry; 99 m_retryIntvl = DefaultInterval; 100 101 m_error = false; 102 } 103 104 109 public final int isType() 110 { 111 return m_type; 112 } 113 114 119 public final String getTypeAsString() 120 { 121 if (m_type < 0 || m_type >= _typeNames.length) 122 return ""; 123 return _typeNames[m_type]; 124 } 125 126 131 public final NetBIOSName getNetBIOSName() 132 { 133 return m_nbName; 134 } 135 136 141 public final int getRetryCount() 142 { 143 return m_retry; 144 } 145 146 151 public final long getRetryInterval() 152 { 153 return m_retryIntvl; 154 } 155 156 161 public final int getTransactionId() 162 { 163 return m_tranId; 164 } 165 166 171 public final boolean hasErrorStatus() 172 { 173 return m_error; 174 } 175 176 181 protected final int decrementRetryCount() 182 { 183 return m_retry--; 184 } 185 186 191 protected final void setErrorStatus(boolean sts) 192 { 193 m_error = sts; 194 } 195 196 201 public final void setRetryCount(int retry) 202 { 203 m_retry = retry; 204 } 205 206 211 public final void setRetryInterval(long interval) 212 { 213 m_retryIntvl = interval; 214 } 215 216 221 public String toString() 222 { 223 StringBuffer str = new StringBuffer (); 224 225 str.append("["); 226 str.append(getTypeAsString()); 227 str.append(":"); 228 str.append(getNetBIOSName()); 229 str.append(","); 230 str.append(getRetryCount()); 231 str.append(","); 232 str.append(getRetryInterval()); 233 str.append(","); 234 str.append(getTransactionId()); 235 str.append("]"); 236 237 return str.toString(); 238 } 239 } 240 | Popular Tags |