1 25 package org.objectweb.easybeans.tests.common.ejbs.base.lifecallback; 26 27 import javax.annotation.PostConstruct; 28 import javax.annotation.Resource; 29 import javax.ejb.SessionContext ; 30 31 import org.objectweb.easybeans.log.JLog; 32 import org.objectweb.easybeans.log.JLogFactory; 33 import org.objectweb.easybeans.tests.common.ejbs.base.ItfCheckPostConstruct; 34 35 36 42 public class EBaseInternalCallbackOrder00 implements ItfCheckPostConstruct{ 43 44 47 private JLog logger = JLogFactory.getLog(EBaseInternalCallbackOrder00.class); 48 49 52 private boolean okPostConstruct; 53 54 57 private boolean okAllPostConstruct; 58 59 62 @Resource 63 private SessionContext ctx; 64 65 68 @SuppressWarnings ("unused") 69 @PostConstruct 70 private void postConstruct00(){ 71 logger.debug("PostConstruct Method."); 72 if (ctx == null){ 73 throw new IllegalStateException ("PostConstruct callback must be invoked after the dependency injection."); 74 } 75 okPostConstruct = true; 76 } 77 78 81 public void check(){ 82 if (!okAllPostConstruct){ 83 throw new IllegalStateException ("Some PostConstruct was not invoked."); 84 } 85 86 } 87 88 92 protected boolean isOKPostConstruct(){ 93 return okPostConstruct; 94 } 95 96 100 public void setStatus(final boolean b) { 101 okAllPostConstruct = b; 102 } 103 104 } 105 | Popular Tags |