1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.platform.camel.core.support.processor;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import org.apache.camel.Exchange;
22 import org.apache.camel.Processor;
23
24
25
26
27 public class ExceptionProcessor implements Processor {
28
29 private Map<String, Exception> exceptions;
30
31 public ExceptionProcessor() {
32 this.exceptions = new HashMap<>();
33 }
34
35 public Map<String, Exception> getExceptions() {
36 return exceptions;
37 }
38
39 public void process(Exchange exchange) throws Exception {
40 Exception e = exceptions.get(exchange.getIn().getBody());
41 if (e != null) {
42 throw e;
43 }
44 }
45
46 }