1
2
3
4
5
6
7
8
9
10
11 package org.mule.endpoint;
12
13 import org.mule.api.MuleContext;
14 import org.mule.api.MuleEvent;
15 import org.mule.api.MuleMessage;
16 import org.mule.api.endpoint.EndpointURI;
17 import org.mule.api.endpoint.OutboundEndpoint;
18 import org.mule.api.routing.filter.Filter;
19 import org.mule.api.security.EndpointSecurityFilter;
20 import org.mule.api.transaction.TransactionConfig;
21 import org.mule.api.transport.ConnectionStrategy;
22 import org.mule.api.transport.Connector;
23 import org.mule.api.transport.DispatchException;
24
25 import java.util.List;
26 import java.util.Map;
27
28
29
30
31
32 public class DynamicURIOutboundEndpoint implements OutboundEndpoint
33 {
34
35 private static final long serialVersionUID = -2814979100270307813L;
36
37 private OutboundEndpoint endpoint;
38 private EndpointURI dynamicEndpointURI;
39
40 public DynamicURIOutboundEndpoint(OutboundEndpoint endpoint)
41 {
42 this.endpoint = endpoint;
43 }
44
45 public DynamicURIOutboundEndpoint(OutboundEndpoint endpoint, EndpointURI dynamicEndpointURI)
46 {
47 this.endpoint = endpoint;
48 setEndpointURI(dynamicEndpointURI);
49 }
50
51 public EndpointURI getEndpointURI()
52 {
53 if (dynamicEndpointURI != null)
54 {
55 return dynamicEndpointURI;
56 }
57 else
58 {
59 return endpoint.getEndpointURI();
60 }
61 }
62
63 public void setEndpointURI(EndpointURI dynamicEndpointURI)
64 {
65 this.dynamicEndpointURI = dynamicEndpointURI;
66 }
67
68 public void dispatch(MuleEvent event) throws DispatchException
69 {
70 endpoint.dispatch(event);
71 }
72
73 public ConnectionStrategy getConnectionStrategy()
74 {
75 return endpoint.getConnectionStrategy();
76 }
77
78 public Connector getConnector()
79 {
80 return endpoint.getConnector();
81 }
82
83 public String getEncoding()
84 {
85 return endpoint.getEncoding();
86 }
87
88 public Filter getFilter()
89 {
90 return endpoint.getFilter();
91 }
92
93 public String getInitialState()
94 {
95 return endpoint.getInitialState();
96 }
97
98 public MuleContext getMuleContext()
99 {
100 return endpoint.getMuleContext();
101 }
102
103 public String getName()
104 {
105 return endpoint.getName();
106 }
107
108 public Map getProperties()
109 {
110 return endpoint.getProperties();
111 }
112
113 public Object getProperty(Object key)
114 {
115 return endpoint.getProperty(key);
116 }
117
118 public String getProtocol()
119 {
120 return endpoint.getProtocol();
121 }
122
123 public int getRemoteSyncTimeout()
124 {
125 return endpoint.getRemoteSyncTimeout();
126 }
127
128 public List getResponseTransformers()
129 {
130 return endpoint.getResponseTransformers();
131 }
132
133 public EndpointSecurityFilter getSecurityFilter()
134 {
135 return endpoint.getSecurityFilter();
136 }
137
138 public TransactionConfig getTransactionConfig()
139 {
140 return endpoint.getTransactionConfig();
141 }
142
143 public List getTransformers()
144 {
145 return endpoint.getTransformers();
146 }
147
148 public boolean isDeleteUnacceptedMessages()
149 {
150 return endpoint.isDeleteUnacceptedMessages();
151 }
152
153 public boolean isReadOnly()
154 {
155 return endpoint.isReadOnly();
156 }
157
158 public boolean isRemoteSync()
159 {
160 return endpoint.isRemoteSync();
161 }
162
163 public boolean isSynchronous()
164 {
165 return endpoint.isSynchronous();
166 }
167
168 public MuleMessage send(MuleEvent event) throws DispatchException
169 {
170 return endpoint.send(event);
171 }
172
173 public int hashCode()
174 {
175 final int prime = 31;
176 int result = 1;
177 result = prime * result + ((dynamicEndpointURI == null) ? 0 : dynamicEndpointURI.hashCode());
178 result = prime * result + ((endpoint == null) ? 0 : endpoint.hashCode());
179 return result;
180 }
181
182 public boolean equals(Object obj)
183 {
184 if (this == obj) return true;
185 if (obj == null) return false;
186 if (getClass() != obj.getClass()) return false;
187 final DynamicURIOutboundEndpoint other = (DynamicURIOutboundEndpoint) obj;
188 if (dynamicEndpointURI == null)
189 {
190 if (other.dynamicEndpointURI != null) return false;
191 }
192 else if (!dynamicEndpointURI.equals(other.dynamicEndpointURI)) return false;
193 if (endpoint == null)
194 {
195 if (other.endpoint != null) return false;
196 }
197 else if (!endpoint.equals(other.endpoint)) return false;
198 return true;
199 }
200
201 }