/**
   * Check the deployment annotation index for all classes with the @PersistenceContext annotation.
   * For each class with the annotation, collect all the required information to create a managed
   * bean instance, and attach it to the context.
   *
   * @param phaseContext the deployment unit context
   * @throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
   */
  protected void processComponentConfig(
      final DeploymentUnit deploymentUnit,
      final DeploymentPhaseContext phaseContext,
      final CompositeIndex compositeIndex,
      final AbstractComponentDescription componentDescription)
      throws DeploymentUnitProcessingException {

    final ClassInfo classInfo =
        compositeIndex.getClassByName(
            DotName.createSimple(componentDescription.getComponentClassName()));
    if (classInfo == null) {
      return; // We can't continue without the annotation index info.
    }
    componentDescription
        .getBindings()
        .addAll(getConfigurations(deploymentUnit, classInfo, componentDescription, phaseContext));
    final Collection<InterceptorDescription> interceptorConfigurations =
        componentDescription.getAllInterceptors().values();
    for (InterceptorDescription interceptorConfiguration : interceptorConfigurations) {
      final ClassInfo interceptorClassInfo =
          compositeIndex.getClassByName(
              DotName.createSimple(interceptorConfiguration.getInterceptorClassName()));
      if (interceptorClassInfo == null) {
        continue;
      }
      interceptorConfiguration
          .getBindings()
          .addAll(
              getConfigurations(
                  deploymentUnit, interceptorClassInfo, componentDescription, phaseContext));
    }
  }
  private String getMessageListenerInterface(
      final CompositeIndex compositeIndex, final AnnotationInstance messageBeanAnnotation)
      throws DeploymentUnitProcessingException {
    final AnnotationValue value = messageBeanAnnotation.value("messageListenerInterface");
    if (value != null) return value.asClass().name().toString();
    final ClassInfo beanClass = (ClassInfo) messageBeanAnnotation.target();
    final Set<DotName> interfaces = new HashSet<DotName>(getPotentialViewInterfaces(beanClass));
    // check super class(es) of the bean
    DotName superClassDotName = beanClass.superName();
    while (interfaces.isEmpty()
        && superClassDotName != null
        && !superClassDotName.toString().equals(Object.class.getName())) {
      final ClassInfo superClass = compositeIndex.getClassByName(superClassDotName);
      if (superClass == null) {
        break;
      }
      interfaces.addAll(getPotentialViewInterfaces(superClass));
      // move to next super class
      superClassDotName = superClass.superName();
    }

    if (interfaces.size() != 1)
      throw MESSAGES.mdbDoesNotImplementNorSpecifyMessageListener(beanClass);
    return interfaces.iterator().next().toString();
  }
Beispiel #3
0
 public static boolean isJaxwsService(final ClassInfo current, final CompositeIndex index) {
   ClassInfo tmp = current;
   while (tmp != null) {
     final DotName superName = tmp.superName();
     if (JAXWS_SERVICE_CLASS.equals(superName)) {
       return true;
     }
     tmp = index.getClassByName(superName);
   }
   return false;
 }
 private SessionType determineSessionType(
     final String ejbClass, final CompositeIndex compositeIndex) {
   if (ejbClass == null) {
     return null;
   }
   final ClassInfo info = compositeIndex.getClassByName(DotName.createSimple(ejbClass));
   if (info == null) {
     return null;
   }
   if (info.annotations().get(STATEFUL_ANNOTATION) != null) {
     return SessionType.Stateful;
   } else if (info.annotations().get(STATELESS_ANNOTATION) != null) {
     return SessionType.Stateless;
   } else if (info.annotations().get(SINGLETON_ANNOTATION) != null) {
     return SessionType.Singleton;
   }
   return null;
 }