001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id: ExchangeTarget.java 1694 2006-10-11 19:20:34Z mpreston $
023: */
024:
025: package com.bostechcorp.cbesb.runtime.component.sequencing.processors;
026:
027: import javax.jbi.messaging.MessageExchange;
028: import javax.jbi.messaging.MessagingException;
029: import javax.xml.namespace.QName;
030:
031: public class ExchangeTarget {
032:
033: private QName _interface;
034: private QName operation;
035: private QName service;
036: private int timeout;
037:
038: /**
039: * @return the _interface
040: */
041: public QName getInterface() {
042: return _interface;
043: }
044:
045: /**
046: * @param _interface the _interface to set
047: */
048: public void setInterface(QName _interface) {
049: this ._interface = _interface;
050: }
051:
052: /**
053: * @return the operation
054: */
055: public QName getOperation() {
056: return operation;
057: }
058:
059: /**
060: * @param operation the operation to set
061: */
062: public void setOperation(QName operation) {
063: this .operation = operation;
064: }
065:
066: /**
067: * @return the service
068: */
069: public QName getService() {
070: return service;
071: }
072:
073: /**
074: * @param service the service to set
075: */
076: public void setService(QName service) {
077: this .service = service;
078: }
079:
080: /**
081: * @return the timeout
082: */
083: public int getTimeout() {
084: return timeout;
085: }
086:
087: /**
088: * @param timeout the timeout to set
089: */
090: public void setTimeout(int timeout) {
091: this .timeout = timeout;
092: }
093:
094: /**
095: * Configures the target on the newly created exchange
096: * @param exchange the exchange to configure
097: * @throws MessagingException if the target could not be configured
098: */
099: public void configureTarget(MessageExchange exchange)
100: throws MessagingException {
101: if (_interface == null && service == null) {
102: throw new MessagingException(
103: "interface or service should be specified");
104: }
105: if (_interface != null) {
106: exchange.setInterfaceName(_interface);
107: }
108: if (service != null) {
109: exchange.setService(service);
110: }
111: if (operation != null) {
112: exchange.setOperation(operation);
113: }
114: }
115:
116: public String toString() {
117: StringBuffer buffer = new StringBuffer();
118: buffer.append("\tInterface = " + _interface + "\n");
119: buffer.append("\tOperation = " + operation + "\n");
120: buffer.append("\tService = " + service + "\n");
121: buffer.append("\tTimeout = " + timeout + "\n");
122: return buffer.toString();
123: }
124: }
|