public void getResourceValue(final ResolutionContext resolutionContext, final ServiceBuilder<?> serviceBuilder, final DeploymentPhaseContext phaseContext, final Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(EE_APPLICATION_DESCRIPTION); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final Set<ViewDescription> componentsForViewName = applicationDescription.getComponentsForViewName(typeName, deploymentRoot.getRoot()); final Iterator<ViewDescription> iterator = componentsForViewName.iterator(); if (!iterator.hasNext()) { throw EeLogger.ROOT_LOGGER.componentNotFound(typeName); } final ViewDescription description = iterator.next(); if (iterator.hasNext()) { throw EeLogger.ROOT_LOGGER.multipleComponentsFound(typeName); } //TODO: should ComponentView also be a managed reference factory? serviceBuilder.addDependency(description.getServiceName(), ComponentView.class, new ViewManagedReferenceFactory.Injector(injector)); }
private Set<ViewDescription> getViews() { final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(EE_APPLICATION_DESCRIPTION); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final Set<ViewDescription> componentsForViewName; if (beanName != null) { componentsForViewName = applicationDescription.getComponents(beanName, typeName, deploymentRoot.getRoot()); } else { componentsForViewName = applicationDescription.getComponentsForViewName(typeName, deploymentRoot.getRoot()); } return componentsForViewName; }
public void getResourceValue(final ResolutionContext resolutionContext, final ServiceBuilder<?> serviceBuilder, final DeploymentPhaseContext phaseContext, final Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(EE_APPLICATION_DESCRIPTION); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final Set<ViewDescription> componentsForViewName = applicationDescription.getComponentsForViewName(typeName, deploymentRoot.getRoot()); final Iterator<ViewDescription> iterator = componentsForViewName.iterator(); if (!iterator.hasNext()) { throw EeLogger.ROOT_LOGGER.componentNotFound(typeName); } final ViewDescription description = iterator.next(); if (iterator.hasNext()) { throw EeLogger.ROOT_LOGGER.multipleComponentsFound(typeName); } //TODO: should ComponentView also be a managed reference factory? serviceBuilder.addDependency(description.getServiceName(), ComponentView.class, new ViewManagedReferenceFactory.Injector(injector)); }
public void getResourceValue(final ResolutionContext resolutionContext, final ServiceBuilder<?> serviceBuilder, final DeploymentPhaseContext phaseContext, final Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(EE_APPLICATION_DESCRIPTION); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final Set<ViewDescription> componentsForViewName = applicationDescription.getComponentsForViewName(typeName, deploymentRoot.getRoot()); final Iterator<ViewDescription> iterator = componentsForViewName.iterator(); if (!iterator.hasNext()) { throw MESSAGES.componentNotFound(typeName); } final ViewDescription description = iterator.next(); if (iterator.hasNext()) { throw MESSAGES.multipleComponentsFound(typeName); } //TODO: should ComponentView also be a managed reference factory? serviceBuilder.addDependency(description.getServiceName(), ComponentView.class, new ViewManagedReferenceFactory.Injector(injector)); }
public void getResourceValue(final ResolutionContext resolutionContext, final ServiceBuilder<?> serviceBuilder, final DeploymentPhaseContext phaseContext, final Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(EE_APPLICATION_DESCRIPTION); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT); final Set<ViewDescription> componentsForViewName = applicationDescription.getComponentsForViewName(typeName, deploymentRoot.getRoot()); final Iterator<ViewDescription> iterator = componentsForViewName.iterator(); if (!iterator.hasNext()) { throw EeLogger.ROOT_LOGGER.componentNotFound(typeName); } final ViewDescription description = iterator.next(); if (iterator.hasNext()) { throw EeLogger.ROOT_LOGGER.multipleComponentsFound(typeName); } //TODO: should ComponentView also be a managed reference factory? serviceBuilder.addDependency(description.getServiceName(), ComponentView.class, new ViewManagedReferenceFactory.Injector(injector)); }
private Set<ViewDescription> getViews() { final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(EE_APPLICATION_DESCRIPTION); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final Set<ViewDescription> componentsForViewName; if (beanName != null) { componentsForViewName = applicationDescription.getComponents(beanName, typeName, deploymentRoot.getRoot()); } else { componentsForViewName = applicationDescription.getComponentsForViewName(typeName, deploymentRoot.getRoot()); } return componentsForViewName; }
private ViewDescription getViewDescription(EJB ejb, InjectionPoint injectionPoint) { final Set<ViewDescription> viewService; if (ejb.beanName().isEmpty()) { if (ejb.beanInterface() != Object.class) { viewService = applicationDescription.getComponentsForViewName(ejb.beanInterface().getName(), deploymentRoot); } else { viewService = applicationDescription.getComponentsForViewName(getType(injectionPoint.getType()).getName(), deploymentRoot); } } else { if (ejb.beanInterface() != Object.class) { viewService = applicationDescription.getComponents(ejb.beanName(), ejb.beanInterface().getName(), deploymentRoot); } else { viewService = applicationDescription.getComponents(ejb.beanName(), getType(injectionPoint.getType()).getName(), deploymentRoot); } } if (injectionPoint.getAnnotated().isAnnotationPresent(Produces.class)) { if (viewService.isEmpty()) { throw WeldLogger.ROOT_LOGGER.ejbNotResolved(ejb, injectionPoint.getMember()); } else if (viewService.size() > 1) { throw WeldLogger.ROOT_LOGGER.moreThanOneEjbResolved(ejb, injectionPoint.getMember(), viewService); } } else { if (viewService.isEmpty()) { return null; } else if (viewService.size() > 1) { return null; } } return viewService.iterator().next(); }
if (ejb.beanName().isEmpty()) { if (ejb.beanInterface() != Object.class) { viewService = applicationDescription.getComponentsForViewName(ejb.beanInterface().getName(), deploymentRoot); } else { viewService = applicationDescription.getComponentsForViewName(getType(injectionPoint.getType()).getName(), deploymentRoot);