001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */package org.apache.cxf.message;
019:
020: import org.apache.cxf.endpoint.ConduitSelector;
021: import org.apache.cxf.endpoint.Endpoint;
022: import org.apache.cxf.endpoint.PreexistingConduitSelector;
023: import org.apache.cxf.transport.Conduit;
024: import org.apache.cxf.transport.Destination;
025: import org.apache.cxf.transport.Session;
026:
027: public class ExchangeImpl extends StringMapImpl implements Exchange {
028:
029: private Destination destination;
030: private boolean oneWay;
031:
032: private Message inMessage;
033: private Message outMessage;
034: private Message inFaultMessage;
035: private Message outFaultMessage;
036:
037: private Session session;
038:
039: public Destination getDestination() {
040: return destination;
041: }
042:
043: public Message getInMessage() {
044: return inMessage;
045: }
046:
047: public Conduit getConduit(Message message) {
048: return get(ConduitSelector.class) != null ? get(
049: ConduitSelector.class).selectConduit(message) : null;
050: }
051:
052: public Message getOutMessage() {
053: return outMessage;
054: }
055:
056: public Message getInFaultMessage() {
057: return inFaultMessage;
058: }
059:
060: public void setInFaultMessage(Message m) {
061: inFaultMessage = m;
062: m.setExchange(this );
063: }
064:
065: public Message getOutFaultMessage() {
066: return outFaultMessage;
067: }
068:
069: public void setOutFaultMessage(Message m) {
070: outFaultMessage = m;
071: m.setExchange(this );
072: }
073:
074: public void setDestination(Destination d) {
075: destination = d;
076: }
077:
078: public void setInMessage(Message m) {
079: inMessage = m;
080: if (null != m) {
081: m.setExchange(this );
082: }
083: }
084:
085: public void setConduit(Conduit c) {
086: put(ConduitSelector.class, new PreexistingConduitSelector(c,
087: get(Endpoint.class)));
088: }
089:
090: public void setOutMessage(Message m) {
091: outMessage = m;
092: if (null != m) {
093: m.setExchange(this );
094: }
095: }
096:
097: public boolean isOneWay() {
098: return oneWay;
099: }
100:
101: public void setOneWay(boolean b) {
102: oneWay = b;
103: }
104:
105: public Session getSession() {
106: return session;
107: }
108:
109: public void setSession(Session session) {
110: this .session = session;
111: }
112:
113: public void clear() {
114: super .clear();
115: destination = null;
116: oneWay = false;
117: inMessage = null;
118: outMessage = null;
119: inFaultMessage = null;
120: outFaultMessage = null;
121: session = null;
122: }
123: }
|