public void inject(BeanContext ctx, Object instance) { property.set(instance, ctx.getEJBContext()); }
public void inject(BeanContext ctx, Object instance) { Object[] args = {ctx.getEJBContext()}; try { setMethod.invoke(instance, args); } catch (IllegalAccessException e) { throw new RuntimeException(e); //To change body of catch statement use Options | File Templates. } catch (IllegalArgumentException e) { throw new RuntimeException("Failed in setting EntityManager on setter method: " + setMethod.toString()); } catch (InvocationTargetException e) { throw new RuntimeException(e.getCause()); //To change body of catch statement use Options | File Templates. } }
public InjectionInvocation(BeanContext<?> ctx, InjectionManager injectionManager, Interceptor interceptors[]) { super(interceptors); if (ctx == null) { throw new IllegalArgumentException("BeanContext cannot be null while creating InjectionInvocation"); } if (injectionManager == null) { throw new IllegalArgumentException("InjectionManager cannot be null while creating InjectionInvocation"); } this.ctx = ctx; this.injectionManager = injectionManager; invocationContext.setEJBContext(ctx.getEJBContext()); }
public void inject(BeanContext ctx, Object instance) { try { field.set(instance, ctx.getEJBContext()); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { Reference ref = (Reference) obj; String containerGuid = (String) ref.get("containerGuid").getContent(); boolean isClustered = Boolean.getBoolean((String)ref.get("isClustered").getContent()); EJBContainer container = (EJBContainer)Ejb3Registry.getContainer(containerGuid); if (container == null && isClustered) { String containerClusterUid = (String) ref.get("containerClusterUid").getContent(); container = (EJBContainer)Ejb3Registry.getClusterContainer(containerClusterUid); } return container.peekContext().getEJBContext(); } }
/** * * @param ctx * @param injectors * @param interceptors * @param injectionManager * * @deprecated Once InjectionManager is completely integrated, this constructor shouldn't be used. * Use {@link #InjectionInvocation(BeanContext, InjectionManager, Interceptor[])} instead. */ @Deprecated public InjectionInvocation(BeanContext<?> ctx, Iterable<Injector> injectors, Interceptor interceptors[], InjectionManager injectionManager) { super(interceptors); assert ctx != null : "ctx is null"; assert injectors != null : "injector is null"; this.ctx = ctx; this.invocationContext = ctx.createInjectionInvocation(injectors); this.injectionManager = injectionManager; invocationContext.setEJBContext(ctx.getEJBContext()); }
/** * EJB3 spec states that if a session bean implements the {@link SessionBean} interface then the * container should invoke {@link SessionBean#setSessionContext(javax.ejb.SessionContext)} to associate * a session context with the bean instance. The container calls this {@link #invokeSetSessionContext(BeanContext)} * method when a new {@link BeanContext} is created (typically via {@link #createBeanContext()}). * * @param beanCtx The {@link BeanContext} * @throws EJBException * @throws RemoteException */ protected void invokeSetSessionContext(BeanContext beanCtx) throws EJBException, RemoteException { Object beanInstance = beanCtx.getInstance(); if (beanInstance instanceof SessionBean) { ((SessionBean) beanInstance).setSessionContext((javax.ejb.SessionContext) beanCtx.getEJBContext()); } }
/** * EJB3 spec states that if a message driven bean implements the {@link MessageDrivenBean} interface then the * container should invoke {@link MessageDrivenBean#setMessageDrivenContext(javax.ejb.MessageDrivenContext)} * to associate the {@link MessageDrivenContext} context with the bean instance. * The container calls this {@link #invokeSetMessageDrivenContext(BeanContext)} * method when a new {@link BeanContext} is created (typically via {@link #createBeanContext()}) * * @param beanCtx The {@link BeanContext} * @throws EJBException * @throws RemoteException */ protected void invokeSetMessageDrivenContext(BeanContext beanCtx) throws EJBException, RemoteException { Object beanInstance = beanCtx.getInstance(); if (beanInstance instanceof MessageDrivenBean) { ((MessageDrivenBean) beanInstance).setMessageDrivenContext((MessageDrivenContext) beanCtx.getEJBContext()); } } }
@Override public void setBeanContext(org.jboss.ejb3.interceptors.container.BeanContext<?> beanCtx) { super.setBeanContext(beanCtx); if(beanCtx == null) invocationContext.setEJBContext(null); else invocationContext.setEJBContext(((org.jboss.ejb3.BeanContext<?>) beanCtx).getEJBContext()); } }
@Override public void setBeanContext(org.jboss.ejb3.interceptors.container.BeanContext<?> beanCtx) { super.setBeanContext(beanCtx); if(beanCtx == null) invocationContext.setEJBContext(null); else invocationContext.setEJBContext(((org.jboss.ejb3.BeanContext<?>) beanCtx).getEJBContext()); }
private InvocationContext getInvocationContext(LifecycleMethodInterceptorsInvocation invocation) { BeanContext<?> beanContext = (BeanContext<?>) invocation.getBeanContext(); InvocationContext invocationContext = beanContext.createLifecycleInvocation(); invocationContext.setEJBContext(beanContext.getEJBContext()); return invocationContext; } }
@Override public void setBeanContext(BeanContext<?> beanCtx) { super.setBeanContext(beanCtx); if(beanCtx == null) invocationContext.setEJBContext(null); else invocationContext.setEJBContext(((org.jboss.ejb3.BeanContext<?>) beanCtx).getEJBContext()); }
public void attached(BeanContext beanCtx) { // JAX-RPC MessageContext StatelessBeanContext sbc = (StatelessBeanContext)beanCtx; sbc.setMessageContextJAXRPC(jaxrpcMessageContext); // JAX-WS MessageContext BeanProperty beanProp = sbc.getWebServiceContextProperty(); if (beanProp != null) { EJBContext ejbCtx = beanCtx.getEJBContext(); jaxwsContext.addAttachment(EJBContext.class, ejbCtx); beanProp.set(beanCtx.getInstance(), jaxwsContext); } }
public void attached(BeanContext beanCtx) { StatelessBeanContext sbc = (StatelessBeanContext)beanCtx; sbc.setMessageContextJAXRPC(jaxrpcMessageContext); EJBContext ejbCtx = beanCtx.getEJBContext(); SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); WebServiceContextFactory factory = spiProvider.getSPI(WebServiceContextFactory.class); ExtensibleWebServiceContext wsContext = factory.newWebServiceContext(InvocationType.JAXWS_EJB3, jaxwsMessageContext); wsContext.addAttachment(EJBContext.class, ejbCtx); sbc.setWebServiceContext(wsContext); }
public void attached(BeanContext beanCtx) { StatelessBeanContext sbc = (StatelessBeanContext)beanCtx; sbc.setMessageContextJAXRPC(jaxrpcMessageContext); EJBContext ejbCtx = beanCtx.getEJBContext(); SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); WebServiceContextFactory factory = spiProvider.getSPI(WebServiceContextFactory.class); ExtensibleWebServiceContext wsContext = factory.newWebServiceContext(InvocationType.JAXWS_EJB3, jaxwsMessageContext); wsContext.addAttachment(EJBContext.class, ejbCtx); sbc.setWebServiceContext(wsContext); }
public void attached(BeanContext beanCtx) { StatelessBeanContext sbc = (StatelessBeanContext)beanCtx; sbc.setMessageContextJAXRPC(jaxrpcMessageContext); BeanProperty beanProp = sbc.getWebServiceContextProperty(); if (beanProp != null) { EJBContext ejbCtx = beanCtx.getEJBContext(); SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); ExtensibleWebServiceContext wsContext = spiProvider.getSPI(WebServiceContextFactory.class).newWebServiceContext(InvocationType.JAXWS_EJB3, jaxwsMessageContext); wsContext.addAttachment(EJBContext.class, ejbCtx); beanProp.set(beanCtx.getInstance(), wsContext); } }
public void attached(BeanContext beanCtx) { StatelessBeanContext sbc = (StatelessBeanContext)beanCtx; sbc.setMessageContextJAXRPC(jaxrpcMessageContext); BeanProperty beanProp = sbc.getWebServiceContextProperty(); if (beanProp != null) { EJBContext ejbCtx = beanCtx.getEJBContext(); SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); WebServiceContextFactory factory = spiProvider.getSPI(WebServiceContextFactory.class); ExtensibleWebServiceContext wsContext = factory.newWebServiceContext(InvocationType.JAXWS_EJB3, jaxwsMessageContext); wsContext.addAttachment(EJBContext.class, ejbCtx); beanProp.set(beanCtx.getInstance(), wsContext); } }