1 24 34 35 package org.datashare.objects; 36 37 import java.util.Vector ; 38 39 51 public class ChannelDescription implements java.io.Serializable  52 { 53 57 static final long serialVersionUID = 9030546546411490936L; 58 59 63 public final static int UNKNOWN = 0; 64 65 69 public final static int TCP = 1; 70 71 75 public final static int UDP = 2; 76 77 81 public final static int MULTICAST = 3; 82 83 88 public static final String [] validTypes = {"Unknown","TCP","UDP","MultiCast"}; 89 90 94 public String channelName; 95 96 102 public String channelClass; 104 108 public String channelDescription; 109 110 114 public int type; 116 121 public String channelJarFileName; 123 127 public boolean persist; 129 134 public boolean allowPersistSelection = true; 136 143 public boolean selectionPreSet; 145 149 public int historyDelay = 0; 150 151 155 public int historyCountInc = 100; 156 157 164 public String mimeType; 166 171 public String fileExtension; 173 179 public String archiveChannelClass; 181 187 public String archiveChannelSetDataMethod; 189 195 public String archiveChannelGetDataMethod; 197 203 public ChannelDescription() 204 { 205 this("commandStatus", 206 "", 207 "communicates with Server", 208 ChannelDescription.TCP, 209 "", 210 false, 211 false, 212 false, 213 0, 214 0); 215 } 216 217 223 public ChannelDescription(String channelName, String channelDescription, int channelType) 224 { 225 this(channelName, 226 "", 227 channelDescription, 228 channelType, 229 "", 230 false, 231 false, 232 false, 233 0, 234 0); 235 } 236 237 251 public ChannelDescription(String channelName, 252 String channelClass, 253 String channelDescription, 254 int type, 255 String channelJarFileName, 256 boolean allowPersistSelection, 257 boolean persist, 258 boolean selectionPreSet, 259 int historyDelay, 260 int historyCountInc) 261 { 262 this.channelName = channelName; 263 this.channelClass = channelClass; 264 this.channelDescription = channelDescription; 265 this.type = type; 266 this.channelJarFileName = channelJarFileName; 267 this.allowPersistSelection = allowPersistSelection; 268 this.persist = persist; 269 this.selectionPreSet = selectionPreSet; 270 this.historyDelay = historyDelay; 271 this.historyCountInc = historyCountInc; 272 } 273 274 289 public ChannelDescription(String channelName, 290 String channelClass, 291 String channelDescription, 292 String channelType, String channelJarFileName, 294 boolean allowPersistSelection, 295 boolean persist, 296 boolean selectionPreSet, 297 int historyDelay, 298 int historyCountInc) 299 { 300 this(channelName, channelClass, channelDescription, convertStringTypeToInt(channelType), channelJarFileName, allowPersistSelection, persist, selectionPreSet, historyDelay, historyCountInc ); 301 } 302 303 322 public ChannelDescription(String channelName, 323 String channelClass, 324 String channelDescription, 325 int type, 326 String channelJarFileName, 327 boolean allowPersistSelection, 328 boolean persist, 329 boolean selectionPreSet, 330 int historyDelay, 331 int historyCountInc, 332 String mimeType, String fileExtension, 334 String archiveChannelClass, String archiveChannelSetDataMethod, String archiveChannelGetDataMethod ) 338 { 339 this(channelName, channelClass, channelDescription, type, channelJarFileName, allowPersistSelection, persist, selectionPreSet, historyDelay, historyCountInc); 340 this.mimeType = mimeType; 341 this.fileExtension = fileExtension; 342 this.archiveChannelClass = archiveChannelClass; 343 this.archiveChannelSetDataMethod = archiveChannelSetDataMethod; 344 this.archiveChannelGetDataMethod = archiveChannelGetDataMethod; 345 } 346 347 366 public ChannelDescription(String channelName, 367 String channelClass, 368 String channelDescription, 369 String channelType, 370 String channelJarFileName, 371 boolean allowPersistSelection, 372 boolean persist, 373 boolean selectionPreSet, 374 int historyDelay, 375 int historyCountInc, 376 String mimeType, String fileExtension, 378 String archiveChannelClass, String archiveChannelSetDataMethod, String archiveChannelGetDataMethod ) 382 { 383 this(channelName, channelClass, channelDescription, convertStringTypeToInt(channelType), channelJarFileName, allowPersistSelection, persist, selectionPreSet, historyDelay, historyCountInc, 384 mimeType, fileExtension, archiveChannelClass, archiveChannelSetDataMethod, archiveChannelGetDataMethod); 385 } 386 387 392 private static int 393 convertStringTypeToInt(String channelType) 394 { 395 int type = TCP; for(int x=0; x<validTypes.length; x++) 397 { 398 if(channelType.toLowerCase().equals(validTypes[x].toLowerCase())) 399 { 400 type = x; 401 break; 402 } 403 } 404 405 return type; 406 } 407 408 } 409
| Popular Tags
|