1 57 58 59 package org.apache.wsif.providers.jca; 60 61 import org.apache.wsif.logging.*; 62 import org.apache.wsif.providers.*; 63 import org.apache.wsif.*; 64 import org.apache.wsif.base.*; 65 import org.apache.wsif.util.*; 66 67 import javax.resource.*; 68 import javax.resource.cci.*; 69 import javax.wsdl.extensions.*; 70 import javax.wsdl.*; 71 72 import java.net.URL ; 73 import java.util.*; 74 75 82 public class WSIFPort_JCA extends WSIFDefaultPort { 83 84 private static final long serialVersionUID = 1L; 85 private Connection fieldConnection; 86 private Port fieldPort; 87 private Definition fieldDefinition; 88 private Service fieldService; 89 private WSIFProviderJCAExtensions fieldFactory; 90 private final static String crlf = System.getProperty("line.separator"); 91 protected Map operationInstances = new HashMap(); 92 private org.apache.wsif.providers.WSIFDynamicTypeMap fieldTypeMap; 93 94 95 104 public WSIFPort_JCA(Definition aDefinition, Service aService, Port aPort, Connection aConnection, WSIFProviderJCAExtensions aFactory, org.apache.wsif.providers.WSIFDynamicTypeMap typeMap) { 105 106 super(); 107 this.fieldDefinition = aDefinition; 108 this.fieldService = aService; 109 this.fieldPort = aPort; 110 this.fieldConnection = aConnection; 111 this.fieldFactory = aFactory; 112 this.fieldTypeMap = typeMap; 113 } 114 115 private void addOperation(String name, String inputName, String outputName, WSIFOperation value) { 116 operationInstances.put(getKey(name, inputName, outputName), value); 117 } 118 119 124 public WSIFOperation createOperation(String aOperationName, String aInputName, String aOutputName) throws WSIFException { 125 126 Trc.entry(this); 127 WSIFOperation wsifOperation = getOperation(aOperationName, aInputName, aOutputName); 128 if (wsifOperation == null) { 129 wsifOperation = fieldFactory.createOperation(fieldDefinition, fieldService, fieldPort, aOperationName, 130 aInputName, aOutputName, fieldTypeMap, this, fieldConnection); 131 addOperation(aOperationName, aInputName, aOutputName, wsifOperation); 132 } 133 Trc.exit(wsifOperation); 134 return wsifOperation; 135 } 136 137 142 public WSIFOperation createOperation(String aOperationName) throws WSIFException { 143 144 Trc.entry(this, aOperationName); 145 146 WSIFOperation wsifOperation = getOperation(aOperationName, null, null); 147 if (wsifOperation == null) { 148 wsifOperation = fieldFactory.createOperation(fieldDefinition, fieldService, fieldPort, aOperationName, 149 null, null, fieldTypeMap, this, fieldConnection); 150 151 addOperation(aOperationName, null, null, wsifOperation); 152 } 153 Trc.exit(wsifOperation); 154 return wsifOperation; 155 } 156 157 162 public void close() { 163 try { 164 if(this.fieldConnection != null) 165 this.fieldConnection.close(); 166 } 167 catch (ResourceException exn) { 168 } 169 } 170 171 private WSIFOperation_JCA getOperation(String name, String inputName, String outputName) { 172 173 return (WSIFOperation_JCA) operationInstances.get(getKey(name, inputName, outputName)); 174 175 } 176 177 public String toString() { 178 179 StringBuffer buffer = new StringBuffer (); 180 buffer.append(crlf + "[WSIFPort_JCA" + crlf); 181 try { 182 if (fieldConnection != null) 183 buffer.append("\tConnection: " + fieldConnection.toString() + crlf); 184 else 185 buffer.append("\tConnection: null" + crlf); 186 187 if (fieldPort != null) 188 buffer.append("\tPort: " + fieldPort.toString() + crlf); 189 else 190 buffer.append("\tPort: null" + crlf); 191 192 if (fieldDefinition != null) 193 buffer.append("\tDefinition: " + fieldDefinition.toString() + crlf); 194 else 195 buffer.append("\tDefinition null" + crlf); 196 197 if (fieldService != null) 198 buffer.append("\tService: " + fieldService.toString() + crlf); 199 else 200 buffer.append("\tService: null" + crlf); 201 202 if (fieldFactory != null) 203 buffer.append("\tFactory: " + fieldFactory.toString() + crlf); 204 else 205 buffer.append("\tFactory: null" + crlf); 206 buffer.append("]" + crlf); 207 } 208 catch (Throwable exn) { 209 } 210 return buffer.toString(); 211 } 212 216 void setConnection(Connection connection) { 217 fieldConnection = connection; 218 } 219 220 } | Popular Tags |