for (final ViewDescription view : views) { if (view instanceof EJBViewDescription) { final MethodIntf viewType = ((EJBViewDescription) view).getMethodIntf(); if (ejbViewDescription.getMethodIntf() == MethodIntf.REMOTE || ejbViewDescription.getMethodIntf() == MethodIntf.HOME) { final EJBComponentDescription componentDescription = (EJBComponentDescription) description.getComponentDescription(); final EEModuleDescription moduleDescription = componentDescription.getModuleDescription(); final String earApplicationName = moduleDescription.getEarApplicationName(); remoteFactory = new RemoteViewManagedReferenceFactory(earApplicationName, moduleDescription.getModuleName(), moduleDescription.getDistinctName(), componentDescription.getComponentName(), description.getViewClassName(), componentDescription.isStateful(), viewClassLoader, appclient); final ServiceName serviceName = description.getServiceName(); resolvedViewName = serviceName;
protected EJBViewDescription registerView(final String viewClassName, final MethodIntf viewType, final boolean ejb2xView) { // setup the ViewDescription final EJBViewDescription viewDescription = new EJBViewDescription(this, viewClassName, viewType, ejb2xView); getViews().add(viewDescription); // setup server side view interceptors setupViewInterceptors(viewDescription); // setup client side view interceptors setupClientViewInterceptors(viewDescription); // return created view if (viewType == MethodIntf.REMOTE || viewType == MethodIntf.HOME) { setupRemoteView(viewDescription); } return viewDescription; }
private void setupRemoteViewInterceptors(final EJBViewDescription view) { if (view.getMethodIntf() == MethodIntf.REMOTE || view.getMethodIntf() == MethodIntf.HOME) { view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException { if (Remote.class.isAssignableFrom(configuration.getViewClass())) { configuration.addViewInterceptor(EjbExceptionTransformingInterceptorFactories.REMOTE_INSTANCE, InterceptorOrder.View.REMOTE_EXCEPTION_TRANSFORMER); } } }); if (view.getMethodIntf() == MethodIntf.HOME) { view.getConfigurators().add(new ViewConfigurator() { @Override public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException { if (Remote.class.isAssignableFrom(configuration.getViewClass())) { final String earApplicationName = componentConfiguration.getComponentDescription().getModuleDescription().getEarApplicationName(); configuration.setViewInstanceFactory(new RemoteHomeViewInstanceFactory(earApplicationName, componentConfiguration.getModuleName(), componentConfiguration.getComponentDescription().getModuleDescription().getDistinctName(), componentConfiguration.getComponentName())); } } }); } } }
public EJBViewDescription(final ComponentDescription componentDescription, final String viewClassName, final MethodIntf methodIntf, final boolean ejb2xView) { //only add the default configurator if an ejb 3.x business view super(componentDescription, viewClassName, !ejb2xView && methodIntf != MethodIntf.HOME && methodIntf != MethodIntf.LOCAL_HOME ); this.methodIntf = methodIntf; this.ejb2xView = ejb2xView; hasJNDIBindings = initHasJNDIBindings(methodIntf); //add a configurator to attach the MethodIntf for this view getConfigurators().add(new ViewConfigurator() { @Override public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException { configuration.putPrivateData(MethodIntf.class, getMethodIntf()); } }); // add a view configurator for setting up application specific container interceptors for the EJB view getConfigurators().add(EJBContainerInterceptorsViewConfigurator.INSTANCE); }
@Override public ViewConfiguration createViewConfiguration(final Class<?> viewClass, final ComponentConfiguration componentConfiguration, final ProxyFactory<?> proxyFactory) { return new EJBViewConfiguration(viewClass, componentConfiguration, getServiceName(), proxyFactory, getMethodIntf()); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; EJBViewDescription that = (EJBViewDescription) o; // since the views are added to the component description, that should already be equal if (hasJNDIBindings != that.hasJNDIBindings) return false; if (methodIntf != that.methodIntf) return false; if (!getViewClassName().equals(that.getViewClassName())) return false; //we compare the components based on == //as you can have two components with the same name if (getComponentDescription() != that.getComponentDescription()) return false; return super.equals(o); }
@Override public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException { configuration.putPrivateData(MethodIntf.class, getMethodIntf()); } });
this.ejbHome = home == null ? null : home.getServiceName(); final EJBViewDescription ejbObject = ejbComponentDescription.getEjbRemoteView(); this.ejbObject = ejbObject == null ? null : ejbObject.getServiceName(); final EJBViewDescription ejbLocalObject = ejbComponentDescription.getEjbLocalView(); this.ejbLocalObject = ejbLocalObject == null ? null : ejbLocalObject.getServiceName(); this.applicationName = componentConfiguration.getApplicationName(); this.earApplicationName = componentConfiguration.getComponentDescription().getModuleDescription().getEarApplicationName();
private void assertNoLocalView(final String viewClassName) { EJBViewDescription ejbView = null; for (final ViewDescription view : getViews()) { ejbView = (EJBViewDescription) view; if (viewClassName.equals(ejbView.getViewClassName()) && ejbView.getMethodIntf() == MethodIntf.LOCAL) { throw EjbLogger.ROOT_LOGGER.failToAddClassToLocalView(viewClassName, getEJBName()); } } }
final Class<?> remoteClass; try { remoteClass = ClassLoadingUtils.loadClass(remoteView.getViewClassName(), module); } catch (ClassNotFoundException e) { throw EjbLogger.ROOT_LOGGER.failedToLoadViewClassForComponent(e, componentDescription.getEJBClassName()); final Class<?> homeClass; try { homeClass = ClassLoadingUtils.loadClass(homeView.getViewClassName(), module); } catch (ClassNotFoundException e) { throw EjbLogger.ROOT_LOGGER.failedToLoadViewClassForComponent(e, componentDescription.getEJBClassName()); componentDescription.getEjbRemoteView().getConfigurators().add(new IIOPInterceptorViewConfigurator()); final ServiceBuilder<EjbIIOPService> builder = serviceTarget.addService(componentDescription.getServiceName().append(EjbIIOPService.SERVICE_NAME), service); builder.addDependency(componentDescription.getCreateServiceName(), EJBComponent.class, service.getEjbComponentInjectedValue()); builder.addDependency(homeView.getServiceName(), ComponentView.class, service.getHomeView()); builder.addDependency(remoteView.getServiceName(), ComponentView.class, service.getRemoteView()); builder.addDependency(CorbaORBService.SERVICE_NAME, ORB.class, service.getOrb()); builder.addDependency(POARegistry.SERVICE_NAME, POARegistry.class, service.getPoaRegistry());
for (ViewDescription viewDescription : views) { ejbViewDescription = (EJBViewDescription) viewDescription; if (appclient && ejbViewDescription.getMethodIntf() != MethodIntf.REMOTE && ejbViewDescription.getMethodIntf() != MethodIntf.HOME) { continue; if (!ejbViewDescription.hasJNDIBindings()) continue; final String viewClassName = ejbViewDescription.getViewClassName(); if(ejbViewDescription.getMethodIntf() == MethodIntf.REMOTE || ejbViewDescription.getMethodIntf() == MethodIntf.HOME) { final String remoteJNDIName = remoteExportedJNDIBaseName + "!" + viewClassName; if(RequestControllerActivationMarker.isRequestControllerEnabled(deploymentUnit)) { if (ejbViewDescription.hasJNDIBindings()) {
protected void setupRemoteView(final EJBViewDescription viewDescription) { viewDescription.getConfigurators().add(new ViewConfigurator() { @Override public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException { configuration.getDependencies().add(new DependencyConfigurator<ViewService>() { @Override public void configureDependency(final ServiceBuilder<?> serviceBuilder, final ViewService service) throws DeploymentUnitProcessingException { CapabilityServiceSupport support = context.getDeploymentUnit().getAttachment(org.jboss.as.server.deployment.Attachments.CAPABILITY_SERVICE_SUPPORT); serviceBuilder.requires(support.getCapabilityServiceName(EJB3RemoteResourceDefinition.EJB_REMOTE_CAPABILITY_NAME)); } }); } }); }
@Override protected void setupViewInterceptors(EJBViewDescription view) { // let super do it's job first super.setupViewInterceptors(view); // tx management interceptor(s) addTxManagementInterceptorForView(view); if(view.isEjb2xView()) { view.getConfigurators().add(getSessionBeanObjectViewConfigurator()); } }
ejbObjectClass = classIndex.classIndex(ejbObjectView.getViewClassName()).getModuleClass(); } catch (ClassNotFoundException e) { throw MESSAGES.failedToLoadViewClassForComponent(e, componentDescription.getComponentName());
/** * Returns true if the passed EJB component description has at least one remote view * @param ejbComponentDescription * @return */ private boolean hasRemoteView(final EJBComponentDescription ejbComponentDescription) { final Set<ViewDescription> views = ejbComponentDescription.getViews(); for (final ViewDescription view : views) { if (!(view instanceof EJBViewDescription)) { continue; } final MethodIntf viewType = ((EJBViewDescription) view).getMethodIntf(); if (viewType == MethodIntf.REMOTE || viewType == MethodIntf.HOME) { return true; } } return false; } });
@Override public void configureDependency(final ServiceBuilder<?> serviceBuilder, final ViewService service) throws DeploymentUnitProcessingException { serviceBuilder.addDependency(createdView.getServiceName(), ComponentView.class, factory.getViewToCreate()); } });
private void assertNoRemoteView(final String viewClassName) { EJBViewDescription ejbView = null; for (final ViewDescription view : getViews()) { ejbView = (EJBViewDescription) view; if (viewClassName.equals(ejbView.getViewClassName()) && ejbView.getMethodIntf() == MethodIntf.REMOTE) { throw EjbLogger.ROOT_LOGGER.failToAddClassToLocalView(viewClassName, getEJBName()); } } }
@Override public ViewConfiguration createViewConfiguration(final Class<?> viewClass, final ComponentConfiguration componentConfiguration, final ProxyFactory<?> proxyFactory) { return new EJBViewConfiguration(viewClass, componentConfiguration, getServiceName(), proxyFactory, getMethodIntf()); }
final ClassIndex remoteClass; try { remoteClass = classIndex.classIndex(remoteView.getViewClassName()); } catch (ClassNotFoundException e) { throw MESSAGES.failedToLoadViewClassForComponent(e, componentDescription.getEJBClassName()); final ClassIndex homeClass; try { homeClass = classIndex.classIndex(homeView.getViewClassName()); } catch (ClassNotFoundException e) { throw MESSAGES.failedToLoadViewClassForComponent(e, componentDescription.getEJBClassName()); componentDescription.getEjbRemoteView().getConfigurators().add(new IIOPInterceptorViewConfigurator()); final ServiceBuilder<EjbIIOPService> builder = serviceTarget.addService(componentDescription.getServiceName().append(EjbIIOPService.SERVICE_NAME), service); builder.addDependency(componentDescription.getCreateServiceName(), EJBComponent.class, service.getEjbComponentInjectedValue()); builder.addDependency(homeView.getServiceName(), ComponentView.class, service.getHomeView()); builder.addDependency(remoteView.getServiceName(), ComponentView.class, service.getRemoteView()); builder.addDependency(CorbaORBService.SERVICE_NAME, ORB.class, service.getOrb()); builder.addDependency(POARegistry.SERVICE_NAME, POARegistry.class, service.getPoaRegistry());
for (ViewDescription viewDescription : views) { ejbViewDescription = (EJBViewDescription) viewDescription; if (appclient && ejbViewDescription.getMethodIntf() != MethodIntf.REMOTE && ejbViewDescription.getMethodIntf() != MethodIntf.HOME) { continue; if (!ejbViewDescription.hasJNDIBindings()) continue; final String viewClassName = ejbViewDescription.getViewClassName(); if(ejbViewDescription.getMethodIntf() == MethodIntf.REMOTE || ejbViewDescription.getMethodIntf() == MethodIntf.HOME) { final String remoteJNDIName = remoteExportedJNDIBaseName + "!" + viewClassName; registerRemoteBinding(sessionBean, viewDescription, remoteJNDIName); if (ejbViewDescription.hasJNDIBindings()) {