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; }
final EEApplicationDescription applicationDescription = new EEApplicationDescription(); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription); applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT).getRoot()); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot()); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); final EEApplicationDescription applicationDescription = new EEApplicationDescription(); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot()); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot());
public void resolve(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(EE_APPLICATION_DESCRIPTION); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final Set<String> names = applicationDescription.resolveMessageDestination(messageDestinationName, deploymentRoot.getRoot()); if (names.isEmpty()) { error = EeLogger.ROOT_LOGGER.noMessageDestination(messageDestinationName, bindingName); return; } if (names.size() > 1) { error = EeLogger.ROOT_LOGGER.moreThanOneMessageDestination(messageDestinationName, bindingName, names); return; } resolvedLookupName = names.iterator().next(); }
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 void setupDependencies(final EJBComponentDescription description, final EEApplicationDescription applicationDescription, final ResourceRoot deploymentRoot, final String[] annotationValues) throws DeploymentUnitProcessingException { for (final String annotationValue : annotationValues) { final Set<ComponentDescription> components = applicationDescription.getComponents(annotationValue, deploymentRoot.getRoot()); if (components.isEmpty()) { throw EjbLogger.ROOT_LOGGER.failToFindEjbRefByDependsOn(annotationValue, description.getComponentClassName()); } else if (components.size() != 1) { throw EjbLogger.ROOT_LOGGER.failToCallEjbRefByDependsOn(annotationValue, description.getComponentClassName(), components); } final ComponentDescription component = components.iterator().next(); description.addDependency(component.getStartServiceName()); if (description instanceof SingletonComponentDescription) { ((SingletonComponentDescription)description).getDependsOn().add(component.getStartServiceName()); if (ROOT_LOGGER.isDebugEnabled()) { ROOT_LOGGER.debugf(description.getEJBName() + " bean is dependent on " + component.getComponentName()); } } } } }
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 void setupDependencies(final EJBComponentDescription description, final EEApplicationDescription applicationDescription, final ResourceRoot deploymentRoot, final String[] annotationValues) throws DeploymentUnitProcessingException { for (final String annotationValue : annotationValues) { final Set<ComponentDescription> components = applicationDescription.getComponents(annotationValue, deploymentRoot.getRoot()); if (components.isEmpty()) { throw MESSAGES.failToFindEjbRefByDependsOn(annotationValue, description.getComponentClassName()); } else if (components.size() != 1) { throw MESSAGES.failToCallEjbRefByDependsOn(annotationValue, description.getComponentClassName(), components); } final ComponentDescription component = components.iterator().next(); description.addDependency(component.getStartServiceName(), DependencyType.REQUIRED); if (description instanceof SingletonComponentDescription) { ((SingletonComponentDescription)description).getDependsOn().add(component.getStartServiceName()); if (ROOT_LOGGER.isDebugEnabled()) { ROOT_LOGGER.debugf(description.getEJBName() + " bean is dependent on " + component.getComponentName()); } } } } }
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; }
final EEApplicationDescription applicationDescription = new EEApplicationDescription(); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription); if (earDesc != null) { for (final Map.Entry<String, String> messageDestination : earDesc.getMessageDestinations().entrySet()) { applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT).getRoot()); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot()); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); final EEApplicationDescription applicationDescription = new EEApplicationDescription(); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot()); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot());
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 resolve(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(EE_APPLICATION_DESCRIPTION); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final Set<String> names = applicationDescription.resolveMessageDestination(messageDestinationName, deploymentRoot.getRoot()); if (names.isEmpty()) { error = EeMessages.MESSAGES.noMessageDestination(messageDestinationName, bindingName); return; } if (names.size() > 1) { error = EeMessages.MESSAGES.moreThanOneMessageDestination(messageDestinationName, bindingName, names); return; } resolvedLookupName = names.iterator().next(); }
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(); }
final EEApplicationDescription applicationDescription = new EEApplicationDescription(); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription); applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT).getRoot()); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot()); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); final EEApplicationDescription applicationDescription = new EEApplicationDescription(); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot()); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot());
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 resolve(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(EE_APPLICATION_DESCRIPTION); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final Set<String> names = applicationDescription.resolveMessageDestination(messageDestinationName, deploymentRoot.getRoot()); if (names.isEmpty()) { error = EeLogger.ROOT_LOGGER.noMessageDestination(messageDestinationName, bindingName); return; } if (names.size() > 1) { error = EeLogger.ROOT_LOGGER.moreThanOneMessageDestination(messageDestinationName, bindingName, names); return; } resolvedLookupName = names.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); viewService = applicationDescription.getComponents(ejb.beanName(), ejb.beanInterface().getName(), deploymentRoot); } else { viewService = applicationDescription.getComponents(ejb.beanName(), getType(injectionPoint.getType()).getName(), deploymentRoot);
final EEApplicationDescription applicationDescription = new EEApplicationDescription(); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription); applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.DEPLOYMENT_ROOT).getRoot()); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot()); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); final EEApplicationDescription applicationDescription = new EEApplicationDescription(); deploymentUnit.putAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION, applicationDescription); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot()); applicationDescription.addMessageDestination(messageDestination.getKey(), messageDestination.getValue(), deploymentRoot.getRoot()); applicationDescription.addComponent(componentDescription, deploymentRoot.getRoot());
public void resolve(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(EE_APPLICATION_DESCRIPTION); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); final Set<String> names = applicationDescription.resolveMessageDestination(messageDestinationName, deploymentRoot.getRoot()); if (names.isEmpty()) { error = EeLogger.ROOT_LOGGER.noMessageDestination(messageDestinationName, bindingName); return; } if (names.size() > 1) { error = EeLogger.ROOT_LOGGER.moreThanOneMessageDestination(messageDestinationName, bindingName, names); return; } resolvedLookupName = names.iterator().next(); }