1 24 36 37 package org.datashare; 38 39 import java.net.InetAddress ; 40 import org.datashare.objects.DataShareObject; 41 import java.util.Date ; 42 import java.util.GregorianCalendar ; 43 44 47 public abstract class SocketAdapter 48 { 49 protected String clientKey = ""; protected String clientClass = ""; 51 protected boolean admin = false; private boolean active = false; 53 protected String keyValue = ""; protected InetAddress remoteIP = null; 55 protected int remotePort; 56 protected InetAddress localIP = null; 57 protected int localPort; 58 protected DataReceiverInterface dri = null; 59 private Date creationDate = null; 60 61 64 SocketAdapter() 65 { 66 creationDate = new GregorianCalendar ().getTime(); 67 } 68 69 73 abstract void sendData(DataShareObject dsObject); 74 75 78 abstract void xmitData(DataShareObject dsObject); 79 80 83 abstract int getType(); 84 85 88 abstract void close(); 89 90 93 Date getCreationDate() 94 { 95 return creationDate; 96 } 97 98 101 String getClientKey() 102 { 103 return clientKey; 104 } 105 106 109 void setClientKey(String clientKey) 110 { 111 if(!clientKey.equals("")) 112 this.clientKey = clientKey; 113 } 114 115 118 String getClientClass() 119 { 120 return clientClass; 121 } 122 123 126 void setClientClass(String clientClass) 127 { 128 if(!clientClass.equals("")) 129 this.clientClass = clientClass; 130 } 131 132 135 boolean getActive() 136 { 137 return active; 138 } 139 140 143 void setActive(boolean active) 144 { 145 SessionUtilities.getLoggingInterface().debugMsg(SessionUtilities.getLoggingInterface().DEBUG, 146 SessionUtilities.getLoggingInterface().NETWORK, 147 "Setting SocketAdapter.active to " + (active?"true":"false") + " for " + this.getKeyValue()); 148 this.active = active; 149 } 150 151 154 void setAdmin(boolean admin) 155 { 156 this.admin = admin; 157 } 158 159 162 boolean getAdmin() 163 { 164 return admin; 165 } 166 167 170 String getKeyValue() 171 { 172 return keyValue; 173 } 174 175 178 void setKeyValue(String keyValue) 179 { 180 if(!keyValue.equals("")) 181 this.keyValue = keyValue; 182 } 183 184 187 InetAddress getRemoteIP() 188 { 189 return remoteIP; 190 } 191 192 195 void setRemoteIP(InetAddress remoteIP) 196 { 197 this.remoteIP = remoteIP; 198 } 199 200 203 InetAddress getLocalIP() 204 { 205 return localIP; 206 } 207 208 211 void setLocalIP(InetAddress localIP) 212 { 213 this.localIP = localIP; 214 } 215 216 219 int getRemotePort() 220 { 221 return remotePort; 222 } 223 224 227 void setRemotePort(int remotePort) 228 { 229 this.remotePort = remotePort; 230 } 231 232 235 int getLocalPort() 236 { 237 return localPort; 238 } 239 240 243 void setLocalPort(int localPort) 244 { 245 this.localPort = localPort; 246 } 247 } 248 | Popular Tags |