1 9 package fictional.resourceadapter; 10 11 import javax.resource.ResourceException; 12 import javax.resource.NotSupportedException; 13 import javax.resource.cci.*; 14 import javax.resource.spi.*; 15 import org.objectweb.jonas.common.Log; 17 import org.objectweb.util.monolog.api.Logger; 18 import org.objectweb.util.monolog.api.BasicLevel; 19 20 28 public class JtestInteraction 29 implements Interaction, 30 InteractionSpec, 31 java.io.Serializable 32 { 33 34 private Record output; 35 private boolean closed = false; 36 private Connection con; 37 private ManagedConnection mcon; 38 private Logger logger = null; 39 String cName = ""; 40 41 public JtestInteraction(Connection c) { 42 cName = "Interaction"; 43 if (logger == null) { 44 logger = Log.getLogger("fictional.resourceadapter"); 45 } 46 logger.log(BasicLevel.DEBUG, cName+".constructor"); 47 con=c; 48 } 49 public JtestInteraction(Connection c, ManagedConnection mc) { 50 cName = "Interaction"; 51 if (logger == null) { 52 logger = Log.getLogger("fictional.resourceadapter"); 53 } 54 logger.log(BasicLevel.DEBUG, cName+".constructor"); 55 con=c; 56 mcon=mc; 57 } 58 private String impl(Object obj) { 59 if (obj instanceof Interaction) { 60 return "Interaction"; 61 } else if (obj instanceof InteractionSpec) { 62 return "InteractionSpec"; 63 } else 64 return "InteractionSpec. Is this an error"; 65 } 66 69 public boolean execute(InteractionSpec ispec, 70 Record input, 71 Record output) throws ResourceException 72 { 73 cName = "Interaction"; 74 logger.log(BasicLevel.DEBUG, cName+".execute"); 75 this.output = input; 76 return(true); 77 } 78 public Record execute(InteractionSpec ispec, 79 Record input) throws ResourceException 80 { 81 cName = "Interaction"; 82 logger.log(BasicLevel.DEBUG, cName+".execute"); 83 return (output); 84 } 85 public void close() 86 throws ResourceException 87 { 88 cName = "Interaction"; 89 logger.log(BasicLevel.DEBUG, cName+".close"); 90 closed=true; 91 } 92 public Connection getConnection() 93 { 94 cName = "Interaction"; 95 logger.log(BasicLevel.DEBUG, cName+".getConnection"); 96 return con; 97 } 98 public ResourceWarning getWarnings() 99 throws ResourceException 100 { 101 cName = "Interaction"; 102 logger.log(BasicLevel.DEBUG, cName+".getWarnings"); 103 NotSupportedException nse = new NotSupportedException( 104 "Interaction.getWarnings is not currently supported"); 105 throw nse; 106 } 107 public void clearWarnings() 108 throws ResourceException 109 { 110 cName = "Interaction"; 111 logger.log(BasicLevel.DEBUG, cName+".clearWarnings"); 112 NotSupportedException nse = new NotSupportedException( 113 "Interaction.clearWarnings is not currently supported"); 114 throw nse; 115 } 116 117 118 121 private int interactionVerb; 123 127 private String FunctionName; 128 private int ExecutionTimeout; 129 private int FetchSize; 130 private int FetchDirection; 131 private int MaxFieldSize; 132 private int ResultSetType; 133 private int ResultSetConcurrency; 134 135 public JtestInteraction() { 136 cName = "InteractionSpec"; 137 if (logger == null) { 138 logger = Log.getLogger("fictional.resourceadapter"); 139 } 140 logger.log(BasicLevel.DEBUG, cName+".constructor"); 141 interactionVerb = SYNC_SEND_RECEIVE; 142 FunctionName = ""; 143 FetchDirection = 0; 144 ExecutionTimeout = 2000; 145 FetchSize = 30; 146 MaxFieldSize = 444; 147 ResultSetType = 5; 148 ResultSetConcurrency = 6; 149 } 150 public void setFunctionName(String n) { 151 FunctionName = n; 152 } 153 public String getFunctionName() { 154 return (FunctionName); 155 } 156 public void setInteractionVerb(int verb) { 157 interactionVerb = verb; 158 } 159 public int getInteractionVerb() { 160 return (interactionVerb); 161 } 162 public void setExecutionTimeout(int verb) { 163 ExecutionTimeout = verb; 164 } 165 public int getExecutionTimeout() { 166 return (ExecutionTimeout); 167 } 168 169 public void setFetchSize (int x) { 170 FetchSize = x;; 171 } 172 public int getFetchSize () { 173 return (FetchSize); 174 } 175 176 public void setFetchDirection(int x) { 177 FetchDirection = x;; 178 } 179 public int getFetchDirection() { 180 return (FetchDirection); 181 } 182 183 public void setMaxFieldSize(int x) { 184 MaxFieldSize = x;; 185 } 186 public int getMaxFieldSize() { 187 return (MaxFieldSize); 188 } 189 190 public void setResultSetType(int x) { 191 ResultSetType = x; 192 } 193 public int getResultSetType() { 194 return (ResultSetType); 195 } 196 197 public void setResultSetConcurrency(int x) { 198 ResultSetConcurrency = x;; 199 } 200 public int getResultSetConcurrency() { 201 return (ResultSetConcurrency); 202 } 203 } 204 | Popular Tags |