1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.ssl;
12
13 import org.mule.tck.functional.EventCallback;
14 import org.mule.api.MuleEventContext;
15
16 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference;
17 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
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
33
34 certificates.set(context.getMessage().getProperty(SslConnector.LOCAL_CERTIFICATES));
35 called.set(true);
36 }
37
38 public void clear()
39 {
40 certificates = new AtomicReference();
41 called = new AtomicBoolean(false);
42 }
43
44 public boolean isCalled()
45 {
46 return called.get();
47 }
48
49 public Object getCertificates()
50 {
51 return certificates.get();
52 }
53
54 }