1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.ssl;
12
13 import org.mule.api.MuleEventContext;
14 import org.mule.tck.functional.EventCallback;
15
16 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
17 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference;
18
19 public class SaveCertificateCallback implements EventCallback
20 {
21
22 private AtomicReference certificates;
23 private AtomicBoolean called;
24
25 public SaveCertificateCallback()
26 {
27 clear();
28 }
29
30 public void eventReceived(MuleEventContext context, Object component) throws Exception
31 {
32 certificates.set(context.getMessage().getOutboundProperty(SslConnector.LOCAL_CERTIFICATES));
33 called.set(true);
34 }
35
36 public void clear()
37 {
38 certificates = new AtomicReference();
39 called = new AtomicBoolean(false);
40 }
41
42 public boolean isCalled()
43 {
44 return called.get();
45 }
46
47 public Object getCertificates()
48 {
49 return certificates.get();
50 }
51
52 }