1 23 package com.sun.enterprise.deployment; 24 25 import java.util.*; 26 import com.sun.enterprise.util.LocalStringManagerImpl; 27 28 33 34 public class ContainerTransaction extends Descriptor { 35 private String transactionAttribute; 36 37 public static String NOT_SUPPORTED = "NotSupported"; 38 39 public static String SUPPORTS = "Supports"; 40 41 public static String REQUIRED = "Required"; 42 43 public static String REQUIRES_NEW = "RequiresNew"; 44 45 public static String MANDATORY = "Mandatory"; 46 47 public static String NEVER = "Never"; 48 private static LocalStringManagerImpl localStrings = 49 new LocalStringManagerImpl(ContainerTransaction.class); 50 51 54 public ContainerTransaction(ContainerTransaction other) { 55 if (other != null) { 56 this.transactionAttribute = other.transactionAttribute; 57 this.setDescription(other.getDescription()); 58 } 59 } 60 61 68 public ContainerTransaction(String transactionAttribute, 69 String description) { 70 super("a Container Transaction", description); 71 boolean isValidAttribute = (NOT_SUPPORTED.equals(transactionAttribute) 72 || SUPPORTS.equals(transactionAttribute) 73 || REQUIRED.equals(transactionAttribute) 74 || REQUIRED.equals(transactionAttribute) 75 || REQUIRES_NEW.equals(transactionAttribute) 76 || MANDATORY.equals(transactionAttribute) 77 || NEVER.equals(transactionAttribute) ); 78 if (!isValidAttribute && this.isBoundsChecking()) { 79 throw new IllegalArgumentException (localStrings.getLocalString( 80 "enterprise.deployment.exceptionunknowncontainertxtype", 81 "Unknown ContainerTransaction type: {0}", 82 new Object [] {transactionAttribute})); 83 } else { 84 this.transactionAttribute = transactionAttribute; 85 } 86 } 87 88 92 public String getTransactionAttribute() { 93 return this.transactionAttribute; 94 } 95 96 101 public boolean equals(Object other) { 102 if (other != null && other instanceof ContainerTransaction) { 103 ContainerTransaction otherContainerTransaction = 104 (ContainerTransaction) other; 105 if (otherContainerTransaction.getTransactionAttribute().equals( 106 this.getTransactionAttribute())) { 107 return true; 108 } 109 } 110 return false; 111 } 112 113 116 public void print(StringBuffer toStringBuffer) { 117 toStringBuffer.append("Container Transaction: ").append(this.getTransactionAttribute()).append("@").append(this.getDescription()); 118 } 119 } 120 121 | Popular Tags |