1 22 package org.jboss.resource.metadata; 23 24 import java.net.URL ; 25 import java.util.Collection ; 26 import java.util.HashSet ; 27 import java.util.Iterator ; 28 import java.util.Locale ; 29 30 import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap; 31 32 38 public class ConnectorMetaData extends ConfigPropertyMetaDataContainer 39 { 40 private static final long serialVersionUID = -3049391010669865389L; 41 42 43 private URL url; 44 45 46 private String version = "1.0"; 47 48 49 private String vendorName; 50 51 52 private String eisType; 53 54 55 private String raVersion; 56 57 58 private String raClass; 59 60 61 private boolean reauthenticationSupport; 62 63 64 private LicenseMetaData lmd = new LicenseMetaData(); 65 66 67 private ConcurrentReaderHashMap descriptions = new ConcurrentReaderHashMap(); 68 69 70 private HashSet connectionDefinitions = new HashSet (); 71 72 73 private TransactionSupportMetaData tsmd = new TransactionSupportMetaData(); 74 75 76 private AuthenticationMechanismMetaData ammd = new AuthenticationMechanismMetaData(); 77 78 79 private HashSet listeners = new HashSet (); 80 81 82 private HashSet adminObjects = new HashSet (); 83 84 85 private HashSet securityPermissions = new HashSet (); 86 87 public ConnectorMetaData() 88 { 89 DescriptionGroupMetaData dmd = new DescriptionGroupMetaData(); 90 descriptions.put(dmd.getLanguage(), dmd); 91 } 92 93 98 public URL getURL() 99 { 100 return url; 101 } 102 103 108 public void setURL(URL url) 109 { 110 this.url = url; 111 } 112 113 118 public String getVersion() 119 { 120 return version; 121 } 122 123 128 public void setVersion(String version) 129 { 130 this.version = version; 131 } 132 133 138 public String getVendorName() 139 { 140 return vendorName; 141 } 142 143 148 public void setVendorName(String vendorName) 149 { 150 this.vendorName = vendorName; 151 } 152 153 158 public String getEISType() 159 { 160 return eisType; 161 } 162 163 168 public void setEISType(String eisType) 169 { 170 this.eisType = eisType; 171 } 172 173 178 public String getRAVersion() 179 { 180 return raVersion; 181 } 182 183 188 public void setRAVersion(String version) 189 { 190 this.raVersion = version; 191 } 192 193 198 public String getRAClass() 199 { 200 return raClass; 201 } 202 203 208 public void setRAClass(String raClass) 209 { 210 this.raClass = raClass; 211 } 212 213 218 public boolean getReauthenticationSupport() 219 { 220 return reauthenticationSupport; 221 } 222 223 228 public void setReauthenticationSupport(boolean reauthenticationSupport) 229 { 230 this.reauthenticationSupport = reauthenticationSupport; 231 } 232 233 238 public LicenseMetaData getLicense() 239 { 240 return lmd; 241 } 242 243 248 public DescriptionGroupMetaData getDescription() 249 { 250 DescriptionGroupMetaData dgmd = (DescriptionGroupMetaData) descriptions.get(Locale.getDefault().getLanguage()); 251 if (dgmd == null) 253 { 254 for (Iterator i = descriptions.values().iterator(); i.hasNext();) 255 { 256 dgmd = (DescriptionGroupMetaData) i.next(); 257 break; 258 } 259 } 260 return dgmd; 261 } 262 263 269 public DescriptionGroupMetaData getDescription(String lang) 270 { 271 return (DescriptionGroupMetaData) descriptions.get(lang); 272 } 273 274 279 public void addDescription(DescriptionGroupMetaData dmd) 280 { 281 descriptions.put(dmd.getLanguage(), dmd); 282 } 283 284 289 public TransactionSupportMetaData getTransactionSupport() 290 { 291 return tsmd; 292 } 293 294 299 public void setTransactionSupport(TransactionSupportMetaData tsmd) 300 { 301 this.tsmd = tsmd; 302 } 303 308 public AuthenticationMechanismMetaData getAuthenticationMechanism() 309 { 310 return ammd; 311 } 312 313 318 public void setAuthenticationMechansim(AuthenticationMechanismMetaData ammd) 319 { 320 this.ammd = ammd; 321 } 322 323 328 public void addConnectionDefinition(ConnectionDefinitionMetaData cdmd) 329 { 330 connectionDefinitions.add(cdmd); 331 } 332 333 339 public ConnectionDefinitionMetaData getConnectionDefinition(String connectionDefinition) 340 { 341 for (Iterator i = connectionDefinitions.iterator(); i.hasNext();) 342 { 343 ConnectionDefinitionMetaData cdmd = (ConnectionDefinitionMetaData) i.next(); 344 if (cdmd.getConnectionFactoryInterfaceClass().equals(connectionDefinition)) 345 return cdmd; 346 } 347 return null; 348 } 349 350 355 public void addMessageListener(MessageListenerMetaData mlmd) 356 { 357 listeners.add(mlmd); 358 } 359 360 366 public MessageListenerMetaData getMessageListener(String messagingType) 367 { 368 for (Iterator i = listeners.iterator(); i.hasNext();) 369 { 370 MessageListenerMetaData mlmd = (MessageListenerMetaData) i.next(); 371 if (mlmd.getType().equals(messagingType)) 372 return mlmd; 373 } 374 return null; 375 } 376 377 382 public void addAdminObject(AdminObjectMetaData aomd) 383 { 384 adminObjects.add(aomd); 385 } 386 387 393 public AdminObjectMetaData getAdminObject(String interfaceName) 394 { 395 for (Iterator i = adminObjects.iterator(); i.hasNext();) 396 { 397 AdminObjectMetaData aomd = (AdminObjectMetaData) i.next(); 398 if (aomd.getAdminObjectInterfaceClass().equals(interfaceName)) 399 return aomd; 400 } 401 return null; 402 } 403 404 public Collection getAdminObjects() 405 { 406 return adminObjects; 407 } 408 409 414 public void addSecurityPermission(SecurityPermissionMetaData spmd) 415 { 416 securityPermissions.add(spmd); 417 } 418 419 public String toString() 420 { 421 StringBuffer buffer = new StringBuffer (); 422 buffer.append("ConnectorMetaData").append('@'); 423 buffer.append(Integer.toHexString(System.identityHashCode(this))); 424 buffer.append("[version=").append(version); 425 buffer.append(" vendorName=").append(vendorName); 426 buffer.append(" eisType=").append(eisType); 427 buffer.append(" resourceAdapterVersion=").append(raVersion); 428 buffer.append(" resourceAdapterClass=").append(raClass); 429 buffer.append(" license=").append(lmd); 430 buffer.append(" properties=").append(getProperties()); 431 buffer.append(" descriptions=").append(descriptions.values()); 432 buffer.append(" connectionDefinitions=").append(connectionDefinitions); 433 buffer.append(" transactionSupport=").append(tsmd); 434 buffer.append(" authenticationMechanism=").append(ammd); 435 buffer.append(" reauthenticationSupport=").append(reauthenticationSupport); 436 buffer.append(" messageListeners=").append(listeners); 437 buffer.append(" adminobjects=").append(adminObjects); 438 buffer.append(" securityPermissions=").append(securityPermissions); 439 buffer.append(']'); 440 return buffer.toString(); 441 } 442 } 443 | Popular Tags |