1 28 29 package com.caucho.ejb.cfg; 30 31 import com.caucho.config.ConfigException; 32 import com.caucho.util.L10N; 33 34 import javax.annotation.PostConstruct; 35 36 39 public class ContainerTransaction { 40 private static final L10N L = new L10N(ContainerTransaction.class); 41 42 private EjbConfig _config; 43 private String _location; 44 private MethodSignature _method; 45 private String _trans; 46 47 50 public ContainerTransaction(EjbConfig config) 51 { 52 _config = config; 53 } 54 55 public void setConfigLocation(String filename, int line) 56 { 57 _location = filename + ":" + line; 58 } 59 60 public void setDescription(String description) 61 { 62 } 63 64 public void setMethod(MethodSignature method) 65 { 66 _method = method; 67 } 68 69 public void setTransAttribute(String trans) 70 throws ConfigException 71 { 72 if (trans.equals("Required")) { 73 } 74 else if (trans.equals("RequiresNew")) { 75 } 76 else if (trans.equals("Mandatory")) { 77 } 78 else if (trans.equals("NotSupported")) { 79 } 80 else if (trans.equals("Never")) { 81 } 82 else if (trans.equals("Supports")) { 83 } 84 else 85 throw new ConfigException(L.l("`{0}' is an unknown transaction type. The transaction types are:\n Required - creates a new transaction if none is active.\n RequiresNew - always creates a new transaction.\n Mandatory - requires an active transaction.\n NotSupported - suspends any active transaction.\n Never - forbids any active transaction.\n Supports - allows a transaction or no transaction.", trans)); 86 87 _trans = trans; 88 } 89 90 @PostConstruct 91 public void init() 92 throws ConfigException 93 { 94 EjbBean bean = _config.getBeanConfig(_method.getEJBName()); 95 96 if (bean == null) 97 throw new ConfigException(L.l("`{0}' is an unknown entity bean.", 98 _method.getEJBName())); 99 100 EjbMethodPattern method = bean.createMethod(_method); 101 102 method.setTransAttribute(_trans); 103 } 104 } 105 | Popular Tags |