1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.impl; |
12 | |
|
13 | |
import org.mule.MuleException; |
14 | |
import org.mule.MuleManager; |
15 | |
import org.mule.config.MuleProperties; |
16 | |
import org.mule.config.i18n.CoreMessages; |
17 | |
import org.mule.impl.endpoint.MuleEndpoint; |
18 | |
import org.mule.impl.security.MuleCredentials; |
19 | |
import org.mule.umo.UMOComponent; |
20 | |
import org.mule.umo.UMOEvent; |
21 | |
import org.mule.umo.UMOException; |
22 | |
import org.mule.umo.UMOMessage; |
23 | |
import org.mule.umo.UMOSession; |
24 | |
import org.mule.umo.endpoint.UMOEndpoint; |
25 | |
import org.mule.umo.endpoint.UMOImmutableEndpoint; |
26 | |
import org.mule.umo.security.UMOCredentials; |
27 | |
import org.mule.umo.transformer.TransformerException; |
28 | |
import org.mule.umo.transformer.UMOTransformer; |
29 | |
import org.mule.util.UUID; |
30 | |
|
31 | |
import java.io.IOException; |
32 | |
import java.io.ObjectInputStream; |
33 | |
import java.io.ObjectOutputStream; |
34 | |
import java.io.OptionalDataException; |
35 | |
import java.io.OutputStream; |
36 | |
import java.io.Serializable; |
37 | |
import java.io.UnsupportedEncodingException; |
38 | |
import java.util.EventObject; |
39 | |
import java.util.Iterator; |
40 | |
|
41 | |
import org.apache.commons.beanutils.PropertyUtils; |
42 | |
import org.apache.commons.collections.MapUtils; |
43 | |
import org.apache.commons.lang.SerializationUtils; |
44 | |
import org.apache.commons.logging.Log; |
45 | |
import org.apache.commons.logging.LogFactory; |
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
public class MuleEvent extends EventObject implements UMOEvent, ThreadSafeAccess |
57 | |
{ |
58 | |
|
59 | |
|
60 | |
|
61 | |
private static final long serialVersionUID = 1L; |
62 | |
|
63 | |
|
64 | |
|
65 | 0 | protected transient Log logger = LogFactory.getLog(getClass()); |
66 | |
|
67 | |
|
68 | |
|
69 | 0 | private transient UMOImmutableEndpoint endpoint = null; |
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | 0 | private String id = null; |
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | 0 | private UMOMessage message = null; |
80 | |
|
81 | |
private transient UMOSession session; |
82 | |
|
83 | 0 | private boolean stopFurtherProcessing = false; |
84 | |
|
85 | 0 | private boolean synchronous = false; |
86 | |
|
87 | 0 | private int timeout = TIMEOUT_NOT_SET_VALUE; |
88 | |
|
89 | 0 | private transient ResponseOutputStream outputStream = null; |
90 | |
|
91 | 0 | private transient Object transformedMessage = null; |
92 | |
|
93 | 0 | private UMOCredentials credentials = null; |
94 | |
|
95 | 0 | protected String[] ignoredPropertyOverrides = new String[]{MuleProperties.MULE_METHOD_PROPERTY}; |
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
public MuleEvent(UMOMessage message, |
103 | |
UMOImmutableEndpoint endpoint, |
104 | |
UMOComponent component, |
105 | |
UMOEvent previousEvent) |
106 | |
{ |
107 | 0 | super(message.getPayload()); |
108 | 0 | this.message = message; |
109 | 0 | this.id = generateEventId(); |
110 | 0 | this.session = previousEvent.getSession(); |
111 | 0 | ((MuleSession) session).setComponent(component); |
112 | 0 | this.endpoint = endpoint; |
113 | 0 | this.synchronous = previousEvent.isSynchronous(); |
114 | 0 | this.timeout = previousEvent.getTimeout(); |
115 | 0 | this.outputStream = (ResponseOutputStream) previousEvent.getOutputStream(); |
116 | 0 | fillProperties(previousEvent); |
117 | 0 | } |
118 | |
|
119 | |
public MuleEvent(UMOMessage message, |
120 | |
UMOImmutableEndpoint endpoint, |
121 | |
UMOSession session, |
122 | |
boolean synchronous) |
123 | |
{ |
124 | 0 | this(message, endpoint, session, synchronous, null); |
125 | 0 | } |
126 | |
|
127 | |
|
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
|
135 | |
public MuleEvent(UMOMessage message, |
136 | |
UMOImmutableEndpoint endpoint, |
137 | |
UMOSession session, |
138 | |
boolean synchronous, |
139 | |
ResponseOutputStream outputStream) |
140 | |
{ |
141 | 0 | super(message.getPayload()); |
142 | 0 | this.message = message; |
143 | 0 | this.endpoint = endpoint; |
144 | 0 | this.session = session; |
145 | 0 | this.id = generateEventId(); |
146 | 0 | this.synchronous = synchronous; |
147 | 0 | this.outputStream = outputStream; |
148 | 0 | fillProperties(null); |
149 | 0 | } |
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
|
155 | |
|
156 | |
|
157 | |
|
158 | |
|
159 | |
public MuleEvent(UMOMessage message, |
160 | |
UMOImmutableEndpoint endpoint, |
161 | |
UMOSession session, |
162 | |
String eventId, |
163 | |
boolean synchronous) |
164 | |
{ |
165 | 0 | super(message.getPayload()); |
166 | 0 | this.message = message; |
167 | 0 | this.endpoint = endpoint; |
168 | 0 | this.session = session; |
169 | 0 | this.id = eventId; |
170 | 0 | this.synchronous = synchronous; |
171 | 0 | fillProperties(null); |
172 | 0 | } |
173 | |
|
174 | |
|
175 | |
|
176 | |
|
177 | |
|
178 | |
|
179 | |
|
180 | |
public MuleEvent(UMOMessage message, UMOEvent rewriteEvent) |
181 | |
{ |
182 | 0 | super(message.getPayload()); |
183 | 0 | this.message = message; |
184 | 0 | this.id = rewriteEvent.getId(); |
185 | 0 | this.session = rewriteEvent.getSession(); |
186 | 0 | ((MuleSession) session).setComponent(rewriteEvent.getComponent()); |
187 | 0 | this.endpoint = rewriteEvent.getEndpoint(); |
188 | 0 | this.synchronous = rewriteEvent.isSynchronous(); |
189 | 0 | this.timeout = rewriteEvent.getTimeout(); |
190 | 0 | this.outputStream = (ResponseOutputStream) rewriteEvent.getOutputStream(); |
191 | 0 | if (rewriteEvent instanceof MuleEvent) |
192 | |
{ |
193 | 0 | this.transformedMessage = ((MuleEvent) rewriteEvent).getCachedMessage(); |
194 | |
} |
195 | 0 | fillProperties(rewriteEvent); |
196 | 0 | } |
197 | |
|
198 | |
protected void fillProperties(UMOEvent previousEvent) |
199 | |
{ |
200 | 0 | if (previousEvent != null) |
201 | |
{ |
202 | 0 | UMOMessage msg = previousEvent.getMessage(); |
203 | 0 | synchronized (msg) |
204 | |
{ |
205 | 0 | for (Iterator iterator = msg.getPropertyNames().iterator(); iterator.hasNext();) |
206 | |
{ |
207 | 0 | String prop = (String) iterator.next(); |
208 | 0 | Object value = msg.getProperty(prop); |
209 | |
|
210 | 0 | if (!ignoreProperty(prop)) |
211 | |
{ |
212 | 0 | message.setProperty(prop, value); |
213 | |
} |
214 | |
|
215 | 0 | if (logger.isDebugEnabled()) |
216 | |
{ |
217 | 0 | Object currentValue = message.getProperty(prop); |
218 | 0 | if (!value.equals(currentValue)) |
219 | |
{ |
220 | 0 | logger.warn("Property on the current message " + prop + "=" + currentValue |
221 | |
+ " overrides property on the previous event: " + prop + "=" + value); |
222 | |
} |
223 | |
} |
224 | |
} |
225 | 0 | } |
226 | |
} |
227 | |
|
228 | 0 | if (endpoint != null && endpoint.getProperties() != null) |
229 | |
{ |
230 | 0 | for (Iterator iterator = endpoint.getProperties().keySet().iterator(); iterator.hasNext();) |
231 | |
{ |
232 | 0 | String prop = (String) iterator.next(); |
233 | 0 | Object value = endpoint.getProperties().get(prop); |
234 | |
|
235 | 0 | if (!ignoreProperty(prop)) |
236 | |
{ |
237 | 0 | message.setProperty(prop, value); |
238 | |
} |
239 | |
|
240 | 0 | if (logger.isDebugEnabled()) |
241 | |
{ |
242 | 0 | Object currentValue = message.getProperty(prop); |
243 | 0 | if (!value.equals(currentValue)) |
244 | |
{ |
245 | 0 | logger.warn("Property on the current message " + prop + "=" + currentValue |
246 | |
+ " overrides property on the endpoint: " + prop + "=" + value); |
247 | |
} |
248 | |
} |
249 | |
} |
250 | |
} |
251 | |
|
252 | 0 | setCredentials(); |
253 | 0 | } |
254 | |
|
255 | |
|
256 | |
|
257 | |
|
258 | |
|
259 | |
|
260 | |
|
261 | |
|
262 | |
|
263 | |
|
264 | |
|
265 | |
|
266 | |
protected boolean ignoreProperty(String key) |
267 | |
{ |
268 | 0 | if (key == null) |
269 | |
{ |
270 | 0 | return true; |
271 | |
} |
272 | |
|
273 | 0 | for (int i = 0; i < ignoredPropertyOverrides.length; i++) |
274 | |
{ |
275 | 0 | if (key.equals(ignoredPropertyOverrides[i])) |
276 | |
{ |
277 | 0 | return false; |
278 | |
} |
279 | |
} |
280 | 0 | Object value = message.getProperty(key); |
281 | |
|
282 | 0 | if (value != null) |
283 | |
{ |
284 | 0 | return true; |
285 | |
} |
286 | |
|
287 | 0 | return false; |
288 | |
} |
289 | |
|
290 | |
protected void setCredentials() |
291 | |
{ |
292 | 0 | if (null != endpoint && null != endpoint.getEndpointURI() && null != endpoint.getEndpointURI().getUserInfo()) |
293 | |
{ |
294 | 0 | final String userName = endpoint.getEndpointURI().getUsername(); |
295 | 0 | final String password = endpoint.getEndpointURI().getPassword(); |
296 | 0 | if (password != null && userName != null) |
297 | |
{ |
298 | 0 | credentials = new MuleCredentials(userName, password.toCharArray()); |
299 | |
} |
300 | |
} |
301 | 0 | } |
302 | |
|
303 | |
public UMOCredentials getCredentials() |
304 | |
{ |
305 | 0 | return credentials; |
306 | |
} |
307 | |
|
308 | |
Object getCachedMessage() |
309 | |
{ |
310 | 0 | return transformedMessage; |
311 | |
} |
312 | |
|
313 | |
public UMOMessage getMessage() |
314 | |
{ |
315 | 0 | return message; |
316 | |
} |
317 | |
|
318 | |
public byte[] getMessageAsBytes() throws MuleException |
319 | |
{ |
320 | |
try |
321 | |
{ |
322 | 0 | return message.getPayloadAsBytes(); |
323 | |
} |
324 | 0 | catch (Exception e) |
325 | |
{ |
326 | 0 | throw new MuleException( |
327 | |
CoreMessages.cannotReadPayloadAsBytes(message.getPayload().getClass().getName()), e); |
328 | |
} |
329 | |
} |
330 | |
|
331 | |
public Object getTransformedMessage() throws TransformerException |
332 | |
{ |
333 | 0 | if (isStreaming()) |
334 | |
{ |
335 | 0 | return message.getAdapter(); |
336 | |
} |
337 | 0 | if (transformedMessage == null) |
338 | |
{ |
339 | 0 | UMOTransformer tran = endpoint.getTransformer(); |
340 | 0 | if (tran != null) |
341 | |
{ |
342 | 0 | transformedMessage = tran.transform(message.getPayload()); |
343 | |
} |
344 | |
else |
345 | |
{ |
346 | 0 | transformedMessage = message.getPayload(); |
347 | |
} |
348 | |
} |
349 | 0 | return transformedMessage; |
350 | |
} |
351 | |
|
352 | |
|
353 | |
|
354 | |
|
355 | |
|
356 | |
|
357 | |
|
358 | |
|
359 | |
|
360 | |
|
361 | |
|
362 | |
|
363 | |
public byte[] getTransformedMessageAsBytes() throws TransformerException |
364 | |
{ |
365 | 0 | Object msg = getTransformedMessage(); |
366 | 0 | if (msg instanceof byte[]) |
367 | |
{ |
368 | 0 | return (byte[]) msg; |
369 | |
} |
370 | 0 | else if (msg instanceof String) |
371 | |
{ |
372 | |
try |
373 | |
{ |
374 | 0 | return msg.toString().getBytes(getEncoding()); |
375 | |
} |
376 | 0 | catch (UnsupportedEncodingException e) |
377 | |
{ |
378 | 0 | throw new TransformerException( |
379 | |
CoreMessages.transformFailedFrom(msg.getClass()), e); |
380 | |
} |
381 | |
} |
382 | 0 | else if (msg instanceof Serializable) |
383 | |
{ |
384 | |
try |
385 | |
{ |
386 | 0 | return SerializationUtils.serialize((Serializable) msg); |
387 | |
} |
388 | 0 | catch (Exception e) |
389 | |
{ |
390 | 0 | throw new TransformerException( |
391 | |
CoreMessages.transformFailed(msg.getClass().getName(), "byte[]"), e); |
392 | |
} |
393 | |
} |
394 | |
else |
395 | |
{ |
396 | 0 | throw new TransformerException( |
397 | |
CoreMessages.transformOnObjectNotOfSpecifiedType(msg.getClass().getName(), |
398 | 0 | "byte[] or " + Serializable.class.getName())); |
399 | |
} |
400 | |
} |
401 | |
|
402 | |
|
403 | |
|
404 | |
|
405 | |
|
406 | |
|
407 | |
|
408 | |
|
409 | |
|
410 | |
|
411 | |
|
412 | |
|
413 | |
public String getTransformedMessageAsString() throws TransformerException |
414 | |
{ |
415 | 0 | return getTransformedMessageAsString(getEncoding()); |
416 | |
} |
417 | |
|
418 | |
public String getMessageAsString() throws UMOException |
419 | |
{ |
420 | 0 | return getMessageAsString(getEncoding()); |
421 | |
} |
422 | |
|
423 | |
|
424 | |
|
425 | |
|
426 | |
|
427 | |
|
428 | |
|
429 | |
|
430 | |
|
431 | |
|
432 | |
|
433 | |
|
434 | |
|
435 | |
public String getTransformedMessageAsString(String encoding) throws TransformerException |
436 | |
{ |
437 | |
try |
438 | |
{ |
439 | 0 | return new String(getTransformedMessageAsBytes(), encoding); |
440 | |
} |
441 | 0 | catch (UnsupportedEncodingException e) |
442 | |
{ |
443 | 0 | throw new TransformerException(endpoint.getTransformer(), e); |
444 | |
} |
445 | |
} |
446 | |
|
447 | |
|
448 | |
|
449 | |
|
450 | |
|
451 | |
|
452 | |
|
453 | |
|
454 | |
|
455 | |
public String getMessageAsString(String encoding) throws UMOException |
456 | |
{ |
457 | |
try |
458 | |
{ |
459 | 0 | return message.getPayloadAsString(encoding); |
460 | |
} |
461 | 0 | catch (Exception e) |
462 | |
{ |
463 | 0 | throw new MuleException( |
464 | |
CoreMessages.cannotReadPayloadAsString(message.getClass().getName()), e); |
465 | |
} |
466 | |
} |
467 | |
|
468 | |
|
469 | |
|
470 | |
|
471 | |
|
472 | |
|
473 | |
public String getId() |
474 | |
{ |
475 | 0 | return id; |
476 | |
} |
477 | |
|
478 | |
|
479 | |
|
480 | |
|
481 | |
public Object getProperty(String name, boolean exhaustiveSearch) |
482 | |
{ |
483 | 0 | return getProperty(name, null, exhaustiveSearch); |
484 | |
} |
485 | |
|
486 | |
|
487 | |
|
488 | |
|
489 | |
|
490 | |
|
491 | |
|
492 | |
public Object getProperty(String name, Object defaultValue, boolean exhaustiveSearch) |
493 | |
{ |
494 | 0 | Object property = message.getProperty(name); |
495 | |
|
496 | 0 | if (exhaustiveSearch) |
497 | |
{ |
498 | |
|
499 | 0 | if (property == null) |
500 | |
{ |
501 | 0 | property = MapUtils.getObject(getEndpoint().getEndpointURI().getParams(), name, null); |
502 | |
} |
503 | |
|
504 | |
|
505 | 0 | if (property == null) |
506 | |
{ |
507 | |
try |
508 | |
{ |
509 | 0 | property = PropertyUtils.getProperty(getEndpoint().getConnector(), name); |
510 | |
} |
511 | 0 | catch (Exception e) |
512 | |
{ |
513 | |
|
514 | |
|
515 | 0 | } |
516 | |
} |
517 | |
} |
518 | 0 | return (property == null ? defaultValue : property); |
519 | |
} |
520 | |
|
521 | |
|
522 | |
|
523 | |
|
524 | |
|
525 | |
|
526 | |
public UMOImmutableEndpoint getEndpoint() |
527 | |
{ |
528 | 0 | return endpoint; |
529 | |
} |
530 | |
|
531 | |
|
532 | |
|
533 | |
|
534 | |
|
535 | |
|
536 | |
public String toString() |
537 | |
{ |
538 | 0 | StringBuffer buf = new StringBuffer(64); |
539 | 0 | buf.append("Event: ").append(getId()); |
540 | 0 | buf.append(", sync=").append(isSynchronous()); |
541 | 0 | buf.append(", stop processing=").append(isStopFurtherProcessing()); |
542 | 0 | buf.append(", ").append(endpoint); |
543 | |
|
544 | 0 | return buf.toString(); |
545 | |
} |
546 | |
|
547 | |
protected String generateEventId() |
548 | |
{ |
549 | 0 | return UUID.getUUID(); |
550 | |
} |
551 | |
|
552 | |
public UMOSession getSession() |
553 | |
{ |
554 | 0 | return session; |
555 | |
} |
556 | |
|
557 | |
void setSession(UMOSession session) |
558 | |
{ |
559 | 0 | this.session = session; |
560 | 0 | } |
561 | |
|
562 | |
|
563 | |
|
564 | |
|
565 | |
public UMOComponent getComponent() |
566 | |
{ |
567 | 0 | return session.getComponent(); |
568 | |
} |
569 | |
|
570 | |
|
571 | |
|
572 | |
|
573 | |
|
574 | |
|
575 | |
public boolean isStopFurtherProcessing() |
576 | |
{ |
577 | 0 | return stopFurtherProcessing; |
578 | |
} |
579 | |
|
580 | |
|
581 | |
|
582 | |
|
583 | |
|
584 | |
|
585 | |
|
586 | |
|
587 | |
|
588 | |
|
589 | |
|
590 | |
|
591 | |
public void setStopFurtherProcessing(boolean stopFurtherProcessing) |
592 | |
{ |
593 | 0 | this.stopFurtherProcessing = stopFurtherProcessing; |
594 | 0 | } |
595 | |
|
596 | |
public boolean equals(Object o) |
597 | |
{ |
598 | 0 | if (this == o) |
599 | |
{ |
600 | 0 | return true; |
601 | |
} |
602 | 0 | if (!(o instanceof MuleEvent)) |
603 | |
{ |
604 | 0 | return false; |
605 | |
} |
606 | |
|
607 | 0 | final MuleEvent event = (MuleEvent)o; |
608 | |
|
609 | 0 | if (message != null ? !message.equals(event.message) : event.message != null) |
610 | |
{ |
611 | 0 | return false; |
612 | |
} |
613 | 0 | return id.equals(event.id); |
614 | |
} |
615 | |
|
616 | |
public int hashCode() |
617 | |
{ |
618 | 0 | return 29 * id.hashCode() + (message != null ? message.hashCode() : 0); |
619 | |
} |
620 | |
|
621 | |
public boolean isSynchronous() |
622 | |
{ |
623 | 0 | return synchronous; |
624 | |
} |
625 | |
|
626 | |
public void setSynchronous(boolean value) |
627 | |
{ |
628 | 0 | synchronous = value; |
629 | 0 | } |
630 | |
|
631 | |
public int getTimeout() |
632 | |
{ |
633 | 0 | if (timeout == TIMEOUT_NOT_SET_VALUE) |
634 | |
{ |
635 | |
|
636 | 0 | timeout = endpoint.getRemoteSyncTimeout(); |
637 | |
} |
638 | 0 | return timeout; |
639 | |
} |
640 | |
|
641 | |
public void setTimeout(int timeout) |
642 | |
{ |
643 | 0 | this.timeout = timeout; |
644 | 0 | } |
645 | |
|
646 | |
|
647 | |
|
648 | |
|
649 | |
|
650 | |
|
651 | |
|
652 | |
|
653 | |
public OutputStream getOutputStream() |
654 | |
{ |
655 | 0 | return outputStream; |
656 | |
} |
657 | |
|
658 | |
private void marshallTransformers(UMOTransformer trans, ObjectOutputStream out) throws IOException |
659 | |
{ |
660 | 0 | if (trans != null) |
661 | |
{ |
662 | 0 | out.writeObject(trans.getName()); |
663 | 0 | marshallTransformers(trans.getNextTransformer(), out); |
664 | |
} |
665 | 0 | } |
666 | |
|
667 | |
private UMOTransformer unmarshallTransformers(ObjectInputStream in) throws IOException, ClassNotFoundException |
668 | |
{ |
669 | 0 | UMOTransformer trans = null; |
670 | |
try { |
671 | 0 | String transformerName = (String) in.readObject(); |
672 | 0 | trans = MuleManager.getInstance().lookupTransformer(transformerName); |
673 | 0 | trans.setNextTransformer(unmarshallTransformers(in)); |
674 | 0 | } catch (OptionalDataException e) { |
675 | 0 | if (logger.isDebugEnabled()) |
676 | |
{ |
677 | 0 | logger.debug("Failed to load transformers from stream", e); |
678 | |
} |
679 | 0 | } |
680 | 0 | return trans; |
681 | |
} |
682 | |
|
683 | |
private void writeObject(ObjectOutputStream out) throws IOException |
684 | |
{ |
685 | 0 | out.defaultWriteObject(); |
686 | 0 | out.writeObject(endpoint.getEndpointURI().toString()); |
687 | 0 | marshallTransformers(endpoint.getTransformer(), out); |
688 | 0 | } |
689 | |
|
690 | |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException |
691 | |
{ |
692 | 0 | logger = LogFactory.getLog(getClass()); |
693 | 0 | in.defaultReadObject(); |
694 | 0 | String uri = (String) in.readObject(); |
695 | 0 | UMOTransformer trans = unmarshallTransformers(in); |
696 | |
try |
697 | |
{ |
698 | 0 | endpoint = MuleEndpoint.getOrCreateEndpointForUri(uri, UMOEndpoint.ENDPOINT_TYPE_SENDER); |
699 | |
|
700 | 0 | if (endpoint.getTransformer() == null) |
701 | |
{ |
702 | 0 | ((UMOEndpoint) endpoint).setTransformer(trans); |
703 | |
} |
704 | |
} |
705 | 0 | catch (UMOException e) |
706 | |
{ |
707 | 0 | throw (IOException) new IOException(e.getMessage()).initCause(e); |
708 | 0 | } |
709 | 0 | } |
710 | |
|
711 | |
|
712 | |
|
713 | |
|
714 | |
|
715 | |
|
716 | |
public boolean isStreaming() |
717 | |
{ |
718 | 0 | return endpoint.isStreaming(); |
719 | |
} |
720 | |
|
721 | |
|
722 | |
|
723 | |
|
724 | |
|
725 | |
|
726 | |
|
727 | |
|
728 | |
|
729 | |
public String getEncoding() |
730 | |
{ |
731 | 0 | String encoding = endpoint.getEncoding(); |
732 | 0 | if (encoding == null) |
733 | |
{ |
734 | 0 | encoding = message.getEncoding(); |
735 | |
} |
736 | 0 | if (encoding == null) |
737 | |
{ |
738 | 0 | encoding = MuleManager.getConfiguration().getEncoding(); |
739 | |
} |
740 | 0 | return encoding; |
741 | |
} |
742 | |
|
743 | |
public ThreadSafeAccess newThreadCopy() |
744 | |
{ |
745 | 0 | if (message instanceof ThreadSafeAccess) |
746 | |
{ |
747 | 0 | MuleEvent copy = new MuleEvent((UMOMessage) ((ThreadSafeAccess) message).newThreadCopy(), this); |
748 | 0 | copy.resetAccessControl(); |
749 | 0 | return copy; |
750 | |
} |
751 | |
else |
752 | |
{ |
753 | 0 | return this; |
754 | |
} |
755 | |
} |
756 | |
|
757 | |
public void resetAccessControl() |
758 | |
{ |
759 | 0 | if (message instanceof ThreadSafeAccess) |
760 | |
{ |
761 | 0 | ((ThreadSafeAccess) message).resetAccessControl(); |
762 | |
} |
763 | 0 | } |
764 | |
|
765 | |
public void assertAccess(boolean write) |
766 | |
{ |
767 | 0 | if (message instanceof ThreadSafeAccess) |
768 | |
{ |
769 | 0 | ((ThreadSafeAccess) message).assertAccess(write); |
770 | |
} |
771 | 0 | } |
772 | |
|
773 | |
} |