1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule; |
12 | |
|
13 | |
import org.mule.api.DefaultMuleException; |
14 | |
import org.mule.api.MuleContext; |
15 | |
import org.mule.api.MuleEvent; |
16 | |
import org.mule.api.MuleException; |
17 | |
import org.mule.api.MuleMessage; |
18 | |
import org.mule.api.MuleSession; |
19 | |
import org.mule.api.ThreadSafeAccess; |
20 | |
import org.mule.api.config.MuleProperties; |
21 | |
import org.mule.api.construct.FlowConstruct; |
22 | |
import org.mule.api.endpoint.EndpointBuilder; |
23 | |
import org.mule.api.endpoint.EndpointURI; |
24 | |
import org.mule.api.endpoint.ImmutableEndpoint; |
25 | |
import org.mule.api.endpoint.InboundEndpoint; |
26 | |
import org.mule.api.registry.ServiceType; |
27 | |
import org.mule.api.security.Credentials; |
28 | |
import org.mule.api.transformer.DataType; |
29 | |
import org.mule.api.transformer.Transformer; |
30 | |
import org.mule.api.transformer.TransformerException; |
31 | |
import org.mule.config.i18n.CoreMessages; |
32 | |
import org.mule.endpoint.DefaultEndpointFactory; |
33 | |
import org.mule.endpoint.MuleEndpointURI; |
34 | |
import org.mule.management.stats.ProcessingTime; |
35 | |
import org.mule.security.MuleCredentials; |
36 | |
import org.mule.session.DefaultMuleSession; |
37 | |
import org.mule.transformer.types.DataTypeFactory; |
38 | |
import org.mule.transport.service.TransportServiceDescriptor; |
39 | |
import org.mule.util.UUID; |
40 | |
import org.mule.util.store.DeserializationPostInitialisable; |
41 | |
|
42 | |
import org.apache.commons.logging.Log; |
43 | |
import org.apache.commons.logging.LogFactory; |
44 | |
|
45 | |
import java.io.IOException; |
46 | |
import java.io.ObjectInputStream; |
47 | |
import java.io.ObjectOutputStream; |
48 | |
import java.io.OutputStream; |
49 | |
import java.util.EventObject; |
50 | |
import java.util.HashMap; |
51 | |
import java.util.Iterator; |
52 | |
import java.util.LinkedList; |
53 | |
import java.util.List; |
54 | |
import java.util.Map; |
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
public class DefaultMuleEvent extends EventObject implements MuleEvent, ThreadSafeAccess, DeserializationPostInitialisable |
66 | |
{ |
67 | |
|
68 | |
|
69 | |
|
70 | |
private static final long serialVersionUID = 1L; |
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | 0 | private static Log logger = LogFactory.getLog(DefaultMuleEvent.class); |
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | 0 | private transient ImmutableEndpoint endpoint = null; |
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | 0 | private String id = null; |
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | 0 | private MuleMessage message = null; |
91 | |
|
92 | |
private MuleSession session; |
93 | |
|
94 | 0 | private boolean stopFurtherProcessing = false; |
95 | |
|
96 | 0 | private int timeout = TIMEOUT_NOT_SET_VALUE; |
97 | |
|
98 | 0 | private transient ResponseOutputStream outputStream = null; |
99 | |
|
100 | 0 | private transient Object transformedMessage = null; |
101 | |
|
102 | 0 | private Credentials credentials = null; |
103 | |
|
104 | 0 | protected String[] ignoredPropertyOverrides = new String[]{MuleProperties.MULE_METHOD_PROPERTY}; |
105 | |
|
106 | 0 | private transient Map<String, Object> serializedData = null; |
107 | |
|
108 | |
private final ProcessingTime processingTime; |
109 | |
|
110 | |
|
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
|
120 | |
public DefaultMuleEvent(MuleMessage message, |
121 | |
ImmutableEndpoint endpoint, |
122 | |
FlowConstruct service, |
123 | |
MuleEvent previousEvent) |
124 | |
{ |
125 | 0 | super(message.getPayload()); |
126 | 0 | this.message = message; |
127 | 0 | this.id = generateEventId(); |
128 | 0 | this.session = previousEvent.getSession(); |
129 | 0 | session.setFlowConstruct(service); |
130 | 0 | this.endpoint = endpoint; |
131 | 0 | this.timeout = previousEvent.getTimeout(); |
132 | 0 | this.outputStream = (ResponseOutputStream) previousEvent.getOutputStream(); |
133 | 0 | this.processingTime = ProcessingTime.newInstance(this.session, message.getMuleContext()); |
134 | 0 | fillProperties(previousEvent); |
135 | 0 | } |
136 | |
|
137 | |
public DefaultMuleEvent(MuleMessage message, |
138 | |
ImmutableEndpoint endpoint, |
139 | |
MuleEvent previousEvent, |
140 | |
MuleSession session) |
141 | |
{ |
142 | 0 | super(message.getPayload()); |
143 | 0 | this.message = message; |
144 | 0 | this.id = previousEvent.getId(); |
145 | 0 | this.session = session; |
146 | 0 | this.endpoint = endpoint; |
147 | 0 | this.timeout = previousEvent.getTimeout(); |
148 | 0 | this.outputStream = (ResponseOutputStream) previousEvent.getOutputStream(); |
149 | 0 | this.processingTime = ProcessingTime.newInstance(this.session, message.getMuleContext()); |
150 | 0 | fillProperties(previousEvent); |
151 | 0 | } |
152 | |
|
153 | |
public DefaultMuleEvent(MuleMessage message, |
154 | |
ImmutableEndpoint endpoint, |
155 | |
MuleSession session) |
156 | |
{ |
157 | 0 | this(message, endpoint, session, null, null); |
158 | 0 | } |
159 | |
|
160 | |
public DefaultMuleEvent(MuleMessage message, |
161 | |
ImmutableEndpoint endpoint, |
162 | |
MuleSession session, |
163 | |
ProcessingTime time) |
164 | |
{ |
165 | 0 | this(message, endpoint, session, null, time); |
166 | 0 | } |
167 | |
|
168 | |
public DefaultMuleEvent(MuleMessage message, |
169 | |
ImmutableEndpoint endpoint, |
170 | |
MuleSession session, |
171 | |
ResponseOutputStream outputStream) |
172 | |
{ |
173 | 0 | this(message, endpoint, session, outputStream, null); |
174 | 0 | } |
175 | |
|
176 | |
public DefaultMuleEvent(MuleMessage message, |
177 | |
ImmutableEndpoint endpoint, |
178 | |
MuleSession session, |
179 | |
ResponseOutputStream outputStream, |
180 | |
ProcessingTime time) |
181 | |
{ |
182 | 0 | super(message.getPayload()); |
183 | 0 | this.message = message; |
184 | 0 | this.endpoint = endpoint; |
185 | 0 | this.session = session; |
186 | 0 | this.id = generateEventId(); |
187 | 0 | this.outputStream = outputStream; |
188 | 0 | fillProperties(null); |
189 | 0 | this.processingTime = time != null ? time : ProcessingTime.newInstance(this.session, message.getMuleContext()); |
190 | 0 | } |
191 | |
|
192 | |
|
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
|
198 | |
public DefaultMuleEvent(MuleMessage message, MuleEvent rewriteEvent) |
199 | |
{ |
200 | 0 | super(message.getPayload()); |
201 | 0 | this.message = message; |
202 | 0 | this.id = rewriteEvent.getId(); |
203 | 0 | this.session = rewriteEvent.getSession(); |
204 | 0 | session.setFlowConstruct(rewriteEvent.getFlowConstruct()); |
205 | 0 | this.endpoint = rewriteEvent.getEndpoint(); |
206 | 0 | this.timeout = rewriteEvent.getTimeout(); |
207 | 0 | this.outputStream = (ResponseOutputStream) rewriteEvent.getOutputStream(); |
208 | 0 | if (rewriteEvent instanceof DefaultMuleEvent) |
209 | |
{ |
210 | 0 | this.transformedMessage = ((DefaultMuleEvent) rewriteEvent).getCachedMessage(); |
211 | 0 | this.processingTime = ((DefaultMuleEvent)rewriteEvent).processingTime; |
212 | |
} |
213 | |
else |
214 | |
{ |
215 | 0 | this.processingTime = ProcessingTime.newInstance(this.session, message.getMuleContext()); |
216 | |
} |
217 | 0 | fillProperties(rewriteEvent); |
218 | 0 | } |
219 | |
|
220 | |
protected void fillProperties(MuleEvent previousEvent) |
221 | |
{ |
222 | 0 | if (endpoint != null && endpoint.getProperties() != null) |
223 | |
{ |
224 | 0 | for (Iterator iterator = endpoint.getProperties().keySet().iterator(); iterator.hasNext();) |
225 | |
{ |
226 | 0 | String prop = (String) iterator.next(); |
227 | 0 | Object value = endpoint.getProperties().get(prop); |
228 | |
|
229 | 0 | if (!ignoreProperty(prop)) |
230 | |
{ |
231 | |
|
232 | 0 | message.setInvocationProperty(prop, value); |
233 | |
} |
234 | 0 | } |
235 | |
} |
236 | |
|
237 | 0 | setCredentials(); |
238 | 0 | } |
239 | |
|
240 | |
|
241 | |
|
242 | |
|
243 | |
|
244 | |
|
245 | |
|
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
|
252 | |
protected boolean ignoreProperty(String key) |
253 | |
{ |
254 | 0 | if (key == null) |
255 | |
{ |
256 | 0 | return true; |
257 | |
} |
258 | |
|
259 | 0 | for (int i = 0; i < ignoredPropertyOverrides.length; i++) |
260 | |
{ |
261 | 0 | if (key.equals(ignoredPropertyOverrides[i])) |
262 | |
{ |
263 | 0 | return false; |
264 | |
} |
265 | |
} |
266 | |
|
267 | 0 | return null != message.getOutboundProperty(key); |
268 | |
} |
269 | |
|
270 | |
protected void setCredentials() |
271 | |
{ |
272 | 0 | if (null != endpoint && null != endpoint.getEndpointURI() && null != endpoint.getEndpointURI().getUserInfo()) |
273 | |
{ |
274 | 0 | final String userName = endpoint.getEndpointURI().getUser(); |
275 | 0 | final String password = endpoint.getEndpointURI().getPassword(); |
276 | 0 | if (password != null && userName != null) |
277 | |
{ |
278 | 0 | credentials = new MuleCredentials(userName, password.toCharArray()); |
279 | |
} |
280 | |
} |
281 | 0 | } |
282 | |
|
283 | |
public Credentials getCredentials() |
284 | |
{ |
285 | 0 | MuleCredentials creds = message.getOutboundProperty(MuleProperties.MULE_CREDENTIALS_PROPERTY); |
286 | 0 | return (credentials != null ? credentials : creds); |
287 | |
} |
288 | |
|
289 | |
Object getCachedMessage() |
290 | |
{ |
291 | 0 | return transformedMessage; |
292 | |
} |
293 | |
|
294 | |
public MuleMessage getMessage() |
295 | |
{ |
296 | 0 | return message; |
297 | |
} |
298 | |
|
299 | |
public byte[] getMessageAsBytes() throws DefaultMuleException |
300 | |
{ |
301 | |
try |
302 | |
{ |
303 | 0 | return message.getPayloadAsBytes(); |
304 | |
} |
305 | 0 | catch (Exception e) |
306 | |
{ |
307 | 0 | throw new DefaultMuleException( |
308 | |
CoreMessages.cannotReadPayloadAsBytes(message.getPayload().getClass().getName()), e); |
309 | |
} |
310 | |
} |
311 | |
|
312 | |
@SuppressWarnings("unchecked") |
313 | |
public <T> T transformMessage(Class<T> outputType) throws TransformerException |
314 | |
{ |
315 | 0 | return (T) transformMessage(DataTypeFactory.create(outputType)); |
316 | |
} |
317 | |
|
318 | |
public <T> T transformMessage(DataType<T> outputType) throws TransformerException |
319 | |
{ |
320 | 0 | if (outputType == null) |
321 | |
{ |
322 | 0 | throw new TransformerException(CoreMessages.objectIsNull("outputType")); |
323 | |
} |
324 | 0 | return message.getPayload(outputType); |
325 | |
} |
326 | |
|
327 | |
|
328 | |
|
329 | |
|
330 | |
|
331 | |
|
332 | |
|
333 | |
|
334 | |
|
335 | |
|
336 | |
|
337 | |
|
338 | |
|
339 | |
@Deprecated |
340 | |
public byte[] transformMessageToBytes() throws TransformerException |
341 | |
{ |
342 | 0 | return transformMessage(DataType.BYTE_ARRAY_DATA_TYPE); |
343 | |
} |
344 | |
|
345 | |
|
346 | |
|
347 | |
|
348 | |
|
349 | |
|
350 | |
|
351 | |
|
352 | |
|
353 | |
|
354 | |
|
355 | |
|
356 | |
|
357 | |
public String transformMessageToString() throws TransformerException |
358 | |
{ |
359 | 0 | return transformMessage(DataTypeFactory.createWithEncoding(String.class, getEncoding())); |
360 | |
} |
361 | |
|
362 | |
public String getMessageAsString() throws MuleException |
363 | |
{ |
364 | 0 | return getMessageAsString(getEncoding()); |
365 | |
} |
366 | |
|
367 | |
|
368 | |
|
369 | |
|
370 | |
|
371 | |
|
372 | |
|
373 | |
|
374 | |
|
375 | |
public String getMessageAsString(String encoding) throws MuleException |
376 | |
{ |
377 | |
try |
378 | |
{ |
379 | 0 | return message.getPayloadForLogging(encoding); |
380 | |
} |
381 | 0 | catch (Exception e) |
382 | |
{ |
383 | 0 | throw new DefaultMuleException( |
384 | |
CoreMessages.cannotReadPayloadAsString(message.getClass().getName()), e); |
385 | |
} |
386 | |
} |
387 | |
|
388 | |
public String getId() |
389 | |
{ |
390 | 0 | return id; |
391 | |
} |
392 | |
|
393 | |
|
394 | |
|
395 | |
|
396 | |
|
397 | |
@Deprecated |
398 | |
public Object getProperty(String name) |
399 | |
{ |
400 | 0 | throw new UnsupportedOperationException("Method's behavior has changed in Mule 3, use " + |
401 | |
"event.getMessage() and suitable scope-aware property access " + |
402 | |
"methods on it"); |
403 | |
} |
404 | |
|
405 | |
|
406 | |
|
407 | |
|
408 | |
|
409 | |
@Deprecated |
410 | |
public Object getProperty(String name, Object defaultValue) |
411 | |
{ |
412 | 0 | throw new UnsupportedOperationException("Method's behavior has changed in Mule 3, use " + |
413 | |
"event.getMessage() and suitable scope-aware property access " + |
414 | |
"methods on it"); |
415 | |
} |
416 | |
|
417 | |
public ImmutableEndpoint getEndpoint() |
418 | |
{ |
419 | 0 | return endpoint; |
420 | |
} |
421 | |
|
422 | |
@Override |
423 | |
public String toString() |
424 | |
{ |
425 | 0 | StringBuffer buf = new StringBuffer(64); |
426 | 0 | buf.append("MuleEvent: ").append(getId()); |
427 | 0 | buf.append(", stop processing=").append(isStopFurtherProcessing()); |
428 | 0 | buf.append(", ").append(endpoint); |
429 | |
|
430 | 0 | return buf.toString(); |
431 | |
} |
432 | |
|
433 | |
protected String generateEventId() |
434 | |
{ |
435 | 0 | return UUID.getUUID(); |
436 | |
} |
437 | |
|
438 | |
public MuleSession getSession() |
439 | |
{ |
440 | 0 | return session; |
441 | |
} |
442 | |
|
443 | |
void setSession(MuleSession session) |
444 | |
{ |
445 | 0 | this.session = session; |
446 | 0 | } |
447 | |
|
448 | |
|
449 | |
|
450 | |
|
451 | |
public FlowConstruct getFlowConstruct() |
452 | |
{ |
453 | 0 | return session.getFlowConstruct(); |
454 | |
} |
455 | |
|
456 | |
|
457 | |
|
458 | |
|
459 | |
|
460 | |
|
461 | |
public boolean isStopFurtherProcessing() |
462 | |
{ |
463 | 0 | return stopFurtherProcessing; |
464 | |
} |
465 | |
|
466 | |
|
467 | |
|
468 | |
|
469 | |
|
470 | |
|
471 | |
|
472 | |
|
473 | |
|
474 | |
|
475 | |
|
476 | |
|
477 | |
public void setStopFurtherProcessing(boolean stopFurtherProcessing) |
478 | |
{ |
479 | 0 | this.stopFurtherProcessing = stopFurtherProcessing; |
480 | 0 | } |
481 | |
|
482 | |
@Override |
483 | |
public boolean equals(Object o) |
484 | |
{ |
485 | 0 | if (this == o) |
486 | |
{ |
487 | 0 | return true; |
488 | |
} |
489 | 0 | if (!(o instanceof DefaultMuleEvent)) |
490 | |
{ |
491 | 0 | return false; |
492 | |
} |
493 | |
|
494 | 0 | final DefaultMuleEvent event = (DefaultMuleEvent) o; |
495 | |
|
496 | 0 | if (message != null ? !message.equals(event.message) : event.message != null) |
497 | |
{ |
498 | 0 | return false; |
499 | |
} |
500 | 0 | return id.equals(event.id); |
501 | |
} |
502 | |
|
503 | |
@Override |
504 | |
public int hashCode() |
505 | |
{ |
506 | 0 | return 29 * id.hashCode() + (message != null ? message.hashCode() : 0); |
507 | |
} |
508 | |
|
509 | |
public int getTimeout() |
510 | |
{ |
511 | 0 | if (timeout == TIMEOUT_NOT_SET_VALUE) |
512 | |
{ |
513 | |
|
514 | 0 | timeout = endpoint.getResponseTimeout(); |
515 | |
} |
516 | 0 | return timeout; |
517 | |
} |
518 | |
|
519 | |
public void setTimeout(int timeout) |
520 | |
{ |
521 | 0 | this.timeout = timeout; |
522 | 0 | } |
523 | |
|
524 | |
|
525 | |
|
526 | |
|
527 | |
|
528 | |
|
529 | |
|
530 | |
|
531 | |
public OutputStream getOutputStream() |
532 | |
{ |
533 | 0 | return outputStream; |
534 | |
} |
535 | |
|
536 | |
private void writeObject(ObjectOutputStream out) throws IOException |
537 | |
{ |
538 | 0 | out.defaultWriteObject(); |
539 | 0 | out.writeInt(endpoint.hashCode()); |
540 | 0 | out.writeBoolean(endpoint instanceof InboundEndpoint); |
541 | 0 | out.writeObject(endpoint.getEndpointBuilderName()); |
542 | |
|
543 | |
|
544 | |
|
545 | |
|
546 | 0 | String uri = endpoint.getEndpointURI().getUri().toString(); |
547 | 0 | String connectorName = endpoint.getConnector().getName(); |
548 | 0 | out.writeObject(uri + "?connector=" + connectorName); |
549 | |
|
550 | |
|
551 | 0 | out.writeInt(endpoint.getTransformers().size()); |
552 | |
|
553 | |
|
554 | 0 | if (endpoint.getTransformers().size() > 0) |
555 | |
{ |
556 | 0 | for (Transformer transformer : endpoint.getTransformers()) |
557 | |
{ |
558 | 0 | out.writeObject(transformer.getName()); |
559 | |
} |
560 | |
} |
561 | 0 | } |
562 | |
|
563 | |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException, MuleException |
564 | |
{ |
565 | 0 | in.defaultReadObject(); |
566 | 0 | serializedData = new HashMap<String, Object>(); |
567 | 0 | serializedData.put("endpointHashcode", in.readInt()); |
568 | 0 | serializedData.put("isInboundEndpoint", in.readBoolean()); |
569 | 0 | serializedData.put("endpointBuilderName", in.readObject()); |
570 | 0 | serializedData.put("endpointUri", in.readObject()); |
571 | 0 | int count = in.readInt(); |
572 | |
|
573 | 0 | List<String> transformerNames = new LinkedList<String>(); |
574 | 0 | if (count > 0) |
575 | |
{ |
576 | 0 | while (--count > 0) |
577 | |
{ |
578 | 0 | transformerNames.add((String) in.readObject()); |
579 | |
} |
580 | |
} |
581 | 0 | serializedData.put("transformers", transformerNames); |
582 | 0 | } |
583 | |
|
584 | |
|
585 | |
|
586 | |
|
587 | |
|
588 | |
|
589 | |
|
590 | |
|
591 | |
|
592 | |
|
593 | |
|
594 | |
|
595 | |
@SuppressWarnings({"unused", "unchecked"}) |
596 | |
private void initAfterDeserialisation(MuleContext muleContext) throws MuleException |
597 | |
{ |
598 | 0 | if (session instanceof DefaultMuleSession) |
599 | |
{ |
600 | 0 | ((DefaultMuleSession) session).initAfterDeserialisation(muleContext); |
601 | |
} |
602 | 0 | if (message instanceof DefaultMuleMessage) |
603 | |
{ |
604 | 0 | ((DefaultMuleMessage) message).initAfterDeserialisation(muleContext); |
605 | |
} |
606 | 0 | int endpointHashcode = (Integer) serializedData.get("endpointHashcode"); |
607 | 0 | boolean isInboundEndpoint = (Boolean) serializedData.get("isInboundEndpoint"); |
608 | 0 | String endpointBuilderName = (String) serializedData.get("endpointBuilderName"); |
609 | 0 | String endpointUri = (String) serializedData.get("endpointUri"); |
610 | 0 | List<String> transformerNames = (List<String>) serializedData.get("transformers"); |
611 | |
|
612 | |
|
613 | |
|
614 | 0 | endpoint = (ImmutableEndpoint) muleContext.getRegistry().lookupObject( |
615 | |
DefaultEndpointFactory.ENDPOINT_REGISTRY_PREFIX + endpointHashcode); |
616 | |
|
617 | |
|
618 | 0 | if (endpoint == null) |
619 | |
{ |
620 | |
|
621 | |
|
622 | 0 | if ((endpointBuilderName != null) |
623 | |
&& muleContext.getRegistry().lookupEndpointBuilder(endpointBuilderName) != null) |
624 | |
{ |
625 | 0 | if (isInboundEndpoint) |
626 | |
{ |
627 | 0 | endpoint = muleContext.getEndpointFactory().getInboundEndpoint( |
628 | |
endpointBuilderName); |
629 | |
} |
630 | |
else |
631 | |
{ |
632 | 0 | endpoint = muleContext.getEndpointFactory().getOutboundEndpoint( |
633 | |
endpointBuilderName); |
634 | |
} |
635 | |
} |
636 | |
|
637 | |
else |
638 | |
{ |
639 | 0 | List<Transformer> transformers = new LinkedList<Transformer>(); |
640 | 0 | for (String name : transformerNames) |
641 | |
{ |
642 | 0 | Transformer next = muleContext.getRegistry().lookupTransformer(name); |
643 | 0 | if (next == null) |
644 | |
{ |
645 | 0 | throw new IllegalStateException(CoreMessages.objectNotFound(name).toString()); |
646 | |
} |
647 | |
else |
648 | |
{ |
649 | 0 | transformers.add(next); |
650 | |
} |
651 | 0 | } |
652 | 0 | EndpointURI uri = new MuleEndpointURI(endpointUri, muleContext); |
653 | |
|
654 | 0 | TransportServiceDescriptor tsd = (TransportServiceDescriptor) muleContext.getRegistry().lookupServiceDescriptor(ServiceType.TRANSPORT, uri.getFullScheme(), null); |
655 | 0 | EndpointBuilder endpointBuilder = tsd.createEndpointBuilder(endpointUri); |
656 | 0 | endpointBuilder.setTransformers(transformers); |
657 | |
|
658 | 0 | if (isInboundEndpoint) |
659 | |
{ |
660 | 0 | endpoint = muleContext.getEndpointFactory().getInboundEndpoint( |
661 | |
endpointBuilder); |
662 | |
} |
663 | |
else |
664 | |
{ |
665 | 0 | endpoint = muleContext.getEndpointFactory().getOutboundEndpoint( |
666 | |
endpointBuilder); |
667 | |
} |
668 | |
} |
669 | |
} |
670 | |
|
671 | 0 | serializedData = null; |
672 | 0 | } |
673 | |
|
674 | |
|
675 | |
|
676 | |
|
677 | |
|
678 | |
|
679 | |
|
680 | |
|
681 | |
|
682 | |
public String getEncoding() |
683 | |
{ |
684 | 0 | String encoding = message.getEncoding(); |
685 | 0 | if (encoding == null) |
686 | |
{ |
687 | 0 | encoding = endpoint.getEncoding(); |
688 | |
} |
689 | |
|
690 | 0 | return encoding; |
691 | |
} |
692 | |
|
693 | |
public MuleContext getMuleContext() |
694 | |
{ |
695 | 0 | return message.getMuleContext(); |
696 | |
} |
697 | |
|
698 | |
public ThreadSafeAccess newThreadCopy() |
699 | |
{ |
700 | 0 | if (message instanceof ThreadSafeAccess) |
701 | |
{ |
702 | 0 | DefaultMuleEvent copy = new DefaultMuleEvent((MuleMessage) ((ThreadSafeAccess) message).newThreadCopy(), this); |
703 | 0 | copy.resetAccessControl(); |
704 | 0 | return copy; |
705 | |
} |
706 | |
else |
707 | |
{ |
708 | 0 | return this; |
709 | |
} |
710 | |
} |
711 | |
|
712 | |
public void resetAccessControl() |
713 | |
{ |
714 | 0 | if (message instanceof ThreadSafeAccess) |
715 | |
{ |
716 | 0 | ((ThreadSafeAccess) message).resetAccessControl(); |
717 | |
} |
718 | 0 | } |
719 | |
|
720 | |
public void assertAccess(boolean write) |
721 | |
{ |
722 | 0 | if (message instanceof ThreadSafeAccess) |
723 | |
{ |
724 | 0 | ((ThreadSafeAccess) message).assertAccess(write); |
725 | |
} |
726 | 0 | } |
727 | |
|
728 | |
@Deprecated |
729 | |
public Object transformMessage() throws TransformerException |
730 | |
{ |
731 | 0 | logger.warn("Deprecation warning: MuleEvent.transformMessage does nothing in Mule 3.x. The message is already transformed before the event reaches a component"); |
732 | 0 | return message.getPayload(); |
733 | |
} |
734 | |
|
735 | |
public ProcessingTime getProcessingTime() |
736 | |
{ |
737 | 0 | return processingTime; |
738 | |
} |
739 | |
|
740 | |
} |