Package org.jboss.aop.annotation

Examples of org.jboss.aop.annotation.AnnotationRepository


      JBossEnterpriseBeanMetaData beanMetaData = null;     
      String canonicalObjectName = "GreeterBean";
      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
     
      AnnotationRepositoryToMetaData delegate = new AnnotationRepositoryToMetaData(beanClass, beanMetaData, canonicalObjectName, classLoader);
      AnnotationRepository repository = new CachingAnnotationRepository(delegate, classLoader);
     
      Method member = beanClass.getDeclaredMethod("sayHi", String.class);
      String annotation = "javax.interceptor.Interceptors";
      String value = "@javax.interceptor.Interceptors (value={" + DummyInterceptor.class.getName() + ".class})";
      repository.addAnnotation(member, annotation, value);
     
      Interceptors interceptors = (Interceptors) repository.resolveAnnotation(member, Interceptors.class);
      assertArrayEquals(new Class[] { DummyInterceptor.class }, interceptors.value());
   }
View Full Code Here


      {
         addSimpleJndiAnnotations(container, enterpriseBean);
         return;
      }

      AnnotationRepository annotations = container.getAnnotations();

      annotations.disableAnnotation(RemoteBinding.class.getName());

      List<RemoteBindingImpl> bindingAnnotationsList = new ArrayList<RemoteBindingImpl>();

      for(RemoteBindingMetaData binding : bindingsList)
      {
View Full Code Here

  
   private void addAnnotations(Class<? extends Annotation> annotationClass, Annotation annotation, EJBContainer container, String methodName, MethodParametersMetaData params)
   {
      try
      {
         AnnotationRepository annotations = container.getAnnotations();
         if (methodName.equals("*"))
         {
            log.debug("adding " + annotationClass.getName() + " annotation to "
                  + ejbClass.getName() + "." + methodName);
  
            for (java.lang.reflect.Method declaredMethod : ejbClass
                  .getDeclaredMethods())
            {
               annotations.addAnnotation(declaredMethod, annotationClass,
                     annotation);
               overrideAnnotations(container, declaredMethod, annotationClass
                     .getName(), annotation);
            }
         } else
         {
            if (params == null)
            {
               java.lang.reflect.Method[] methods = ejbClass.getMethods();
               boolean foundMethod = false;
               for (int methodIndex = 0; methodIndex < methods.length; ++methodIndex)
               {
                  if (methods[methodIndex].getName().equals(methodName))
                  {
                     log.debug("adding " + annotationClass.getName()
                           + " method annotation to " + methods[methodIndex]);
                     annotations.addAnnotation(methods[methodIndex],
                           annotationClass, annotation);
                     overrideAnnotations(container, methods[methodIndex],
                           annotationClass.getName(), annotation);
                     foundMethod = true;
  
                  }
               }
  
               if (!foundMethod)
               {
                  methods = ejbClass.getDeclaredMethods();
                  for (int methodIndex = 0; methodIndex < methods.length; ++methodIndex)
                  {
                     if (methods[methodIndex].getName().equals(methodName))
                     {
                        log.debug("adding " + annotationClass.getName()
                              + " method annotation to " + methods[methodIndex]);
                        annotations.addAnnotation(methods[methodIndex],
                              annotationClass, annotation);
                        overrideAnnotations(container, methods[methodIndex],
                              annotationClass.getName(), annotation);
                        foundMethod = true;
  
                     }
                  }
               }
  
               if (!foundMethod)
               {
                  java.lang.reflect.Field member = ejbClass
                        .getDeclaredField(methodName);
                  if (member != null)
                  {
                     log.debug("adding " + annotationClass.getName()
                           + " field annotation to " + member);
                     annotations
                           .addAnnotation(member, annotationClass, annotation);
                     overrideAnnotations(container, member, annotationClass
                           .getName(), annotation);
                  }
               }
            } else
            {
               Class<?>[] methodSignature = new Class[params.size()];
               int paramIndex = 0;
               for(String param : params)
               {
                  Class<?> paramClass = PrimitiveClassLoadingUtil.loadClass(param, di.getClassLoader());
                  methodSignature[paramIndex++] = paramClass;
               }
               if(log.isTraceEnabled())
                  log.trace("Looking for method " + methodName + Arrays.toString(methodSignature) + " on class " + ejbClass);
               Member member = ClassHelper.getPrivateMethod(ejbClass, methodName, methodSignature);
               log.debug("adding " + annotationClass.getName()
                     + " method annotation to " + member);
               annotations.addAnnotation(member, annotationClass, annotation);
               overrideAnnotations(container, member, annotationClass.getName(),
                     annotation);
            }
         }
      }
View Full Code Here

      {
         addSimpleJndiAnnotations(container, enterpriseBean);
         return;
      }

      AnnotationRepository annotations = container.getAnnotations();

      annotations.disableAnnotation(RemoteBinding.class.getName());

      List<RemoteBindingImpl> bindingAnnotationsList = new ArrayList<RemoteBindingImpl>();

      for(RemoteBindingMetaData binding : bindingsList)
      {
View Full Code Here

  
   private void addAnnotations(Class<? extends Annotation> annotationClass, Annotation annotation, EJBContainer container, String methodName, MethodParametersMetaData params)
   {
      try
      {
         AnnotationRepository annotations = container.getAnnotations();
         if (methodName.equals("*"))
         {
            log.debug("adding " + annotationClass.getName() + " annotation to "
                  + ejbClass.getName() + "." + methodName);
  
            for (java.lang.reflect.Method declaredMethod : ejbClass
                  .getDeclaredMethods())
            {
               annotations.addAnnotation(declaredMethod, annotationClass,
                     annotation);
               overrideAnnotations(container, declaredMethod, annotationClass
                     .getName(), annotation);
            }
         } else
         {
            if (params == null)
            {
               java.lang.reflect.Method[] methods = ejbClass.getMethods();
               boolean foundMethod = false;
               for (int methodIndex = 0; methodIndex < methods.length; ++methodIndex)
               {
                  if (methods[methodIndex].getName().equals(methodName))
                  {
                     log.debug("adding " + annotationClass.getName()
                           + " method annotation to " + methods[methodIndex]);
                     annotations.addAnnotation(methods[methodIndex],
                           annotationClass, annotation);
                     overrideAnnotations(container, methods[methodIndex],
                           annotationClass.getName(), annotation);
                     foundMethod = true;
  
                  }
               }
  
               if (!foundMethod)
               {
                  methods = ejbClass.getDeclaredMethods();
                  for (int methodIndex = 0; methodIndex < methods.length; ++methodIndex)
                  {
                     if (methods[methodIndex].getName().equals(methodName))
                     {
                        log.debug("adding " + annotationClass.getName()
                              + " method annotation to " + methods[methodIndex]);
                        annotations.addAnnotation(methods[methodIndex],
                              annotationClass, annotation);
                        overrideAnnotations(container, methods[methodIndex],
                              annotationClass.getName(), annotation);
                        foundMethod = true;
  
                     }
                  }
               }
  
               if (!foundMethod)
               {
                  java.lang.reflect.Field member = ejbClass
                        .getDeclaredField(methodName);
                  if (member != null)
                  {
                     log.debug("adding " + annotationClass.getName()
                           + " field annotation to " + member);
                     annotations
                           .addAnnotation(member, annotationClass, annotation);
                     overrideAnnotations(container, member, annotationClass
                           .getName(), annotation);
                  }
               }
            } else
            {
               Class<?>[] methodSignature = new Class[params.size()];
               int paramIndex = 0;
               for(String param : params)
               {
                  Class<?> paramClass = PrimitiveClassLoadingUtil.loadClass(param, di.getClassLoader());
                  methodSignature[paramIndex++] = paramClass;
               }
               if(log.isTraceEnabled())
                  log.trace("Looking for method " + methodName + Arrays.toString(methodSignature) + " on class " + ejbClass);
               Member member = ClassHelper.getPrivateMethod(ejbClass, methodName, methodSignature);
               log.debug("adding " + annotationClass.getName()
                     + " method annotation to " + member);
               annotations.addAnnotation(member, annotationClass, annotation);
               overrideAnnotations(container, member, annotationClass.getName(),
                     annotation);
            }
         }
      }
View Full Code Here

      {
         addSimpleJndiAnnotations(container, enterpriseBean);
         return;
      }

      AnnotationRepository annotations = container.getAnnotations();

      annotations.disableAnnotation(RemoteBinding.class.getName());

      List<RemoteBindingImpl> bindingAnnotationsList = new ArrayList<RemoteBindingImpl>();

      for(RemoteBindingMetaData binding : bindingsList)
      {
View Full Code Here

  
   private void addAnnotations(Class<? extends Annotation> annotationClass, Annotation annotation, EJBContainer container, String methodName, MethodParametersMetaData params)
   {
      try
      {
         AnnotationRepository annotations = container.getAnnotations();
         if (methodName.equals("*"))
         {
            log.debug("adding " + annotationClass.getName() + " annotation to "
                  + ejbClass.getName() + "." + methodName);
  
            for (java.lang.reflect.Method declaredMethod : ejbClass
                  .getDeclaredMethods())
            {
               annotations.addAnnotation(declaredMethod, annotationClass,
                     annotation);
               overrideAnnotations(container, declaredMethod, annotationClass
                     .getName(), annotation);
            }
         } else
         {
            if (params == null)
            {
               java.lang.reflect.Method[] methods = ejbClass.getMethods();
               boolean foundMethod = false;
               for (int methodIndex = 0; methodIndex < methods.length; ++methodIndex)
               {
                  if (methods[methodIndex].getName().equals(methodName))
                  {
                     log.debug("adding " + annotationClass.getName()
                           + " method annotation to " + methods[methodIndex]);
                     annotations.addAnnotation(methods[methodIndex],
                           annotationClass, annotation);
                     overrideAnnotations(container, methods[methodIndex],
                           annotationClass.getName(), annotation);
                     foundMethod = true;
  
                  }
               }
  
               if (!foundMethod)
               {
                  methods = ejbClass.getDeclaredMethods();
                  for (int methodIndex = 0; methodIndex < methods.length; ++methodIndex)
                  {
                     if (methods[methodIndex].getName().equals(methodName))
                     {
                        log.debug("adding " + annotationClass.getName()
                              + " method annotation to " + methods[methodIndex]);
                        annotations.addAnnotation(methods[methodIndex],
                              annotationClass, annotation);
                        overrideAnnotations(container, methods[methodIndex],
                              annotationClass.getName(), annotation);
                        foundMethod = true;
  
                     }
                  }
               }
  
               if (!foundMethod)
               {
                  java.lang.reflect.Field member = ejbClass
                        .getDeclaredField(methodName);
                  if (member != null)
                  {
                     log.debug("adding " + annotationClass.getName()
                           + " field annotation to " + member);
                     annotations
                           .addAnnotation(member, annotationClass, annotation);
                     overrideAnnotations(container, member, annotationClass
                           .getName(), annotation);
                  }
               }
            } else
            {
               Class<?>[] methodSignature = new Class[params.size()];
               int paramIndex = 0;
               for(String param : params)
               {
                  Class<?> paramClass = null;
                  if (param.equals("boolean"))
                     paramClass = boolean.class;
                  else if (param.equals("int"))
                     paramClass = int.class;
                  else if (param.equals("long"))
                     paramClass = long.class;
                  else if (param.equals("short"))
                     paramClass = short.class;
                  else if (param.equals("byte"))
                     paramClass = byte.class;
                  else if (param.equals("char"))
                     paramClass = char.class;
                  else
                     paramClass = di.getClassLoader().loadClass(param);
                  methodSignature[paramIndex++] = paramClass;
               }
               if(log.isTraceEnabled())
                  log.trace("Looking for method " + methodName + Arrays.toString(methodSignature) + " on class " + ejbClass);
               Member member = ClassHelper.getPrivateMethod(ejbClass, methodName, methodSignature);
               log.debug("adding " + annotationClass.getName()
                     + " method annotation to " + member);
               annotations.addAnnotation(member, annotationClass, annotation);
               overrideAnnotations(container, member, annotationClass.getName(),
                     annotation);
            }
         }
      }
View Full Code Here

      {
         addSimpleJndiAnnotations(container, enterpriseBean);
         return;
      }

      AnnotationRepository annotations = container.getAnnotations();

      annotations.disableAnnotation(RemoteBinding.class.getName());

      List<RemoteBindingImpl> bindingAnnotationsList = new ArrayList<RemoteBindingImpl>();

      for(RemoteBindingMetaData binding : bindingsList)
      {
View Full Code Here

  
   private void addAnnotations(Class<? extends Annotation> annotationClass, Annotation annotation, EJBContainer container, String methodName, MethodParametersMetaData params)
   {
      try
      {
         AnnotationRepository annotations = container.getAnnotations();
         if (methodName.equals("*"))
         {
            log.debug("adding " + annotationClass.getName() + " annotation to "
                  + ejbClass.getName() + "." + methodName);
  
            for (java.lang.reflect.Method declaredMethod : ejbClass
                  .getDeclaredMethods())
            {
               annotations.addAnnotation(declaredMethod, annotationClass,
                     annotation);
               overrideAnnotations(container, declaredMethod, annotationClass
                     .getName(), annotation);
            }
         } else
         {
            if (params == null)
            {
               java.lang.reflect.Method[] methods = ejbClass.getMethods();
               boolean foundMethod = false;
               for (int methodIndex = 0; methodIndex < methods.length; ++methodIndex)
               {
                  if (methods[methodIndex].getName().equals(methodName))
                  {
                     log.debug("adding " + annotationClass.getName()
                           + " method annotation to " + methods[methodIndex]);
                     annotations.addAnnotation(methods[methodIndex],
                           annotationClass, annotation);
                     overrideAnnotations(container, methods[methodIndex],
                           annotationClass.getName(), annotation);
                     foundMethod = true;
  
                  }
               }
  
               if (!foundMethod)
               {
                  methods = ejbClass.getDeclaredMethods();
                  for (int methodIndex = 0; methodIndex < methods.length; ++methodIndex)
                  {
                     if (methods[methodIndex].getName().equals(methodName))
                     {
                        log.debug("adding " + annotationClass.getName()
                              + " method annotation to " + methods[methodIndex]);
                        annotations.addAnnotation(methods[methodIndex],
                              annotationClass, annotation);
                        overrideAnnotations(container, methods[methodIndex],
                              annotationClass.getName(), annotation);
                        foundMethod = true;
  
                     }
                  }
               }
  
               if (!foundMethod)
               {
                  java.lang.reflect.Field member = ejbClass
                        .getDeclaredField(methodName);
                  if (member != null)
                  {
                     log.debug("adding " + annotationClass.getName()
                           + " field annotation to " + member);
                     annotations
                           .addAnnotation(member, annotationClass, annotation);
                     overrideAnnotations(container, member, annotationClass
                           .getName(), annotation);
                  }
               }
            } else
            {
               Class<?>[] methodSignature = new Class[params.size()];
               int paramIndex = 0;
               for(String param : params)
               {
                  Class<?> paramClass = new PrimitiveAwareClassLoader(di.getClassLoader()).loadClass(param);
                  methodSignature[paramIndex++] = paramClass;
               }
               if(log.isTraceEnabled())
                  log.trace("Looking for method " + methodName + Arrays.toString(methodSignature) + " on class " + ejbClass);
               Member member = ClassHelper.getPrivateMethod(ejbClass, methodName, methodSignature);
               log.debug("adding " + annotationClass.getName()
                     + " method annotation to " + member);
               annotations.addAnnotation(member, annotationClass, annotation);
               overrideAnnotations(container, member, annotationClass.getName(),
                     annotation);
            }
         }
      }
View Full Code Here

      {
         addSimpleJndiAnnotations(container, enterpriseBean);
         return;
      }

      AnnotationRepository annotations = container.getAnnotations();

      annotations.disableAnnotation(RemoteBinding.class.getName());

      List<RemoteBindingImpl> bindingAnnotationsList = new ArrayList<RemoteBindingImpl>();

      for(RemoteBindingMetaData binding : bindingsList)
      {
View Full Code Here

TOP

Related Classes of org.jboss.aop.annotation.AnnotationRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.