Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
XmppExchange |
|
| 0.0;0 |
1 | /** |
|
2 | * |
|
3 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
4 | * contributor license agreements. See the NOTICE file distributed with |
|
5 | * this work for additional information regarding copyright ownership. |
|
6 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
7 | * (the "License"); you may not use this file except in compliance with |
|
8 | * the License. You may obtain a copy of the License at |
|
9 | * |
|
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | * |
|
12 | * Unless required by applicable law or agreed to in writing, software |
|
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | * See the License for the specific language governing permissions and |
|
16 | * limitations under the License. |
|
17 | */ |
|
18 | package org.apache.camel.component.xmpp; |
|
19 | ||
20 | import org.apache.camel.impl.DefaultExchange; |
|
21 | import org.apache.camel.CamelContext; |
|
22 | import org.apache.camel.Exchange; |
|
23 | import org.jivesoftware.smack.packet.Message; |
|
24 | ||
25 | /** |
|
26 | * Represents an {@ilnk Exchange} for working with XMPP |
|
27 | * |
|
28 | * @version $Revision:520964 $ |
|
29 | */ |
|
30 | 0 | public class XmppExchange extends DefaultExchange { |
31 | private XmppBinding binding; |
|
32 | ||
33 | public XmppExchange(CamelContext context, XmppBinding binding) { |
|
34 | 0 | super(context); |
35 | 0 | this.binding = binding; |
36 | 0 | } |
37 | ||
38 | public XmppExchange(CamelContext context, XmppBinding binding, Message message) { |
|
39 | 0 | this(context, binding); |
40 | 0 | setIn(new XmppMessage(message)); |
41 | 0 | } |
42 | ||
43 | @Override |
|
44 | public XmppMessage getIn() { |
|
45 | 0 | return (XmppMessage) super.getIn(); |
46 | } |
|
47 | ||
48 | @Override |
|
49 | public XmppMessage getOut() { |
|
50 | 0 | return (XmppMessage) super.getOut(); |
51 | } |
|
52 | ||
53 | @Override |
|
54 | public XmppMessage getOut(boolean lazyCreate) { |
|
55 | 0 | return (XmppMessage) super.getOut(lazyCreate); |
56 | } |
|
57 | ||
58 | @Override |
|
59 | public XmppMessage getFault() { |
|
60 | 0 | return (XmppMessage) super.getFault(); |
61 | } |
|
62 | ||
63 | public XmppBinding getBinding() { |
|
64 | 0 | return binding; |
65 | } |
|
66 | ||
67 | @Override |
|
68 | public Exchange newInstance() { |
|
69 | 0 | return new XmppExchange(getContext(), binding); |
70 | } |
|
71 | ||
72 | // Expose the underlying XMPP APIs |
|
73 | //------------------------------------------------------------------------- |
|
74 | ||
75 | /** |
|
76 | * Return the underlying XMPP In message |
|
77 | * |
|
78 | * @return the XMPP In message |
|
79 | */ |
|
80 | public Message getInMessage() { |
|
81 | 0 | return getIn().getXmppMessage(); |
82 | } |
|
83 | ||
84 | /** |
|
85 | * Return the underlying XMPP Out message |
|
86 | * |
|
87 | * @return the XMPP out message |
|
88 | */ |
|
89 | public Message getOutMessage() { |
|
90 | 0 | return getOut().getXmppMessage(); |
91 | } |
|
92 | ||
93 | /** |
|
94 | * Return the underlying XMPP Fault message |
|
95 | * |
|
96 | * @return the XMPP fault message |
|
97 | */ |
|
98 | public Message getFaultMessage() { |
|
99 | 0 | return getOut().getXmppMessage(); |
100 | } |
|
101 | ||
102 | // Implementation methods |
|
103 | //------------------------------------------------------------------------- |
|
104 | ||
105 | @Override |
|
106 | protected XmppMessage createInMessage() { |
|
107 | 0 | return new XmppMessage(); |
108 | } |
|
109 | ||
110 | @Override |
|
111 | protected XmppMessage createOutMessage() { |
|
112 | 0 | return new XmppMessage(); |
113 | } |
|
114 | } |