@Override public Object processInvocation(final InterceptorContext context) throws Exception { final Method method = SessionBeanHomeInterceptorFactory.INIT_METHOD.get(); final Object[] params = SessionBeanHomeInterceptorFactory.INIT_PARAMETERS.get(); //we remove them immediately, so they are not set for the rest of the invocation //TODO: find a better way to handle this SessionBeanHomeInterceptorFactory.INIT_METHOD.remove(); SessionBeanHomeInterceptorFactory.INIT_PARAMETERS.remove(); if (method != null) { final InvocationType invocationType = context.getPrivateData(InvocationType.class); try { context.putPrivateData(InvocationType.class, InvocationType.SFSB_INIT_METHOD); method.invoke(context.getTarget(), params); } catch (InvocationTargetException e) { if (CreateException.class.isAssignableFrom(e.getCause().getClass())) { EjbExceptionTransformingInterceptorFactories.setCreateException((CreateException) e.getCause()); } throw Interceptors.rethrow(e.getCause()); } finally { context.putPrivateData(InvocationType.class, invocationType); } } return context.proceed(); } }
@Override public Object processInvocation(InterceptorContext context) throws Exception { final MessageDrivenComponentInstance componentInstance = (MessageDrivenComponentInstance) context.getPrivateData(ComponentInstance.class); final MessageDrivenContext messageDrivenContext = (MessageDrivenContext) componentInstance.getEjbContext(); ((MessageDrivenBean) context.getTarget()).setMessageDrivenContext(messageDrivenContext); return context.proceed(); } }
@Override public Object processInvocation(InterceptorContext context) throws Exception { WeldInjectionContext injectionCtx = context.getPrivateData(WeldInjectionContext.class); setupAroundConstructCallback(injectionCtx.getContext(), context); /* * Here we delegate to Weld to start component construction. WF will be called back on the callback registered within #setupAroundConstructCallback. * The return value of the following call is not important as we get the component reference from ConstructionContext in WeldManagedReferenceFactory. */ injectionCtx.produce(); return context.getTarget(); }
@SuppressWarnings("unchecked") @Override public T aroundConstruct(ConstructionHandle<T> ctx, AnnotatedConstructor<T> constructor, Object[] parameters, Map<String, Object> data) throws Exception { context.putPrivateData(ConstructionHandle.class, ctx); context.setParameters(parameters); context.setContextData(data); context.setConstructor(constructor.getJavaMember()); context.proceed(); // proceed with the WF interceptor chain return (T) context.getTarget(); } });
@Override public Object processInvocation(final InterceptorContext context) throws Exception { SessionBeanComponentInstance instance = (SessionBeanComponentInstance) context.getPrivateData(ComponentInstance.class); final InvocationType invocationType = context.getPrivateData(InvocationType.class); try { context.putPrivateData(InvocationType.class, InvocationType.DEPENDENCY_INJECTION); ((SessionBean) context.getTarget()).setSessionContext(instance.getEjbContext()); } finally { context.putPrivateData(InvocationType.class, invocationType); } return context.proceed(); } }
public Object getTarget() { return InterceptorContext.this.getTarget(); }
@Override public Object processInvocation(final InterceptorContext context) throws Exception { if (method != null) { final InvocationType invocationType = context.getPrivateData(InvocationType.class); try { context.putPrivateData(InvocationType.class, InvocationType.SFSB_INIT_METHOD); method.invoke(context.getTarget(), params); } catch (InvocationTargetException e) { if (CreateException.class.isAssignableFrom(e.getCause().getClass())) { EjbExceptionTransformingInterceptorFactories.setCreateException((CreateException) e.getCause()); } throw Interceptors.rethrow(e.getCause()); } finally { context.putPrivateData(InvocationType.class, invocationType); } } return context.proceed(); } };
public Object processInvocation(final InterceptorContext context) throws Exception { final Method method = context.getMethod(); if (method == null) { return null; } try { Object target = context.getTarget(); if (target == null) { throw msg.nullProperty("target", context); } return method.invoke(target, 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()); } }
@Override public Object processInvocation(InterceptorContext context) throws Exception { final MessageDrivenComponentInstance componentInstance = (MessageDrivenComponentInstance) context.getPrivateData(ComponentInstance.class); final MessageDrivenContext messageDrivenContext = (MessageDrivenContext) componentInstance.getEjbContext(); ((MessageDrivenBean) context.getTarget()).setMessageDrivenContext(messageDrivenContext); return context.proceed(); } }
@Override public Object processInvocation(final InterceptorContext context) throws Exception { SessionBeanComponentInstance instance = (SessionBeanComponentInstance) context.getPrivateData(ComponentInstance.class); final InvocationType invocationType = context.getPrivateData(InvocationType.class); try { context.putPrivateData(InvocationType.class, InvocationType.DEPENDENCY_INJECTION); ((SessionBean) context.getTarget()).setSessionContext(instance.getEjbContext()); } finally { context.putPrivateData(InvocationType.class, invocationType); } return context.proceed(); } }
@Override public Object processInvocation(InterceptorContext context) throws Exception { ComponentView cv = context.getPrivateData(ComponentView.class); ManagedReference mr = cv.createInstance(); Object serviceInstance = mr.getInstance(); Class serviceClass = context.getTarget().getClass(); Method serviceMethod = context.getMethod(); Object result; ProtocolHandler protocolHandler = HandlerFactory.getInstance(new ServiceInvocationMeta(serviceInstance, serviceClass, serviceMethod)); try { protocolHandler.preInvocation(); result = context.proceed(); protocolHandler.notifySuccess(); } catch (Exception e) { protocolHandler.notifyFailure(); throw e; } return result; } }