1 package org.myorg.encconfig.ejb;
2
3 import javax.annotation.PostConstruct;
4 import javax.annotation.Resource;
5 import javax.ejb.Stateless;
6 import javax.jms.ConnectionFactory;
7 import javax.jms.Topic;
8 import javax.persistence.EntityManager;
9 import javax.persistence.PersistenceContext;
10
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
13
14 @Stateless
15 public class ENCAuditorEJB extends AuditorBase
16 implements AuditorRemote {
17 private static final Logger log = LoggerFactory.getLogger(ENCAuditorEJB.class);
18
19
20 private Boolean publishJMS;
21
22
23
24 private EntityManager em;
25
26
27
28 private Topic topic;
29
30
31
32 private ConnectionFactory cf;
33
34
35
36 public void init() {
37 super.setLog(log);
38 super.setConnectionFactory(cf);
39 super.setEntityManager(em);
40 super.setTopic(topic);
41 super.setPublishJMS(isPublishJMS());
42 }
43
44 @Override
45 public boolean isPublishJMS() {
46 return publishJMS!=null && publishJMS;
47 }
48 @Override
49 public boolean havePersistenceContext() {
50 return em!=null;
51 }
52 @Override
53 public boolean haveTopic() {
54 return topic!=null;
55 }
56 @Override
57 public boolean haveConnectionFactory() {
58 return cf!=null;
59 }
60
61 @Override
62 public int audit(String message) {
63 return super.audit(message);
64 }
65 }