/** * called from SFSBPreCreateInterceptor, before bean creation */ public static void beginSfsbCreation() { SFSBCallStackThreadData data = CURRENT.get(); int no = data.creationBeanNestingLevel; if (no == 0) { data.creationTimeXPCRegistration = new HashMap<String, ExtendedEntityManager>(); // create new tracking structure (passing in parent levels tracking structure or null if toplevel) data.creationTimeInjectedXPCs = new SFSBInjectedXPCs(data.creationTimeInjectedXPCs, null); } else { // create new tracking structure (passing in parent levels tracking structure or null if toplevel) SFSBInjectedXPCs parent = data.creationTimeInjectedXPCs; data.creationTimeInjectedXPCs = new SFSBInjectedXPCs(parent, parent.getTopLevel()); } data.creationBeanNestingLevel++; }
/** * called from SFSBPreCreateInterceptor, after bean creation */ public static void endSfsbCreation() { SFSBCallStackThreadData data = CURRENT.get(); int no = data.creationBeanNestingLevel; no--; data.creationBeanNestingLevel = no; if (no == 0) { // Completed creating top level bean, remove 'xpc creation tracking' thread local data.creationTimeXPCRegistration = null; data.creationTimeInjectedXPCs = null; } else { // finished creating a sub-bean, switch to parent level 'xpc creation tracking' data.creationTimeInjectedXPCs = data.creationTimeInjectedXPCs.getParent(); } }
@Override public void registerExtendedPersistenceContext(String scopedPuName, ExtendedEntityManager entityManager) { if (SFSBCallStack.getSFSBCreationBeanNestingLevel() > 0) { SFSBCallStack.getSFSBCreationTimeInjectedXPCs(scopedPuName).registerDeepInheritance(scopedPuName, entityManager); } }
@Override public void registerExtendedPersistenceContext(String scopedPuName, ExtendedEntityManager entityManager) { if (SFSBCallStack.getSFSBCreationBeanNestingLevel() > 0) { SFSBCallStack.getSFSBCreationTimeInjectedXPCs(scopedPuName).registerShallowInheritance(scopedPuName, entityManager); } }
@Override public ExtendedEntityManager findExtendedPersistenceContext(String puScopedName) { ExtendedEntityManager result; SFSBInjectedXPCs currentInjectedXPCs = SFSBCallStack.getSFSBCreationTimeInjectedXPCs(puScopedName); // will look directly at the top level bean being created (registerExtendedPersistenceContext() registers xpc there). result = currentInjectedXPCs.findExtendedPersistenceContextDeepInheritance(puScopedName); if (result == null) { // walk up the BEAN call stack (this also covers the case of a bean method JNDI searching for another bean) for (Map<String, ExtendedEntityManager> handle : SFSBCallStack.currentSFSBCallStack()) { result = handle.get(puScopedName); if(result != null) { return result; } } } return result; } }
@Override public ExtendedEntityManager findExtendedPersistenceContext(String puScopedName) { ExtendedEntityManager result = null; // if current bean is injected from a parent bean that is also being created, current bean // can inherit only from the parent bean. if (SFSBCallStack.getSFSBCreationBeanNestingLevel() > 1) { SFSBInjectedXPCs currentInjectedXPCs = SFSBCallStack.getSFSBCreationTimeInjectedXPCs(puScopedName); result = currentInjectedXPCs.findExtendedPersistenceContextShallowInheritance(puScopedName); } else { // else inherit from parent bean that created current bean (if any). The parent bean is the one // that did a JNDI lookup of the current bean. Map<String, ExtendedEntityManager> handle = SFSBCallStack.getCurrentCall(); if (handle != null) { result = handle.get(puScopedName); if (result != null) { return result; } } } return result; } }
@Override public void registerExtendedPersistenceContext(String scopedPuName, ExtendedEntityManager entityManager) { if (SFSBCallStack.getSFSBCreationBeanNestingLevel() > 0) { SFSBCallStack.getSFSBCreationTimeInjectedXPCs(scopedPuName).registerDeepInheritance(scopedPuName, entityManager); } }
@Override public void registerExtendedPersistenceContext(String scopedPuName, ExtendedEntityManager entityManager) { if (SFSBCallStack.getSFSBCreationBeanNestingLevel() > 0) { SFSBCallStack.getSFSBCreationTimeInjectedXPCs(scopedPuName).registerShallowInheritance(scopedPuName, entityManager); } }
@Override public ExtendedEntityManager findExtendedPersistenceContext(String puScopedName) { ExtendedEntityManager result; SFSBInjectedXPCs currentInjectedXPCs = SFSBCallStack.getSFSBCreationTimeInjectedXPCs(puScopedName); // will look directly at the top level bean being created (registerExtendedPersistenceContext() registers xpc there). result = currentInjectedXPCs.findExtendedPersistenceContextDeepInheritance(puScopedName); if (result == null) { // walk up the BEAN call stack (this also covers the case of a bean method JNDI searching for another bean) for (Map<String, ExtendedEntityManager> handle : SFSBCallStack.currentSFSBCallStack()) { result = handle.get(puScopedName); if(result != null) { return result; } } } return result; } }
@Override public ExtendedEntityManager findExtendedPersistenceContext(String puScopedName) { ExtendedEntityManager result = null; // if current bean is injected from a parent bean that is also being created, current bean // can inherit only from the parent bean. if (SFSBCallStack.getSFSBCreationBeanNestingLevel() > 1) { SFSBInjectedXPCs currentInjectedXPCs = SFSBCallStack.getSFSBCreationTimeInjectedXPCs(puScopedName); result = currentInjectedXPCs.findExtendedPersistenceContextShallowInheritance(puScopedName); } else { // else inherit from parent bean that created current bean (if any). The parent bean is the one // that did a JNDI lookup of the current bean. Map<String, ExtendedEntityManager> handle = SFSBCallStack.getCurrentCall(); if (handle != null) { result = handle.get(puScopedName); if (result != null) { return result; } } } return result; } }
/** * called from SFSBPreCreateInterceptor, before bean creation */ public static void beginSfsbCreation() { SFSBCallStackThreadData data = CURRENT.get(); int no = data.creationBeanNestingLevel; if (no == 0) { data.creationTimeXPCRegistration = new HashMap<String, ExtendedEntityManager>(); // create new tracking structure (passing in parent levels tracking structure or null if toplevel) data.creationTimeInjectedXPCs = new SFSBInjectedXPCs(data.creationTimeInjectedXPCs, null); } else { // create new tracking structure (passing in parent levels tracking structure or null if toplevel) SFSBInjectedXPCs parent = data.creationTimeInjectedXPCs; data.creationTimeInjectedXPCs = new SFSBInjectedXPCs(parent, parent.getTopLevel()); } data.creationBeanNestingLevel++; }
/** * called from SFSBPreCreateInterceptor, after bean creation */ public static void endSfsbCreation() { SFSBCallStackThreadData data = CURRENT.get(); int no = data.creationBeanNestingLevel; no--; data.creationBeanNestingLevel = no; if (no == 0) { // Completed creating top level bean, remove 'xpc creation tracking' thread local data.creationTimeXPCRegistration = null; data.creationTimeInjectedXPCs = null; } else { // finished creating a sub-bean, switch to parent level 'xpc creation tracking' data.creationTimeInjectedXPCs = data.creationTimeInjectedXPCs.getParent(); } }