@Override public String getInstanceClassName() { return view.getComponent().getComponentClass().getName(); }
private void updateAffinities(InvocationRequest invocationRequest, Map<String, Object> attachments, EJBLocator<?> ejbLocator, ComponentView componentView) { Affinity legacyAffinity = null; Affinity weakAffinity = null; Affinity clusterAffinity = getClusterAffinity(); if (ejbLocator.isStateful() && componentView.getComponent() instanceof StatefulSessionComponent) { final StatefulSessionComponent statefulSessionComponent = (StatefulSessionComponent) componentView.getComponent(); weakAffinity = legacyAffinity = getWeakAffinity(statefulSessionComponent, ejbLocator.asStateful()); } else if (componentView.getComponent() instanceof StatelessSessionComponent) { // V3 and less used cluster affinity as a weak affinity for SLSBs legacyAffinity = clusterAffinity; } // Always use the cluster as the strong affinity, if there is one if (clusterAffinity != null) { invocationRequest.updateStrongAffinity(clusterAffinity); } if (weakAffinity != null && !weakAffinity.equals(Affinity.NONE)) { invocationRequest.updateWeakAffinity(weakAffinity); } if (legacyAffinity != null && !legacyAffinity.equals(Affinity.NONE)) { attachments.put(Affinity.WEAK_AFFINITY_CONTEXT_KEY, legacyAffinity); } }
private void prepareInterceptorContext(final SkeletonStrategy op, final Object[] params, final InterceptorContext interceptorContext) throws IOException, ClassNotFoundException { if (!home) { if (componentView.getComponent() instanceof StatefulSessionComponent) { final SessionID sessionID = (SessionID) unmarshalIdentifier(); interceptorContext.putPrivateData(SessionID.class, sessionID); } } interceptorContext.setContextData(new HashMap<>()); interceptorContext.setParameters(params); interceptorContext.setMethod(op.getMethod()); interceptorContext.putPrivateData(ComponentView.class, componentView); interceptorContext.putPrivateData(Component.class, componentView.getComponent()); interceptorContext.putPrivateData(InvocationType.class, InvocationType.REMOTE); interceptorContext.setTransaction(inboundTxCurrent == null ? null : inboundTxCurrent.getCurrentTransaction()); }
/** {@inheritDoc} */ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { final Interceptor interceptor = interceptors.get(method); if (interceptor == null) { throw new NoSuchMethodError(method.toString()); } final InterceptorContext context = new InterceptorContext(); // special location for original proxy context.putPrivateData(Object.class, proxy); context.putPrivateData(Component.class, componentView.getComponent()); context.putPrivateData(ComponentView.class, componentView); context.putPrivateData(SecurityDomain.class, WildFlySecurityManager.isChecking() ? AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) SecurityDomain::getCurrent) : SecurityDomain.getCurrent()); instance.prepareInterceptorContext(context); context.setParameters(args); context.setMethod(method); // setup the public context data context.setContextData(new HashMap<String, Object>()); context.setBlockingCaller(true); return interceptor.processInvocation(context); } }
@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)); }
public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) throws Exception { final Component component = componentView.getComponent(); final ComponentClientInstance instance = new ComponentClientInstance(); try {
interceptorContext.setParameters(content.getParameters()); interceptorContext.setMethod(method); interceptorContext.putPrivateData(Component.class, componentView.getComponent()); interceptorContext.putPrivateData(ComponentView.class, componentView); interceptorContext.putPrivateData(InvocationType.class, InvocationType.REMOTE); final boolean isAsync = componentView.isAsynchronous(method); final boolean oneWay = isAsync && method.getReturnType() == void.class; final boolean isSessionBean = componentView.getComponent() instanceof SessionBeanComponent; if (isAsync && isSessionBean) { if (! oneWay) {
throw new BAD_OPERATION(opName); final NamespaceContextSelector selector = componentView.getComponent().getNamespaceContextSelector(); final ClassLoader oldCl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); NamespaceContextSelector.pushCurrentSelector(selector);
final boolean isAsync = view.isAsynchronous(method); final boolean oneWay = isAsync && method.getReturnType() == void.class; final boolean isSessionBean = view.getComponent() instanceof SessionBeanComponent; if (isAsync && isSessionBean) { if (! oneWay) {
if (componentView.getComponent() instanceof StatefulSessionComponent && exception instanceof EJBException && cause != null) { if (!(componentView.getComponent().isRemotable(cause))) {
@Override public String getInstanceClassName() { return view.getComponent().getComponentClass().getName(); }
@Override public String getInstanceClassName() { return view.getComponent().getComponentClass().getName(); }
@Override public String getInstanceClassName() { return view.getComponent().getComponentClass().getName(); }
private void prepareInterceptorContext(final SkeletonStrategy op, final Object[] params, final InterceptorContext interceptorContext) throws IOException, ClassNotFoundException { if (!home) { if (componentView.getComponent() instanceof StatefulSessionComponent) { final SessionID sessionID = (SessionID) unmarshalIdentifier(); interceptorContext.putPrivateData(SessionID.class, sessionID); } else if (componentView.getComponent() instanceof EntityBeanComponent) { final Object pk = unmarshalIdentifier(); interceptorContext.putPrivateData(EntityBeanComponent.PRIMARY_KEY_CONTEXT_KEY, pk); } } interceptorContext.setContextData(new HashMap<String, Object>()); interceptorContext.setParameters(params); interceptorContext.setMethod(op.getMethod()); interceptorContext.putPrivateData(ComponentView.class, componentView); interceptorContext.putPrivateData(Component.class, componentView.getComponent()); }
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)); }
/** {@inheritDoc} */ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { final Interceptor interceptor = interceptors.get(method); if (interceptor == null) { throw new NoSuchMethodError(method.toString()); } final InterceptorContext context = new InterceptorContext(); // special location for original proxy context.putPrivateData(Object.class, proxy); context.putPrivateData(Component.class, componentView.getComponent()); context.putPrivateData(ComponentView.class, componentView); context.putPrivateData(SecurityDomain.class, WildFlySecurityManager.isChecking() ? AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) SecurityDomain::getCurrent) : SecurityDomain.getCurrent()); instance.prepareInterceptorContext(context); context.setParameters(args); context.setMethod(method); // setup the public context data context.setContextData(new HashMap<String, Object>()); context.setBlockingCaller(true); return interceptor.processInvocation(context); } }
/** {@inheritDoc} */ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { final Interceptor interceptor = interceptors.get(method); if (interceptor == null) { throw new NoSuchMethodError(method.toString()); } final InterceptorContext context = new InterceptorContext(); // special location for original proxy context.putPrivateData(Object.class, proxy); context.putPrivateData(Component.class, componentView.getComponent()); context.putPrivateData(ComponentView.class, componentView); context.putPrivateData(SecurityDomain.class, WildFlySecurityManager.isChecking() ? AccessController.doPrivileged((PrivilegedAction<SecurityDomain>) SecurityDomain::getCurrent) : SecurityDomain.getCurrent()); instance.prepareInterceptorContext(context); context.setParameters(args); context.setMethod(method); // setup the public context data context.setContextData(new HashMap<String, Object>()); context.setBlockingCaller(true); return interceptor.processInvocation(context); } }
@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)); }
context.setParameters(wsInvocation.getArgs()); context.setTarget(reference.getInstance()); context.putPrivateData(Component.class, componentView.getComponent()); context.putPrivateData(ComponentView.class, componentView);
Component component = componentView.getComponent();