/** * {@inheritDoc} */ public Object processInvocation(final InterceptorContext context) throws Exception { final ManagedReference reference = (ManagedReference) context.getPrivateData(ComponentInstance.class).getInstanceData(contextKey); final Object instance = reference.getInstance(); try { return method.invoke(instance, context.getParameters()); } catch (IllegalAccessException e) { final IllegalAccessError n = new IllegalAccessError(e.getMessage()); n.setStackTrace(e.getStackTrace()); throw n; } catch (InvocationTargetException e) { throw Interceptors.rethrow(e.getCause()); } } }
/** * {@inheritDoc} */ public Object processInvocation(final InterceptorContext context) throws Exception { try { return context.proceed(); } finally { final ManagedReference managedReference = (ManagedReference) context.getPrivateData(ComponentInstance.class).getInstanceData(contextKey); if (managedReference != null) { managedReference.release(); } } } }
@Override public Object processInvocation(InterceptorContext context) throws Exception { ManagedReference reference = (ManagedReference) context.getPrivateData(ComponentInstance.class).getInstanceData(BasicComponentInstance.INSTANCE_KEY); if (reference != null) { run(reference.getInstance()); } return context.proceed(); }
@Override public Object processInvocation(final InterceptorContext context) throws Exception { WeldInjectionContext injectionContext = context.getPrivateData(WeldInjectionContext.class); ManagedReference reference = (ManagedReference) context.getPrivateData(ComponentInstance.class).getInstanceData(BasicComponentInstance.INSTANCE_KEY); if (reference != null) { injectionContext.inject(reference.getInstance()); } return context.proceed(); } }
target = null; } else { target = ((ManagedReference) componentInstance.getInstanceData(targetKey)).getInstance(); if (target == null) { throw EeLogger.ROOT_LOGGER.injectionTargetNotFound();
@Override public Object processInvocation(final InterceptorContext context) throws Exception { WeldInjectionContext injectionContext = context.getPrivateData(WeldInjectionContext.class); final ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class); //now inject the interceptors for (final Class<?> interceptorClass : interceptorClasses) { final ManagedReference instance = (ManagedReference) componentInstance.getInstanceData(interceptorClass); if (instance != null) { injectionContext.injectInterceptor(instance.getInstance()); } } return context.proceed(); } }
final ManagedReference reference = (ManagedReference) context.getPrivateData(ComponentInstance.class).getInstanceData(contextKey); final Object instance = reference.getInstance(); try {
target = null; } else { target = ((ManagedReference) componentInstance.getInstanceData(targetKey)).getInstance(); if (target == null) { throw EeLogger.ROOT_LOGGER.injectionTargetNotFound();
public Object processInvocation(final InterceptorContext context) throws Exception { final ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class); final ManagedReference existing = (ManagedReference) componentInstance.getInstanceData(contextKey); if (existing == null) { final ManagedReference reference = componentFactory.create(context); boolean ok = false; try { componentInstance.setInstanceData(contextKey, reference); if (setTarget) { context.setTarget(reference.getInstance()); } Object result = context.proceed(); ok = true; return result; } finally { if (!ok) { reference.release(); componentInstance.setInstanceData(contextKey, reference); } } } else { return context.proceed(); } }
@Override public InterceptorInstances getInterceptorInstances(ComponentInstance componentInstance) { return (WeldInterceptorInstances) componentInstance.getInstanceData(SerializedCdiInterceptorsKey.class); }
@Override public Object processInvocation(InterceptorContext interceptorContext) throws Exception { final ComponentInstance componentInstance = interceptorContext.getPrivateData(ComponentInstance.class); try { return interceptorContext.proceed(); } finally { ManagedReference entityManagerRef = (ManagedReference) componentInstance.getInstanceData(SFSBInvocationInterceptor.CONTEXT_KEY); if(entityManagerRef != null) { Map<String, ExtendedEntityManager> entityManagers = (Map<String, ExtendedEntityManager>) entityManagerRef.getInstance(); for(Map.Entry<String, ExtendedEntityManager> entry : entityManagers.entrySet()) { // close all extended persistence contexts that are referenced by the bean being destroyed entry.getValue().refCountedClose(); } } } } }
/** * {@inheritDoc} */ public Object processInvocation(final InterceptorContext context) throws Exception { final ManagedReference reference = (ManagedReference) context.getPrivateData(ComponentInstance.class).getInstanceData(contextKey); final Object instance = reference.getInstance(); try { return method.invoke(instance, context.getParameters()); } catch (IllegalAccessException e) { final IllegalAccessError n = new IllegalAccessError(e.getMessage()); n.setStackTrace(e.getStackTrace()); throw n; } catch (InvocationTargetException e) { throw Interceptors.rethrow(e.getCause()); } } }
/** * {@inheritDoc} */ public Object processInvocation(final InterceptorContext context) throws Exception { final ManagedReference reference = (ManagedReference) context.getPrivateData(ComponentInstance.class).getInstanceData(contextKey); final Object instance = reference.getInstance(); try { return method.invoke(instance, context.getParameters()); } catch (IllegalAccessException e) { final IllegalAccessError n = new IllegalAccessError(e.getMessage()); n.setStackTrace(e.getStackTrace()); throw n; } catch (InvocationTargetException e) { throw Interceptors.rethrow(e.getCause()); } } }
/** * {@inheritDoc} */ public Object processInvocation(final InterceptorContext context) throws Exception { try { return context.proceed(); } finally { final ManagedReference managedReference = (ManagedReference) context.getPrivateData(ComponentInstance.class).getInstanceData(contextKey); if (managedReference != null) { managedReference.release(); } } } }
@Override public Object processInvocation(InterceptorContext interceptorContext) throws Exception { final ComponentInstance componentInstance = interceptorContext.getPrivateData(ComponentInstance.class); try { return interceptorContext.proceed(); } finally { ManagedReference entityManagerRef = (ManagedReference) componentInstance.getInstanceData(SFSBInvocationInterceptor.CONTEXT_KEY); if(entityManagerRef != null) { Map<String, ExtendedEntityManager> entityManagers = (Map<String, ExtendedEntityManager>) entityManagerRef.getInstance(); for(Map.Entry<String, ExtendedEntityManager> entry : entityManagers.entrySet()) { // close all extended persistence contexts that are referenced by the bean being destroyed entry.getValue().refCountedClose(); } } } } }
/** * {@inheritDoc} */ public Object processInvocation(final InterceptorContext context) throws Exception { try { return context.proceed(); } finally { final ManagedReference managedReference = (ManagedReference) context.getPrivateData(ComponentInstance.class).getInstanceData(contextKey); if (managedReference != null) { managedReference.release(); } } } }
@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 ExtendedEntityManager[] ems = CreatedEntityManagers.getDeferredEntityManagers(); for (ExtendedEntityManager e : ems) { entityManagers.put(e.getScopedPuName(), e); } return interceptorContext.proceed(); } }
@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 ExtendedEntityManager[] ems = CreatedEntityManagers.getDeferredEntityManagers(); for (ExtendedEntityManager e : ems) { entityManagers.put(e.getScopedPuName(), e); } return interceptorContext.proceed(); } }
@Override public Object processInvocation(InterceptorContext context) throws Exception { final ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class); ManagedReference entityManagerRef = (ManagedReference) componentInstance.getInstanceData(SFSBInvocationInterceptor.CONTEXT_KEY); if(entityManagerRef != null) { Map<String, ExtendedEntityManager> entityManagers = (Map<String, ExtendedEntityManager>) entityManagerRef.getInstance(); SFSBCallStack.pushCall(entityManagers); } try { return context.proceed(); // call the next interceptor or target } finally { if(entityManagerRef != null) { SFSBCallStack.popCall(); } } } }
@Override public Object processInvocation(InterceptorContext context) throws Exception { final ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class); ManagedReference entityManagerRef = (ManagedReference) componentInstance.getInstanceData(SFSBInvocationInterceptor.CONTEXT_KEY); if(entityManagerRef != null) { Map<String, ExtendedEntityManager> entityManagers = (Map<String, ExtendedEntityManager>) entityManagerRef.getInstance(); SFSBCallStack.pushCall(entityManagers); } try { return context.proceed(); // call the next interceptor or target } finally { if(entityManagerRef != null) { SFSBCallStack.popCall(); } } } }