| 65 | | /**
|
| 66 | | * Send style
|
| 67 | | *
|
| 68 | | */
|
| 69 | | public static enum SendStyle {
|
| 70 | | ASYNCHRONOUS_SEND, SYNCHRONOUS_SEND, SYNCHRONOUS_SEND_WITH_TIMEOUT
|
| 71 | | };
|
| 72 | |
|
| 73 | | /**
|
| 74 | | * Default constructor
|
| 75 | | *
|
| 76 | | */
|
| 77 | | public Sender(final ComponentContext context,
|
| 78 | | final DeliveryChannel channel, final Logger logger) {
|
| 79 | |
|
| 80 | | this.logger = logger;
|
| 81 | | this.channel = channel;
|
| 82 | | this.context = context;
|
| 83 | | }
|
| 84 | |
|
| 85 | | /**
|
| 86 | | * FIXME some orchestra Error and Fault exception are thrown FIXME use some
|
| 87 | | * CDK utils to send Exchanges Call a jbi service
|
| 88 | | *
|
| 89 | | * @param partner
|
| 90 | | * the partner to invoke. May be null
|
| 91 | | * @param msgIn
|
| 92 | | * the exchange
|
| 93 | | * @param syncTime
|
| 94 | | * timeout for syncSend
|
| 95 | | * @return the exchange response
|
| 96 | | * @throws MessagingException
|
| 97 | | * problem while accessing MsgExch information or while sending
|
| 98 | | * the MsgExc
|
| 99 | | * @throws OrchestraException no endpoint found to send the message
|
| 100 | | */
|
| 101 | | public final Message send(final Element partner, final Exchange msgIn,
|
| 102 | | final Long syncTime, WsdlsInfos infos, QName portTypeQName,
|
| 103 | | Operation operation) throws MessagingException, OrchestraException {
|
| 104 | |
|
| 105 | | SendStyle sendStyle;
|
| 106 | | sendStyle = SendStyle.ASYNCHRONOUS_SEND;
|
| 107 | | if (operation.getOutput() != null) {
|
| 108 | | sendStyle = SendStyle.SYNCHRONOUS_SEND;
|
| 109 | | }
|
| 110 | |
|
| 111 | | Message messageReturned = null;
|
| 112 | | this.logger.finest("Send a JBI message");
|
| 113 | | String endpointName = null;
|
| 114 | | QName service = null;
|
| 115 | |
|
| 116 | | this.logger.finest("message mep : " + msgIn.getPattern());
|
| 117 | | if (partner != null) {
|
| 118 | | endpointName = this.getEndPointName(partner);
|
| 119 | | service = this.getService(partner);
|
| 120 | |
|
| 121 | | if (service != null) {
|
| 122 | | this.logger.info("Set the service to invoke: " + service);
|
| 123 | | msgIn.setService(service);
|
| 124 | | if (endpointName != null) {
|
| 125 | | ServiceEndpoint endpoint = this.resolveEndPoint(service,
|
| 126 | | endpointName);
|
| 127 | | this.logger.info("Set the endpoint to invoke: "
|
| 128 | | + endpoint.getEndpointName());
|
| 129 | | msgIn.setEndpoint(endpoint);
|
| 130 | | }
|
| 131 | | }
|
| 132 | | } else {
|
| 133 | | this.logger
|
| 134 | | .finest("partner is null: research the service by its interface");
|
| 135 | | }
|
| 136 | |
|
| 137 | | this.logger.finest("Satus: " + msgIn.getStatus());
|
| 138 | | this.logger.finest("Consumer Role? " + msgIn.isConsumerRole());
|
| 139 | |
|
| 140 | | if ((sendStyle == SendStyle.ASYNCHRONOUS_SEND)
|
| 141 | | && (msgIn.isInOnlyPattern())) {
|
| 142 | | channel.send(((ExchangeImpl) msgIn).getMessageExchange());
|
| 143 | | } else if (sendStyle == SendStyle.SYNCHRONOUS_SEND) {
|
| 144 | | if (syncTime != null) {
|
| 145 | | channel.sendSync(((ExchangeImpl) msgIn).getMessageExchange(),
|
| 146 | | syncTime);
|
| 147 | | } else {
|
| 148 | | channel.sendSync(((ExchangeImpl) msgIn).getMessageExchange());
|
| 149 | | }
|
| 150 | |
|
| 151 | | if ((msgIn.getFault() != null) || (msgIn.getError() != null)
|
| 152 | | || (msgIn.isErrorStatus())) {
|
| 153 | | if (msgIn.getError() != null) {
|
| 154 | | throw new Error(msgIn.getError());
|
| 155 | | }
|
| 156 | |
|
| 157 | | if (msgIn.getFault() != null) {
|
| 158 | | try {
|
| 159 | | SOAPFault soapfault = new SOAPFault(msgIn.getFault());
|
| 160 | | List<BpelFaultMessage> bpelfaults = Marshaller
|
| 161 | | .getInstance()
|
| 162 | | .buildBPELFaultMessagesFromJBIFaultMessages(
|
| 163 | | infos, portTypeQName, operation,
|
| 164 | | soapfault.getSoapFaults());
|
| 165 | |
|
| 166 | | if (bpelfaults == null) {
|
| 167 | | throw new Error(
|
| 168 | | "these received fault messages are not defined in WSDL document: "
|
| 169 | | + soapfault.getSoapFaults());
|
| 170 | | }
|
| 171 | |
|
| 172 | | throw new Fault(bpelfaults);
|
| 173 | | } catch (PEtALSCDKException e) {
|
| 174 | | throw new Error(
|
| 175 | | "Can not convert fault into XML document");
|
| 176 | | }
|
| 177 | | }
|
| 178 | | throw new Error("Error from the provider " + service
|
| 179 | | + endpointName);
|
| 180 | | }
|
| 181 | |
|
| 182 | | this.logger.log(Level.INFO, "Receive response from: " + service
|
| 183 | | + endpointName);
|
| 184 | | if (operation.getOutput() != null) {
|
| 185 | | @SuppressWarnings("unchecked")
|
| 186 | | final Map<String, Part> outputParts = operation.getOutput()
|
| 187 | | .getMessage().getParts();
|
| 188 | | messageReturned = Marshaller.getInstance()
|
| 189 | | .buildBPELMessageFromJBIMessage(infos, portTypeQName,
|
| 190 | | operation, outputParts.values(),
|
| 191 | | msgIn.getOutMessageContentAsDocument());
|
| 192 | |
|
| 193 | | this.logger.finest("bpel message returned: " + messageReturned);
|
| 194 | | }
|
| 195 | |
|
| 196 | | if (!msgIn.getPattern().equals(MEPConstants.IN_ONLY_PATTERN)) {
|
| 197 | | this.logger.finest("Set status done");
|
| 198 | | msgIn.setDoneStatus();
|
| 199 | | this.logger.finest("Send status done");
|
| 200 | | channel.send(((ExchangeImpl) msgIn).getMessageExchange());
|
| 201 | | }
|
| 202 | |
|
| 203 | | } else {
|
| 204 | | // FIXME should not happen : the exchange mep has been created in
|
| 205 | | // correlation with the senStyle parameter in a previous method
|
| 206 | | throw new Error(
|
| 207 | | "this kind of message ("
|
| 208 | | + sendStyle
|
| 209 | | + ") is unknown or is incompatible with the mep of message: "
|
| 210 | | + msgIn.getPattern());
|
| 211 | | }
|
| 212 | |
|
| 213 | | this.logger.finest("JBI message sent");
|
| 214 | | return messageReturned;
|
| 215 | | }
|
| 216 | |
|
| 217 | | /**
|
| 218 | | * Extract the service from a partner reference information item.
|
| 219 | | *
|
| 220 | | * @param ii
|
| 221 | | * Information Item
|
| 222 | | * @return the service QName
|
| 223 | | */
|
| 224 | | public final QName getService(final Element ii) {
|
| 225 | |
|
| 226 | | logger.log(Level.FINEST, "Entering in getService method");
|
| 227 | |
|
| 228 | | final org.w3c.dom.Element serviceRefElem = (org.w3c.dom.Element) ii;
|
| 229 | |
|
| 230 | | final org.w3c.dom.Element endpointRef = (org.w3c.dom.Element) serviceRefElem
|
| 231 | | .getElementsByTagName("EndpointReference").item(0);
|
| 232 | |
|
| 233 | | final org.w3c.dom.Element serviceElmt = (org.w3c.dom.Element) endpointRef
|
| 234 | | .getElementsByTagName("ServiceName").item(0);
|
| 235 | |
|
| 236 | | String serviceName = null;
|
| 237 | | String prefixName = null;
|
| 238 | |
|
| 239 | | if (serviceElmt.getTextContent().indexOf(":") > -1) {
|
| 240 | | serviceName = serviceElmt.getTextContent().substring(
|
| 241 | | serviceElmt.getTextContent().indexOf(":") + 1);
|
| 242 | | prefixName = serviceElmt.getTextContent().substring(0,
|
| 243 | | serviceElmt.getTextContent().indexOf(":"));
|
| 244 | | } else {
|
| 245 | | serviceName = serviceElmt.getTextContent();
|
| 246 | | }
|
| 247 | |
|
| 248 | | String serviceNamespace = serviceElmt.lookupNamespaceURI(prefixName);
|
| 249 | | if (serviceNamespace == null) {
|
| 250 | | String prefixTmp = null;
|
| 251 | | final NamedNodeMap list = serviceElmt.getAttributes();
|
| 252 | | for (int i = 0; i < list.getLength(); i++) {
|
| 253 | |
|
| 254 | | if (list.item(i).getNodeName().indexOf(":") > -1) {
|
| 255 | | prefixTmp = list.item(i).getNodeName().substring(
|
| 256 | | list.item(i).getNodeName().indexOf(":") + 1);
|
| 257 | | } else {
|
| 258 | | prefixTmp = list.item(i).getNodeName();
|
| 259 | | }
|
| 260 | |
|
| 261 | | if ((prefixName != null) && (prefixName.equals(prefixTmp))) {
|
| 262 | | serviceNamespace = list.item(i).getNodeValue();
|
| 263 | | }
|
| 264 | | }
|
| 265 | | }
|
| 266 | |
|
| 267 | | // TODO: Normally, just this line is sufficient
|
| 268 | | // QName service = new QName(serviceElmt.lookupNamespaceURI(prefixName),
|
| 269 | | // serviceName);
|
| 270 | |
|
| 271 | | final QName service = new QName(serviceNamespace, serviceName);
|
| 272 | |
|
| 273 | | logger.log(Level.FINEST, "service name: " + service);
|
| 274 | | logger.log(Level.FINEST, "Exit of the getService method");
|
| 275 | | return service;
|
| 276 | | }
|
| 277 | |
|
| 278 | | /**
|
| 279 | | * Extract the endPoint reference from a service reference information item.
|
| 280 | | *
|
| 281 | | * @param ii
|
| 282 | | * Information Item
|
| 283 | | * @return the end Point URL
|
| 284 | | */
|
| 285 | | public final String getEndPointName(final Element ii) {
|
| 286 | | String endpointName = null;
|
| 287 | | logger.log(Level.FINEST, "Entering in getEndPointName method");
|
| 288 | |
|
| 289 | | final org.w3c.dom.Element serviceRefElem = (org.w3c.dom.Element) ii;
|
| 290 | |
|
| 291 | | org.w3c.dom.Element endpointRef = null;
|
| 292 | |
|
| 293 | | if (serviceRefElem.getElementsByTagName("EndpointReference")
|
| 294 | | .getLength() > 0) {
|
| 295 | | endpointRef = (org.w3c.dom.Element) serviceRefElem
|
| 296 | | .getElementsByTagName("EndpointReference").item(0);
|
| 297 | | }
|
| 298 | |
|
| 299 | | if (endpointRef != null) {
|
| 300 | | org.w3c.dom.Element endpoint = null;
|
| 301 | | if (endpointRef.getElementsByTagName("Address").getLength() > 0) {
|
| 302 | | endpoint = (org.w3c.dom.Element) endpointRef
|
| 303 | | .getElementsByTagName("Address").item(0);
|
| 304 | | }
|
| 305 | |
|
| 306 | | if (endpoint != null) {
|
| 307 | | endpointName = endpoint.getTextContent();
|
| 308 | | }
|
| 309 | | }
|
| 310 | | logger.log(Level.FINEST, "endpoint name found: " + endpointName);
|
| 311 | | logger.log(Level.FINEST, "Exit of the getEndPointName method");
|
| 312 | |
|
| 313 | | return endpointName;
|
| 314 | | }
|
| 315 | |
|
| 316 | | /**
|
| 317 | | * Find the endpoint in the JBI env
|
| 318 | | *
|
| 319 | | * @param service
|
| 320 | | * @param endpointName
|
| 321 | | * @return
|
| 322 | | * @throws OrchestraException
|
| 323 | | * endpoint can not be found in the JBI context
|
| 324 | | */
|
| 325 | | public final ServiceEndpoint resolveEndPoint(final QName service,
|
| 326 | | final String endpointName) throws OrchestraException {
|
| 327 | |
|
| 328 | | logger.log(Level.FINEST, "find the endPoint in the JBI environment");
|
| 329 | |
|
| 330 | | logger.log(Level.FINEST, "service name: " + service);
|
| 331 | | logger.log(Level.FINEST, "endpoint name: " + endpointName);
|
| 332 | |
|
| 333 | | // Search by endpoint
|
| 334 | | ServiceEndpoint endpoint = context.getEndpoint(service, endpointName);
|
| 335 | |
|
| 336 | | if (endpoint == null) {
|
| 337 | | throw new OrchestraException("endpoint (" + service + "-"
|
| 338 | | + endpointName + ") not found in the JBI environment");
|
| 339 | | }
|
| 340 | |
|
| 341 | | logger.log(Level.FINEST, "endpoint service found: " + endpoint);
|
| 342 | | return endpoint;
|
| 343 | | }
|
| 65 | /**
|
| 66 | * Send style
|
| 67 | *
|
| 68 | */
|
| 69 | public static enum SendStyle {
|
| 70 | ASYNCHRONOUS_SEND, SYNCHRONOUS_SEND, SYNCHRONOUS_SEND_WITH_TIMEOUT
|
| 71 | };
|
| 72 |
|
| 73 | /**
|
| 74 | * Default constructor
|
| 75 | *
|
| 76 | */
|
| 77 | public Sender(final ComponentContext context,
|
| 78 | final DeliveryChannel channel, final Logger logger) {
|
| 79 |
|
| 80 | this.logger = logger;
|
| 81 | this.channel = channel;
|
| 82 | this.context = context;
|
| 83 | }
|
| 84 |
|
| 85 | /**
|
| 86 | * FIXME some orchestra Error and Fault exception are thrown FIXME use some
|
| 87 | * CDK utils to send Exchanges Call a jbi service
|
| 88 | *
|
| 89 | * @param partner
|
| 90 | * the partner to invoke. May be null
|
| 91 | * @param msgIn
|
| 92 | * the exchange
|
| 93 | * @param syncTime
|
| 94 | * timeout for syncSend
|
| 95 | * @return the exchange response
|
| 96 | * @throws MessagingException
|
| 97 | * problem while accessing MsgExch information or while sending
|
| 98 | * the MsgExc
|
| 99 | * @throws OrchestraEngineException no endpoint found to send the message
|
| 100 | */
|
| 101 | public final Message send(final Element partner, final Exchange msgIn,
|
| 102 | final Long syncTime, WsdlsInfos infos, QName portTypeQName,
|
| 103 | Operation operation) throws MessagingException, OrchestraEngineException {
|
| 104 |
|
| 105 | SendStyle sendStyle;
|
| 106 | sendStyle = SendStyle.ASYNCHRONOUS_SEND;
|
| 107 | if (operation.getOutput() != null) {
|
| 108 | sendStyle = SendStyle.SYNCHRONOUS_SEND;
|
| 109 | }
|
| 110 |
|
| 111 | Message messageReturned = null;
|
| 112 | this.logger.finest("Send a JBI message");
|
| 113 | String endpointName = null;
|
| 114 | QName service = null;
|
| 115 |
|
| 116 | this.logger.finest("message mep : " + msgIn.getPattern());
|
| 117 | if (partner != null) {
|
| 118 | endpointName = this.getEndPointName(partner);
|
| 119 | service = this.getService(partner);
|
| 120 |
|
| 121 | if (service != null) {
|
| 122 | this.logger.info("Set the service to invoke: " + service);
|
| 123 | msgIn.setService(service);
|
| 124 | if (endpointName != null) {
|
| 125 | ServiceEndpoint endpoint = this.resolveEndPoint(service,
|
| 126 | endpointName);
|
| 127 | this.logger.info("Set the endpoint to invoke: "
|
| 128 | + endpoint.getEndpointName());
|
| 129 | msgIn.setEndpoint(endpoint);
|
| 130 | }
|
| 131 | }
|
| 132 | } else {
|
| 133 | this.logger
|
| 134 | .finest("partner is null: research the service by its interface");
|
| 135 | }
|
| 136 |
|
| 137 | this.logger.finest("Satus: " + msgIn.getStatus());
|
| 138 | this.logger.finest("Consumer Role? " + msgIn.isConsumerRole());
|
| 139 |
|
| 140 | if ((sendStyle == SendStyle.ASYNCHRONOUS_SEND)
|
| 141 | && (msgIn.isInOnlyPattern())) {
|
| 142 | channel.send(((ExchangeImpl) msgIn).getMessageExchange());
|
| 143 | } else if (sendStyle == SendStyle.SYNCHRONOUS_SEND) {
|
| 144 | if (syncTime != null) {
|
| 145 | channel.sendSync(((ExchangeImpl) msgIn).getMessageExchange(),
|
| 146 | syncTime);
|
| 147 | } else {
|
| 148 | channel.sendSync(((ExchangeImpl) msgIn).getMessageExchange());
|
| 149 | }
|
| 150 |
|
| 151 | if ((msgIn.getFault() != null) || (msgIn.getError() != null)
|
| 152 | || (msgIn.isErrorStatus())) {
|
| 153 | if (msgIn.getError() != null) {
|
| 154 | throw new Error(msgIn.getError());
|
| 155 | }
|
| 156 |
|
| 157 | if (msgIn.getFault() != null) {
|
| 158 | try {
|
| 159 | SOAPFault soapfault = new SOAPFault(msgIn.getFault());
|
| 160 |
|
| 161 | List<BpelFaultMessage> bpelfaults = Marshaller
|
| 162 | .getInstance()
|
| 163 | .buildBPELFaultMessagesFromJBIFaultMessages(
|
| 164 | infos, portTypeQName, operation,
|
| 165 | soapfault.getSoapFaults());
|
| 166 |
|
| 167 | if (bpelfaults == null) {
|
| 168 | throw new Error(
|
| 169 | "these received fault messages are not defined in WSDL document: "
|
| 170 | + soapfault.getSoapFaults());
|
| 171 | }
|
| 172 |
|
| 173 | throw new Fault(bpelfaults);
|
| 174 | } catch (PEtALSCDKException e) {
|
| 175 | throw new Error(
|
| 176 | "Can not convert fault into XML document");
|
| 177 | }
|
| 178 | }
|
| 179 | throw new Error("Error from the provider " + service
|
| 180 | + endpointName);
|
| 181 | }
|
| 182 |
|
| 183 | this.logger.log(Level.INFO, "Receive response from: " + service
|
| 184 | + endpointName);
|
| 185 | if (operation.getOutput() != null) {
|
| 186 | @SuppressWarnings("unchecked")
|
| 187 | final Map<String, Part> outputParts = operation.getOutput()
|
| 188 | .getMessage().getParts();
|
| 189 | messageReturned = Marshaller.getInstance()
|
| 190 | .buildBPELMessageFromJBIMessage(infos, portTypeQName,
|
| 191 | operation, outputParts.values(),
|
| 192 | msgIn.getOutMessageContentAsDocument());
|
| 193 |
|
| 194 | this.logger.finest("bpel message returned: " + messageReturned);
|
| 195 | }
|
| 196 |
|
| 197 | if (!msgIn.getPattern().equals(MEPConstants.IN_ONLY_PATTERN)) {
|
| 198 | this.logger.finest("Set status done");
|
| 199 | msgIn.setDoneStatus();
|
| 200 | this.logger.finest("Send status done");
|
| 201 | channel.send(((ExchangeImpl) msgIn).getMessageExchange());
|
| 202 | }
|
| 203 |
|
| 204 | } else {
|
| 205 | // FIXME should not happen : the exchange mep has been created in
|
| 206 | // correlation with the senStyle parameter in a previous method
|
| 207 | throw new Error(
|
| 208 | "this kind of message ("
|
| 209 | + sendStyle
|
| 210 | + ") is unknown or is incompatible with the mep of message: "
|
| 211 | + msgIn.getPattern());
|
| 212 | }
|
| 213 |
|
| 214 | this.logger.finest("JBI message sent");
|
| 215 | return messageReturned;
|
| 216 | }
|
| 217 |
|
| 218 | /**
|
| 219 | * Extract the service from a partner reference information item.
|
| 220 | *
|
| 221 | * @param ii
|
| 222 | * Information Item
|
| 223 | * @return the service QName
|
| 224 | */
|
| 225 | public final QName getService(final Element ii) {
|
| 226 |
|
| 227 | logger.log(Level.FINEST, "Entering in getService method");
|
| 228 |
|
| 229 | final org.w3c.dom.Element serviceRefElem = (org.w3c.dom.Element) ii;
|
| 230 |
|
| 231 | final org.w3c.dom.Element endpointRef = (org.w3c.dom.Element) serviceRefElem
|
| 232 | .getElementsByTagName("EndpointReference").item(0);
|
| 233 |
|
| 234 | final org.w3c.dom.Element serviceElmt = (org.w3c.dom.Element) endpointRef
|
| 235 | .getElementsByTagName("ServiceName").item(0);
|
| 236 |
|
| 237 | String serviceName = null;
|
| 238 | String prefixName = null;
|
| 239 |
|
| 240 | if (serviceElmt.getTextContent().indexOf(":") > -1) {
|
| 241 | serviceName = serviceElmt.getTextContent().substring(
|
| 242 | serviceElmt.getTextContent().indexOf(":") + 1);
|
| 243 | prefixName = serviceElmt.getTextContent().substring(0,
|
| 244 | serviceElmt.getTextContent().indexOf(":"));
|
| 245 | } else {
|
| 246 | serviceName = serviceElmt.getTextContent();
|
| 247 | }
|
| 248 |
|
| 249 | String serviceNamespace = serviceElmt.lookupNamespaceURI(prefixName);
|
| 250 | if (serviceNamespace == null) {
|
| 251 | String prefixTmp = null;
|
| 252 | final NamedNodeMap list = serviceElmt.getAttributes();
|
| 253 | for (int i = 0; i < list.getLength(); i++) {
|
| 254 |
|
| 255 | if (list.item(i).getNodeName().indexOf(":") > -1) {
|
| 256 | prefixTmp = list.item(i).getNodeName().substring(
|
| 257 | list.item(i).getNodeName().indexOf(":") + 1);
|
| 258 | } else {
|
| 259 | prefixTmp = list.item(i).getNodeName();
|
| 260 | }
|
| 261 |
|
| 262 | if ((prefixName != null) && (prefixName.equals(prefixTmp))) {
|
| 263 | serviceNamespace = list.item(i).getNodeValue();
|
| 264 | }
|
| 265 | }
|
| 266 | }
|
| 267 |
|
| 268 | // TODO: Normally, just this line is sufficient
|
| 269 | // QName service = new QName(serviceElmt.lookupNamespaceURI(prefixName),
|
| 270 | // serviceName);
|
| 271 |
|
| 272 | final QName service = new QName(serviceNamespace, serviceName);
|
| 273 |
|
| 274 | logger.log(Level.FINEST, "service name: " + service);
|
| 275 | logger.log(Level.FINEST, "Exit of the getService method");
|
| 276 | return service;
|
| 277 | }
|
| 278 |
|
| 279 | /**
|
| 280 | * Extract the endPoint reference from a service reference information item.
|
| 281 | *
|
| 282 | * @param ii
|
| 283 | * Information Item
|
| 284 | * @return the end Point URL
|
| 285 | */
|
| 286 | public final String getEndPointName(final Element ii) {
|
| 287 | String endpointName = null;
|
| 288 | logger.log(Level.FINEST, "Entering in getEndPointName method");
|
| 289 |
|
| 290 | final org.w3c.dom.Element serviceRefElem = (org.w3c.dom.Element) ii;
|
| 291 |
|
| 292 | org.w3c.dom.Element endpointRef = null;
|
| 293 |
|
| 294 | if (serviceRefElem.getElementsByTagName("EndpointReference")
|
| 295 | .getLength() > 0) {
|
| 296 | endpointRef = (org.w3c.dom.Element) serviceRefElem
|
| 297 | .getElementsByTagName("EndpointReference").item(0);
|
| 298 | }
|
| 299 |
|
| 300 | if (endpointRef != null) {
|
| 301 | org.w3c.dom.Element endpoint = null;
|
| 302 | if (endpointRef.getElementsByTagName("Address").getLength() > 0) {
|
| 303 | endpoint = (org.w3c.dom.Element) endpointRef
|
| 304 | .getElementsByTagName("Address").item(0);
|
| 305 | }
|
| 306 |
|
| 307 | if (endpoint != null) {
|
| 308 | endpointName = endpoint.getTextContent();
|
| 309 | }
|
| 310 | }
|
| 311 | logger.log(Level.FINEST, "endpoint name found: " + endpointName);
|
| 312 | logger.log(Level.FINEST, "Exit of the getEndPointName method");
|
| 313 |
|
| 314 | return endpointName;
|
| 315 | }
|
| 316 |
|
| 317 | /**
|
| 318 | * Find the endpoint in the JBI env
|
| 319 | *
|
| 320 | * @param service
|
| 321 | * @param endpointName
|
| 322 | * @return
|
| 323 | * @throws OrchestraEngineException
|
| 324 | * endpoint can not be found in the JBI context
|
| 325 | */
|
| 326 | public final ServiceEndpoint resolveEndPoint(final QName service,
|
| 327 | final String endpointName) throws OrchestraEngineException {
|
| 328 |
|
| 329 | logger.log(Level.FINEST, "find the endPoint in the JBI environment");
|
| 330 |
|
| 331 | logger.log(Level.FINEST, "service name: " + service);
|
| 332 | logger.log(Level.FINEST, "endpoint name: " + endpointName);
|
| 333 |
|
| 334 | // Search by endpoint
|
| 335 | ServiceEndpoint endpoint = context.getEndpoint(service, endpointName);
|
| 336 |
|
| 337 | if (endpoint == null) {
|
| 338 | throw new OrchestraEngineException("endpoint (" + service + "-"
|
| 339 | + endpointName + ") not found in the JBI environment");
|
| 340 | }
|
| 341 |
|
| 342 | logger.log(Level.FINEST, "endpoint service found: " + endpoint);
|
| 343 | return endpoint;
|
| 344 | }
|