1 57 58 package org.apache.wsif.providers.soap.apacheaxis; 59 60 import org.apache.axis.AxisEngine; 61 import org.apache.axis.AxisFault; 62 import org.apache.axis.MessageContext; 63 import org.apache.axis.client.Call; 64 import org.apache.axis.client.Transport; 65 import org.apache.wsif.WSIFException; 66 import org.apache.wsif.WSIFOperation; 67 import org.apache.wsif.logging.Trc; 68 import org.apache.wsif.util.jms.WSIFJMSDestination; 69 70 74 public class WSIFJmsTransport extends Transport { 75 private WSIFJMSDestination destination = null; 76 private String asyncOperation = "false"; 77 private WSIFOperation wsifOperation = null; 78 private Long syncTimeout = null; 79 private Long asyncTimeout = null; 80 81 public static final String DESTINATION = "destination"; 82 public static final String ASYNCOPERATION = "asyncOperation"; 83 public static final String WSIFOPERATION = "wsifOperation"; 84 public static final String SYNC_TIMEOUT = "syncTimeout"; 85 public static final String ASYNC_TIMEOUT = "asyncTimeout"; 86 87 public WSIFJmsTransport(WSIFJMSDestination destination) throws WSIFException { 88 if (destination == null) { 89 throw new WSIFException("destination is null"); 90 } 91 this.destination = destination; 92 } 93 94 public void setDestination(WSIFJMSDestination destination) { 95 Trc.entry(this, destination); 96 this.destination = destination; 97 Trc.exit(); 98 } 99 100 public void setAsyncOperation(String asyncOperation) { 101 Trc.entry(this, asyncOperation); 102 this.asyncOperation = asyncOperation; 103 Trc.exit(); 104 } 105 106 public void setWsifOperation(WSIFOperation wsifOperation) { 107 Trc.entry(this, wsifOperation); 108 this.wsifOperation = wsifOperation; 109 Trc.exit(); 110 } 111 112 public void setSyncTimeout(Long syncTimeout) { 113 Trc.entry(this, syncTimeout); 114 this.syncTimeout = syncTimeout; 115 Trc.exit(); 116 } 117 118 public void setAsyncTimeout(Long asyncTimeout) { 119 Trc.entry(this, asyncTimeout); 120 this.asyncTimeout = asyncTimeout; 121 Trc.exit(); 122 } 123 124 public WSIFJMSDestination getDestination() { 125 Trc.entry(this); 126 Trc.exit(this.destination); 127 return this.destination; 128 } 129 130 public String getAsyncOperation() { 131 Trc.entry(this); 132 Trc.exit(this.asyncOperation); 133 return this.asyncOperation; 134 } 135 136 public WSIFOperation getWsifOperation() { 137 Trc.entry(this); 138 Trc.exit(this.wsifOperation); 139 return this.wsifOperation; 140 } 141 142 public Long getSyncTimeout() { 143 Trc.entry(this); 144 Trc.exit(this.syncTimeout); 145 return this.syncTimeout; 146 } 147 148 public Long getAsyncTimeout() { 149 Trc.entry(this); 150 Trc.exit(this.asyncTimeout); 151 return this.asyncTimeout; 152 } 153 154 public void setupMessageContextImpl( 155 MessageContext context, 156 Call call, 157 AxisEngine engine) 158 throws AxisFault { 159 Trc.entry(this, context, call, engine); 160 context.setTransportName("jms"); 161 if (destination != null) 162 context.setProperty(DESTINATION, destination); 163 context.setProperty(ASYNCOPERATION, new Boolean (asyncOperation)); 164 if (wsifOperation != null) 165 context.setProperty(WSIFOPERATION, wsifOperation); 166 if (syncTimeout != null) 167 context.setProperty(SYNC_TIMEOUT, syncTimeout); 168 if (asyncTimeout != null) 169 context.setProperty(ASYNC_TIMEOUT, asyncTimeout); 170 Trc.exit(); 171 } 172 173 public WSIFJmsTransport copy() throws WSIFException { 174 Trc.entry(this); 175 WSIFJmsTransport t = new WSIFJmsTransport(destination); 176 t.setAsyncOperation(asyncOperation); 177 t.setWsifOperation(wsifOperation); 178 t.setSyncTimeout(syncTimeout); 179 t.setAsyncTimeout(asyncTimeout); 180 if (Trc.ON) 181 Trc.exit(t.deep()); 182 return t; 183 } 184 185 public void close() throws WSIFException { 186 Trc.entry(this); 187 if (destination == null) { 188 throw new WSIFException("already closed"); 189 } 190 destination.close(); 191 destination = null; 192 Trc.exit(); 193 } 194 195 public String deep() { 196 String buff = ""; 197 try { 198 buff = new String (super.toString() + ":\n"); 199 200 buff += "destination:" + destination; 201 buff += "asyncOperation:" + asyncOperation; 202 buff += "wsifOperation:" + wsifOperation; 203 buff += "syncTimeout:" + syncTimeout; 204 buff += "asyncTimeout:" + asyncTimeout; 205 } catch (Exception e) { 206 Trc.exceptionInTrace(e); 207 } 208 return buff; 209 } 210 } | Popular Tags |