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