/** * Create a new EJB session. * * @param statelessLocator the stateless locator identifying the stateful EJB * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(StatelessEJBLocator<T> statelessLocator) throws Exception { return createSession(statelessLocator, null); }
/** * Create a new EJB session. * * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final Class<T> viewType, final String appName, final String moduleName, final String beanName) throws Exception { return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, Affinity.NONE)); }
/** * Create a new EJB session. * * @param affinity the affinity specification for the session * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final Affinity affinity, final Class<T> viewType, final String appName, final String moduleName, final String beanName) throws Exception { return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, affinity == null ? Affinity.NONE : affinity)); }
/** * Create a new EJB session. * * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param distinctName the module distinct name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final Class<T> viewType, final String appName, final String moduleName, final String beanName, final String distinctName) throws Exception { return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, distinctName, Affinity.NONE)); }
/** * Create a new EJB session. * * @param affinity the affinity specification for the session * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param distinctName the module distinct name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final Affinity affinity, final Class<T> viewType, final String appName, final String moduleName, final String beanName, final String distinctName) throws Exception { return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, distinctName, affinity == null ? Affinity.NONE : affinity)); }
/** * Create a new EJB session. * * @param uri a URI at which EJBs may be obtained * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final URI uri, final Class<T> viewType, final String appName, final String moduleName, final String beanName) throws Exception { final Affinity affinity = uri == null ? Affinity.NONE : Affinity.forUri(uri); return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, affinity)); }
/** * Create a new EJB session. * * @param uri a URI at which EJBs may be obtained * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param distinctName the module distinct name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final URI uri, final Class<T> viewType, final String appName, final String moduleName, final String beanName, final String distinctName) throws Exception { final Affinity affinity = uri == null ? Affinity.NONE : Affinity.forUri(uri); return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, distinctName, affinity)); }
@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)); }
} else if (stateful) { try { ejbLocator = EJBClient.createSession(StatelessEJBLocator.create(viewClass, identifier, appclient ? Affinity.NONE : Affinity.LOCAL)); } catch (Exception e) { throw EjbLogger.ROOT_LOGGER.failedToCreateSessionForStatefulBean(e, identifier.toString());
/** * Create a new EJB session. * * @param statelessLocator the stateless locator identifying the stateful EJB * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(StatelessEJBLocator<T> statelessLocator) throws Exception { return createSession(statelessLocator, null); }
/** * Create a new EJB session. * * @param statelessLocator the stateless locator identifying the stateful EJB * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(StatelessEJBLocator<T> statelessLocator) throws Exception { return createSession(statelessLocator, null); }
/** * Create a new EJB session. * * @param affinity the affinity specification for the session * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final Affinity affinity, final Class<T> viewType, final String appName, final String moduleName, final String beanName) throws Exception { return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, affinity == null ? Affinity.NONE : affinity)); }
/** * Create a new EJB session. * * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final Class<T> viewType, final String appName, final String moduleName, final String beanName) throws Exception { return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, Affinity.NONE)); }
/** * Create a new EJB session. * * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final Class<T> viewType, final String appName, final String moduleName, final String beanName) throws Exception { return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, Affinity.NONE)); }
/** * Create a new EJB session. * * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param distinctName the module distinct name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final Class<T> viewType, final String appName, final String moduleName, final String beanName, final String distinctName) throws Exception { return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, distinctName, Affinity.NONE)); }
/** * Create a new EJB session. * * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param distinctName the module distinct name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final Class<T> viewType, final String appName, final String moduleName, final String beanName, final String distinctName) throws Exception { return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, distinctName, Affinity.NONE)); }
/** * Create a new EJB session. * * @param affinity the affinity specification for the session * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final Affinity affinity, final Class<T> viewType, final String appName, final String moduleName, final String beanName) throws Exception { return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, affinity == null ? Affinity.NONE : affinity)); }
/** * Create a new EJB session. * * @param affinity the affinity specification for the session * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param distinctName the module distinct name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final Affinity affinity, final Class<T> viewType, final String appName, final String moduleName, final String beanName, final String distinctName) throws Exception { return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, distinctName, affinity == null ? Affinity.NONE : affinity)); }
/** * Create a new EJB session. * * @param uri a URI at which EJBs may be obtained * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final URI uri, final Class<T> viewType, final String appName, final String moduleName, final String beanName) throws Exception { final Affinity affinity = uri == null ? Affinity.NONE : Affinity.forUri(uri); return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, affinity)); }
@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(componentView.getViewClass(), applicationName, moduleName, beanName, distinctName); } else { statefulEJBLocator = new StatefulEJBLocator(componentView.getViewClass(), applicationName, moduleName, beanName, distinctName, sessionID, statefulSessionComponent.getCache().getStrictAffinity()); } final Object ejbProxy = EJBClient.createProxy(statefulEJBLocator); return new ValueManagedReference(new ImmediateValue(ejbProxy)); }