1 23 24 package com.sun.enterprise.deployment; 25 26 import com.sun.enterprise.deployment.xml.ConnectorTagNames; 27 import java.util.Iterator ; 28 import java.util.Set ; 29 30 36 public class OutboundResourceAdapter extends Descriptor 37 { 38 private boolean isDirty = false; 39 40 private int transactionSupport = PoolManagerConstants.LOCAL_TRANSACTION; 41 private Set authMechanisms; 42 private boolean reauthenticationSupport = false; 43 private Set connectionDefs; 44 45 public OutboundResourceAdapter () 46 { 47 this.authMechanisms = new OrderedSet(); 48 this.connectionDefs = new OrderedSet(); 49 } 50 51 54 public boolean 55 supportsReauthentication() 56 { 57 return reauthenticationSupport; 58 } 59 60 public String getReauthenticationSupport() { 61 return String.valueOf(reauthenticationSupport); 62 } 63 64 67 public void 68 setReauthenticationSupport(boolean reauthenticationSupport) 69 { 70 this.reauthenticationSupport = reauthenticationSupport; 71 this.setDirty(); 72 this.changed(); 73 } 74 75 78 public void setReauthenticationSupport(String reauthSupport) { 79 this.reauthenticationSupport = 80 (Boolean.valueOf(reauthSupport)).booleanValue(); 81 this.setDirty(); 82 this.changed(); 83 } 84 85 86 90 public String 91 getTransSupport() 92 { 93 if (transactionSupport == PoolManagerConstants.NO_TRANSACTION) 94 return ConnectorTagNames.DD_NO_TRANSACTION; 95 else if (transactionSupport == PoolManagerConstants.LOCAL_TRANSACTION) 96 return ConnectorTagNames.DD_LOCAL_TRANSACTION; 97 else 98 return ConnectorTagNames.DD_XA_TRANSACTION; 99 } 100 101 public int 102 getTransactionSupport() 103 { 104 return transactionSupport; 105 } 106 107 112 public void 113 setTransactionSupport(int transactionSupport) 114 { 115 this.transactionSupport = transactionSupport; 116 this.setDirty(); 117 this.changed(); 118 } 119 120 125 public void 126 setTransactionSupport(String support) 127 { 128 if (ConnectorTagNames.DD_NO_TRANSACTION.equals(support)) 129 this.transactionSupport = PoolManagerConstants.NO_TRANSACTION; 130 else if (ConnectorTagNames.DD_LOCAL_TRANSACTION.equals(support)) 131 this.transactionSupport = PoolManagerConstants.LOCAL_TRANSACTION; 132 else 133 this.transactionSupport = PoolManagerConstants.XA_TRANSACTION; 134 135 this.setDirty(); 136 this.changed(); 137 } 138 139 142 public Set 143 getAuthMechanisms() 144 { 145 if (authMechanisms == null) { 146 authMechanisms = new OrderedSet(); 147 } 148 return authMechanisms; 149 } 150 151 156 public boolean 157 addAuthMechanism(AuthMechanism mech) 158 { 159 boolean flag=false; 160 for (Iterator itr = authMechanisms.iterator(); itr.hasNext();){ 161 AuthMechanism next = (AuthMechanism) itr.next(); 162 if (next.getAuthMechVal()==mech.getAuthMechVal()) { 163 return(flag); 164 } 165 } 166 flag=this.authMechanisms.add(mech); 167 this.setDirty(); 168 this.changed(); 169 return(flag); 170 } 171 172 177 public boolean 178 removeAuthMechanism(AuthMechanism mech) 179 { 180 boolean flag=false; 181 for (Iterator itr = authMechanisms.iterator(); itr.hasNext();){ 182 AuthMechanism next = (AuthMechanism) itr.next(); 183 if (next.equals(mech)) { 184 flag=this.authMechanisms.remove(mech); 185 this.setDirty(); 186 this.changed(); 187 return(flag); 188 } 189 } 190 return(flag); 191 } 192 193 194 199 public boolean 200 addAuthMechanism(int mech) 201 { 202 boolean flag = false; 203 for (Iterator itr = authMechanisms.iterator(); itr.hasNext();){ 204 AuthMechanism next = (AuthMechanism) itr.next(); 205 if (next.getAuthMechVal() == mech) 206 return(flag); 207 } 208 String credInf = null; 209 if (mech == PoolManagerConstants.BASIC_PASSWORD) { 210 credInf = PoolManagerConstants.PASSWORD_CREDENTIAL; 211 } else { 212 credInf = PoolManagerConstants.GENERIC_CREDENTIAL; 213 } 214 AuthMechanism auth = new AuthMechanism("",mech, credInf); 215 flag = this.authMechanisms.add(auth); 216 this.setDirty(); 217 this.changed(); 218 return(flag); 219 } 220 221 222 227 public boolean 228 removeAuthMechanism(int mech) 229 { 230 boolean flag = false; 231 for (Iterator itr = authMechanisms.iterator(); itr.hasNext();){ 232 AuthMechanism next = (AuthMechanism) itr.next(); 233 if (next.getAuthMechVal()==mech) 234 { 235 flag = this.authMechanisms.remove(next); 236 this.setDirty(); 237 this.changed(); 238 return(flag); 239 } 240 } 241 return(flag); 242 } 243 244 247 public void addConnectionDefDescriptor(ConnectionDefDescriptor conDefDesc) { 248 this.connectionDefs.add(conDefDesc); 249 this.setDirty(); 250 this.changed(); 251 } 252 253 256 public void removeConnectionDefDescriptor(ConnectionDefDescriptor conDefDesc) { 257 this.connectionDefs.remove(conDefDesc); 258 this.setDirty(); 259 this.changed(); 260 } 261 262 265 public Set getConnectionDefs() { 266 return connectionDefs; 267 } 268 269 277 278 359 360 362 365 366 public void setConnectionDef(ConnectionDefDescriptor conDef) { 367 this.connectionDefs.add(conDef); 368 this.setDirty(); 369 this.changed(); 370 } 371 372 public ConnectionDefDescriptor getConnectionDef() { 373 Iterator iter = connectionDefs.iterator(); 374 ConnectionDefDescriptor conDef = (ConnectionDefDescriptor)iter.next(); 375 return conDef; 376 } 377 378 381 public String getManagedConnectionFactoryImpl() 382 { 383 return getConnectionDef().getManagedConnectionFactoryImpl(); 384 } 385 386 389 public void 390 setManagedConnectionFactoryImpl(String managedConnectionFactoryImpl) 391 { 392 getConnectionDef().setManagedConnectionFactoryImpl(managedConnectionFactoryImpl); 393 } 394 395 398 public Set getConfigProperties() 399 { 400 return getConnectionDef().getConfigProperties(); 401 } 402 403 406 public void addConfigProperty(EnvironmentProperty configProperty) 407 { 408 getConnectionDef().getConfigProperties().add(configProperty); 409 } 410 411 414 public void removeConfigProperty(EnvironmentProperty configProperty) 415 { 416 getConnectionDef().getConfigProperties().remove(configProperty); 417 } 418 419 422 public String getConnectionFactoryImpl() 423 { 424 return getConnectionDef().getConnectionFactoryImpl(); 425 } 426 427 430 public void setConnectionFactoryImpl(String cf) 431 { 432 getConnectionDef().setConnectionFactoryImpl(cf); 433 } 434 435 438 public String getConnectionFactoryIntf() 439 { 440 return getConnectionDef().getConnectionFactoryIntf(); 441 } 442 443 446 public void setConnectionFactoryIntf(String cf) 447 { 448 getConnectionDef().setConnectionFactoryIntf(cf); 449 } 450 451 454 public String getConnectionIntf() 455 { 456 return getConnectionDef().getConnectionIntf(); 457 } 458 459 462 public void setConnectionIntf(String con) 463 { 464 getConnectionDef().setConnectionIntf(con); 465 } 466 467 470 public String getConnectionImpl() 471 { 472 return getConnectionDef().getConnectionImpl(); 473 } 474 475 478 public void setConnectionImpl(String con) 479 { 480 getConnectionDef().setConnectionImpl(con); 481 } 482 483 public boolean 484 isDirty() 485 { 486 return this.isDirty; 487 } 488 489 public void 490 changed() 491 { 492 super.changed(); 493 } 494 495 private void setDirty() { 496 this.isDirty = true; 497 } 498 } 499 | Popular Tags |