public static final InterceptorFactory FACTORY = new ImmediateInterceptorFactory(new SFSBCreateInterceptor());
@Override
public Object processInvocation(InterceptorContext interceptorContext) throws Exception {
ComponentInstance componentInstance = interceptorContext.getPrivateData(ComponentInstance.class);
Map<String, ExtendedEntityManager> entityManagers = null;
if(componentInstance.getInstanceData(SFSBInvocationInterceptor.CONTEXT_KEY) == null) {
// Get all of the extended persistence contexts in use by the bean (some of which may of been inherited from
// other beans).
entityManagers = new HashMap<String, ExtendedEntityManager>();
componentInstance.setInstanceData(SFSBInvocationInterceptor.CONTEXT_KEY, new ImmediateManagedReference(entityManagers));
} else {
ManagedReference entityManagerRef = (ManagedReference) componentInstance.getInstanceData(SFSBInvocationInterceptor.CONTEXT_KEY);
entityManagers = (Map<String, ExtendedEntityManager>)entityManagerRef.getInstance();
}
final List<ExtendedEntityManager> ems = CreatedEntityManagers.getDeferredEntityManagers();
for (ExtendedEntityManager e : ems) {
entityManagers.put(e.getScopedPuName(), e);