1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2006, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.resource.metadata;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
/**
* Connector meta data
*
* @author <a href="mailto:adrian@jboss.com">Adrian Brock</a>
* @version $Revision: 57189 $
*/
public class ConnectorMetaData extends ConfigPropertyMetaDataContainer
{
private static final long serialVersionUID = -3049391010669865389L;
/** The version */
private String version = "1.0";
/** The vendor name */
private String vendorName;
/** The eis type */
private String eisType;
/** The resource adapter version */
private String raVersion;
/** The resource adapter class */
private String raClass;
/** Reauthentication support */
private boolean reauthenticationSupport;
/** The license */
private LicenseMetaData lmd = new LicenseMetaData();
/** The descriptions */
private ConcurrentHashMap descriptions = new ConcurrentHashMap();
/** The connection definitions */
private HashSet connectionDefinitions = new HashSet();
/** The transaction support meta data */
private TransactionSupportMetaData tsmd = new TransactionSupportMetaData();
/** The authentication mechanism meta data */
private AuthenticationMechanismMetaData ammd = new AuthenticationMechanismMetaData();
/** The message listeners */
private HashSet listeners = new HashSet();
/** The admin objects */
private HashSet adminObjects = new HashSet();
/** The security permissions */
private HashSet securityPermissions = new HashSet();
public ConnectorMetaData()
{
DescriptionGroupMetaData dmd = new DescriptionGroupMetaData();
descriptions.put(dmd.getLanguage(), dmd);
}
/**
* Get the connector version
*
* @return the connector version
*/
public String getVersion()
{
return version;
}
/**
* Set the connector version
*
* @param version the connector version
*/
public void setVersion(String version)
{
this.version = version;
}
/**
* Get the vendor name
*
* @return the vendor name
*/
public String getVendorName()
{
return vendorName;
}
/**
* Set the vendor name
*
* @param vendorName the vendor name
*/
public void setVendorName(String vendorName)
{
this.vendorName = vendorName;
}
/**
* Get the eis type
*
* @return the eis type
*/
public String getEISType()
{
return eisType;
}
/**
* Set the eis Type
*
* @param eisType the eis type
*/
public void setEISType(String eisType)
{
this.eisType = eisType;
}
/**
* Get the resource adapter version
*
* @return the resource adapter version
*/
public String getRAVersion()
{
return raVersion;
}
/**
* Set the resource adapter version
*
* @param version the resource adapter version
*/
public void setRAVersion(String version)
{
this.raVersion = version;
}
/**
* Get the resource adapter class
*
* @return the resource adapter class
*/
public String getRAClass()
{
return raClass;
}
/**
* Set the resource adapter class
*
* @param raClass the resource adapter class
*/
public void setRAClass(String raClass)
{
this.raClass = raClass;
}
/**
* Get the reauthentication support
*
* @return the reauthentication support
*/
public boolean getReauthenticationSupport()
{
return reauthenticationSupport;
}
/**
* Set the reauthentication support
*
* @param reauthenticationSupport true for support, false otherwise
*/
public void setReauthenticationSupport(boolean reauthenticationSupport)
{
this.reauthenticationSupport = reauthenticationSupport;
}
/**
* Get the license
*
* @return the license
*/
public LicenseMetaData getLicense()
{
return lmd;
}
/**
* Get the description for the default language
*
* @return the description for the default langugage
*/
public DescriptionGroupMetaData getDescription()
{
DescriptionGroupMetaData dgmd = (DescriptionGroupMetaData) descriptions.get(Locale.getDefault().getLanguage());
// No description using the default locale, just use the first
if (dgmd == null)
{
for (Iterator i = descriptions.values().iterator(); i.hasNext();)
{
dgmd = (DescriptionGroupMetaData) i.next();
break;
}
}
return dgmd;
}
/**
* Get the description for the give language
*
* @param lang the language
* @return the description
*/
public DescriptionGroupMetaData getDescription(String lang)
{
return (DescriptionGroupMetaData) descriptions.get(lang);
}
/**
* Add a description
*
* @param dmd the description
*/
public void addDescription(DescriptionGroupMetaData dmd)
{
descriptions.put(dmd.getLanguage(), dmd);
}
/**
* Get the transaction support
*
* @return the transaction support
*/
public TransactionSupportMetaData getTransactionSupport()
{
return tsmd;
}
/**
* Set the transaction support
*
* @param tsmd the transaction support
*/
public void setTransactionSupport(TransactionSupportMetaData tsmd)
{
this.tsmd = tsmd;
}
/**
* Get the authentication mechanism
*
* @return the authentication mechanism
*/
public AuthenticationMechanismMetaData getAuthenticationMechanism()
{
return ammd;
}
/**
* Set the authentication mechansim
*
* @param ammd the authentication mechansim
*/
public void setAuthenticationMechansim(AuthenticationMechanismMetaData ammd)
{
this.ammd = ammd;
}
/**
* Add a connection definition
*
* @param cdmd the connection definition
*/
public void addConnectionDefinition(ConnectionDefinitionMetaData cdmd)
{
connectionDefinitions.add(cdmd);
}
/**
* Get the connection definition
*
* @param connectionDefinition the idenitifying factory
* @return the metadata or null if there isn't one
*/
public ConnectionDefinitionMetaData getConnectionDefinition(String connectionDefinition)
{
for (Iterator i = connectionDefinitions.iterator(); i.hasNext();)
{
ConnectionDefinitionMetaData cdmd = (ConnectionDefinitionMetaData) i.next();
if (cdmd.getConnectionFactoryInterfaceClass().equals(connectionDefinition))
return cdmd;
}
return null;
}
/**
* Add a message listener
*
* @param mlmd the message listener
*/
public void addMessageListener(MessageListenerMetaData mlmd)
{
listeners.add(mlmd);
}
/**
* Get the message listener
*
* @param messagingType the identifying listener interface
* @return the metadata or null if there isn't one
*/
public MessageListenerMetaData getMessageListener(String messagingType)
{
for (Iterator i = listeners.iterator(); i.hasNext();)
{
MessageListenerMetaData mlmd = (MessageListenerMetaData) i.next();
if (mlmd.getType().equals(messagingType))
return mlmd;
}
return null;
}
/**
* Add an administered object
*
* @param aomd the administered object
*/
public void addAdminObject(AdminObjectMetaData aomd)
{
adminObjects.add(aomd);
}
/**
* Get the admin object
*
* @param interfaceName the identifying admin object interface
* @return the metadata or null if there isn't one
*/
public AdminObjectMetaData getAdminObject(String interfaceName)
{
for (Iterator i = adminObjects.iterator(); i.hasNext();)
{
AdminObjectMetaData aomd = (AdminObjectMetaData) i.next();
if (aomd.getAdminObjectInterfaceClass().equals(interfaceName))
return aomd;
}
return null;
}
/**
* Add a security permission
*
* @param spmd the security permission
*/
public void addSecurityPermission(SecurityPermissionMetaData spmd)
{
securityPermissions.add(spmd);
}
public String toString()
{
StringBuffer buffer = new StringBuffer();
buffer.append("ConnectorMetaData").append('@');
buffer.append(Integer.toHexString(System.identityHashCode(this)));
buffer.append("[version=").append(version);
buffer.append(" vendorName=").append(vendorName);
buffer.append(" eisType=").append(eisType);
buffer.append(" resourceAdapterVersion=").append(raVersion);
buffer.append(" resourceAdapterClass=").append(raClass);
buffer.append(" license=").append(lmd);
buffer.append(" properties=").append(getProperties());
buffer.append(" descriptions=").append(descriptions.values());
buffer.append(" connectionDefinitions=").append(connectionDefinitions);
buffer.append(" transactionSupport=").append(tsmd);
buffer.append(" authenticationMechanism=").append(ammd);
buffer.append(" reauthenticationSupport=").append(reauthenticationSupport);
buffer.append(" messageListeners=").append(listeners);
buffer.append(" adminobjects=").append(adminObjects);
buffer.append(" securityPermissions=").append(securityPermissions);
buffer.append(']');
return buffer.toString();
}
}
|