@SuppressWarnings("unused") private Object readResolve() throws ObjectStreamException { // recreate the proxy using the locator and the EJB client context identifier return EJBClient.createProxy(this.ejbLocator); } }
/** * Create a new proxy for the remote object identified by the given locator. * * @param locator the locator * @param <T> the proxy type * @return the new proxy * @throws IllegalArgumentException if the locator parameter is {@code null} or is invalid */ public static <T> T createProxy(final EJBLocator<T> locator) throws IllegalArgumentException { return createProxy(locator, null); }
/** * Get the EJB home interface. * * @return the EJB home interface */ public H getEJBHome() { return EJBClient.createProxy(homeLocator); }
/** * {@inheritDoc} */ public T getEJBObject() throws RemoteException { return EJBClient.createProxy(locator); }
/** * {@inheritDoc} */ public T getEJBHome() throws RemoteException { return EJBClient.createProxy(locator); }
@Override public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) { Object value = EJBClient.createProxy(StatelessEJBLocator.create(componentView.getViewClass(), identifier, Affinity.LOCAL)); return new ValueManagedReference(new ImmediateValue<>(value)); }
@Override public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) { Object value = EJBClient.createProxy(new EJBHomeLocator(componentView.getViewClass(), applicationName, moduleName, beanName, distinctName, Affinity.LOCAL)); return new ValueManagedReference(new ImmediateValue(value)); }
static <T> T createSessionProxy(final StatelessEJBLocator<T> statelessLocator, Supplier<AuthenticationContext> authenticationContextSupplier, NamingProvider namingProvider) throws Exception { final EJBClientContext clientContext = EJBClientContext.getCurrent(); // this is the auth context to use just for the invocation final AuthenticationContext authenticationContext; if (authenticationContextSupplier != null) { authenticationContext = authenticationContextSupplier.get(); } else { authenticationContext = AuthenticationContext.captureCurrent(); } final EJBSessionCreationInvocationContext context = clientContext.createSessionCreationInvocationContext(statelessLocator, authenticationContext); final StatefulEJBLocator<T> statefulLocator = clientContext.createSession(context, statelessLocator, namingProvider); final T proxy = createProxy(statefulLocator, authenticationContextSupplier); final Affinity weakAffinity = context.getWeakAffinity(); if (weakAffinity != null && Affinity.NONE != weakAffinity) { setWeakAffinity(proxy, weakAffinity); } return proxy; }
public EJBHome getEJBHome() throws IllegalStateException { if (ejbHomeViewServiceName == null) { throw EjbLogger.ROOT_LOGGER.beanHomeInterfaceIsNull(getComponentName()); } final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(ejbHomeViewServiceName); final ComponentView view = (ComponentView) serviceController.getValue(); final String locatorAppName = earApplicationName == null ? "" : earApplicationName; return EJBClient.createProxy(createHomeLocator(view.getViewClass().asSubclass(EJBHome.class), locatorAppName, moduleName, getComponentName(), distinctName)); }
@Override public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) throws Exception { SessionID sessionID = (SessionID) contextData.get(SessionID.class); final StatefulEJBLocator<?> statefulEJBLocator; final StatefulSessionComponent statefulSessionComponent = (StatefulSessionComponent) componentView.getComponent(); if (sessionID == null) { statefulEJBLocator = EJBClient.createSession(StatelessEJBLocator.create(componentView.getViewClass(), identifier, Affinity.LOCAL)); } else { statefulEJBLocator = StatefulEJBLocator.create(componentView.getViewClass(), identifier, sessionID, statefulSessionComponent.getCache().getStrictAffinity()); } final Object ejbProxy = EJBClient.createProxy(statefulEJBLocator); return new ValueManagedReference(new ImmediateValue<Object>(ejbProxy)); }
@Override public EJBObject run() { return EJBClient.createProxy(new StatefulEJBLocator<EJBObject>((Class<EJBObject>) view.getViewClass(), locatorAppName, getModuleName(), getComponentName(), getDistinctName(), getSessionIdOf(ctx), getCache().getStrictAffinity())); } });
ejbLocator = StatelessEJBLocator.create(viewClass, identifier, appclient ? Affinity.NONE : Affinity.LOCAL); final Object proxy = EJBClient.createProxy(ejbLocator);
proxy = EJBClient.createProxy(statelessLocator, providerEnvironment.getAuthenticationContextSupplier());
@SuppressWarnings("unchecked") @Override public EJBObject getEJBObject(final InterceptorContext ctx) throws IllegalStateException { if (getEjbObjectViewServiceName() == null) { throw EjbLogger.ROOT_LOGGER.beanComponentMissingEjbObject(getComponentName(), "EJBObject"); } final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(getEjbObjectViewServiceName()); final ComponentView view = (ComponentView) serviceController.getValue(); final String locatorAppName = getEarApplicationName() == null ? "" : getEarApplicationName(); if(WildFlySecurityManager.isChecking()) { //need to use doPrivileged rather than doUnchecked, as this can run user code in the proxy constructor return AccessController.doPrivileged(new PrivilegedAction<EJBObject>() { @Override public EJBObject run() { return EJBClient.createProxy(new StatefulEJBLocator<EJBObject>((Class<EJBObject>) view.getViewClass(), locatorAppName, getModuleName(), getComponentName(), getDistinctName(), getSessionIdOf(ctx), getCache().getStrictAffinity())); } }); } else { return EJBClient.createProxy(new StatefulEJBLocator<EJBObject>((Class<EJBObject>) view.getViewClass(), locatorAppName, getModuleName(), getComponentName(), getDistinctName(), getSessionIdOf(ctx), this.getCache().getStrictAffinity())); } }
/** * {@inheritDoc} */ public T getEJBHome() throws RemoteException { return EJBClient.createProxy(locator); }
/** * Create a new proxy for the remote object identified by the given locator. * * @param locator the locator * @param <T> the proxy type * @return the new proxy * @throws IllegalArgumentException if the locator parameter is {@code null} or is invalid */ public static <T> T createProxy(final EJBLocator<T> locator) throws IllegalArgumentException { return createProxy(locator, null); }
@Override public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) { Object value = EJBClient.createProxy(new EJBHomeLocator(componentView.getViewClass(), applicationName, moduleName, beanName, distinctName)); return new ValueManagedReference(new ImmediateValue(value)); }
public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) throws Exception { Object primaryKey = contextData.get(EntityBeanComponent.PRIMARY_KEY_CONTEXT_KEY); if (primaryKey == null) { primaryKey = invokeCreate(componentView.getComponent(), contextData); } Object value = EJBClient.createProxy(new EntityEJBLocator(componentView.getViewClass(), applicationName, moduleName, beanName, distinctName, primaryKey)); return new ValueManagedReference(new ImmediateValue(value)); }
public EJBHome getEJBHome() throws IllegalStateException { if (ejbHomeViewServiceName == null) { throw MESSAGES.beanHomeInterfaceIsNull(getComponentName()); } final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(ejbHomeViewServiceName); final ComponentView view = (ComponentView) serviceController.getValue(); final String locatorAppName = earApplicationName == null ? "" : earApplicationName; return EJBClient.createProxy(new EJBHomeLocator<EJBHome>((Class<EJBHome>) view.getViewClass(), locatorAppName, moduleName, getComponentName(), distinctName)); }
@SuppressWarnings("unchecked") @Override public EJBObject getEJBObject(final InterceptorContext ctx) throws IllegalStateException { if (getEjbObjectViewServiceName() == null) { throw MESSAGES.beanComponentMissingEjbObject(getComponentName(), "EJBObject"); } final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(getEjbObjectViewServiceName()); final ComponentView view = (ComponentView) serviceController.getValue(); final String locatorAppName = getEarApplicationName() == null ? "" : getEarApplicationName(); return EJBClient.createProxy(new StatefulEJBLocator<EJBObject>((Class<EJBObject>) view.getViewClass(), locatorAppName, getModuleName(), getComponentName(), getDistinctName(), getSessionIdOf(ctx), this.getCache().getStrictAffinity())); }