Package org.jboss.aop.annotation

Examples of org.jboss.aop.annotation.AnnotationRepository


/*      */
/*      */   private void addAnnotations(Class<? extends Annotation> annotationClass, Annotation annotation, EJBContainer container, String methodName, MethodParametersMetaData params)
/*      */   {
/*      */     try
/*      */     {
/* 2065 */       AnnotationRepository annotations = container.getAnnotations();
/* 2066 */       if (methodName.equals("*"))
/*      */       {
/* 2068 */         log.debug("adding " + annotationClass.getName() + " annotation to " + this.ejbClass.getName() + "." + methodName);
/*      */
/* 2071 */         for (Method declaredMethod : this.ejbClass.getDeclaredMethods())
/*      */         {
/* 2074 */           annotations.addAnnotation(declaredMethod, annotationClass, annotation);
/*      */
/* 2076 */           overrideAnnotations(container, declaredMethod, annotationClass.getName(), annotation);
/*      */         }
/*      */
/*      */       }
/* 2081 */       else if (params == null)
/*      */       {
/* 2083 */         Method[] methods = this.ejbClass.getMethods();
/* 2084 */         boolean foundMethod = false;
/* 2085 */         for (int methodIndex = 0; methodIndex < methods.length; methodIndex++)
/*      */         {
/* 2087 */           if (!methods[methodIndex].getName().equals(methodName))
/*      */             continue;
/* 2089 */           log.debug("adding " + annotationClass.getName() + " method annotation to " + methods[methodIndex]);
/*      */
/* 2091 */           annotations.addAnnotation(methods[methodIndex], annotationClass, annotation);
/*      */
/* 2093 */           overrideAnnotations(container, methods[methodIndex], annotationClass.getName(), annotation);
/*      */
/* 2095 */           foundMethod = true;
/*      */         }
/*      */
/* 2100 */         if (!foundMethod)
/*      */         {
/* 2102 */           methods = this.ejbClass.getDeclaredMethods();
/* 2103 */           for (int methodIndex = 0; methodIndex < methods.length; methodIndex++)
/*      */           {
/* 2105 */             if (!methods[methodIndex].getName().equals(methodName))
/*      */               continue;
/* 2107 */             log.debug("adding " + annotationClass.getName() + " method annotation to " + methods[methodIndex]);
/*      */
/* 2109 */             annotations.addAnnotation(methods[methodIndex], annotationClass, annotation);
/*      */
/* 2111 */             overrideAnnotations(container, methods[methodIndex], annotationClass.getName(), annotation);
/*      */
/* 2113 */             foundMethod = true;
/*      */           }
/*      */
/*      */         }
/*      */
/* 2119 */         if (!foundMethod)
/*      */         {
/* 2121 */           Field member = this.ejbClass.getDeclaredField(methodName);
/*      */
/* 2123 */           if (member != null)
/*      */           {
/* 2125 */             log.debug("adding " + annotationClass.getName() + " field annotation to " + member);
/*      */
/* 2127 */             annotations.addAnnotation(member, annotationClass, annotation);
/*      */
/* 2129 */             overrideAnnotations(container, member, annotationClass.getName(), annotation);
/*      */           }
/*      */         }
/*      */       }
/*      */       else
/*      */       {
/* 2135 */         Class[] methodSignature = new Class[params.size()];
/* 2136 */         int paramIndex = 0;
/* 2137 */         for (String param : params)
/*      */         {
/* 2139 */           Class paramClass = null;
/* 2140 */           if (param.equals("boolean"))
/* 2141 */             paramClass = Boolean.TYPE;
/* 2142 */           else if (param.equals("int"))
/* 2143 */             paramClass = Integer.TYPE;
/* 2144 */           else if (param.equals("long"))
/* 2145 */             paramClass = Long.TYPE;
/* 2146 */           else if (param.equals("short"))
/* 2147 */             paramClass = Short.TYPE;
/* 2148 */           else if (param.equals("byte"))
/* 2149 */             paramClass = Byte.TYPE;
/* 2150 */           else if (param.equals("char"))
/* 2151 */             paramClass = Character.TYPE;
/*      */           else
/* 2153 */             paramClass = this.di.getClassLoader().loadClass(param);
/* 2154 */           methodSignature[(paramIndex++)] = paramClass;
/*      */         }
/* 2156 */         if (log.isTraceEnabled())
/* 2157 */           log.trace("Looking for method " + methodName + Arrays.toString(methodSignature) + " on class " + this.ejbClass);
/* 2158 */         Member member = ClassHelper.getPrivateMethod(this.ejbClass, methodName, methodSignature);
/* 2159 */         log.debug("adding " + annotationClass.getName() + " method annotation to " + member);
/*      */
/* 2161 */         annotations.addAnnotation(member, annotationClass, annotation);
/* 2162 */         overrideAnnotations(container, member, annotationClass.getName(), annotation);
/*      */       }
/*      */
/*      */     }
/*      */     catch (Exception e)
View Full Code Here


/*      */     {
/* 1769 */       addSimpleJndiAnnotations(container, enterpriseBean);
/* 1770 */       return;
/*      */     }
/*      */
/* 1773 */     AnnotationRepository annotations = container.getAnnotations();
/*      */
/* 1775 */     annotations.disableAnnotation(RemoteBinding.class.getName());
/*      */
/* 1777 */     List bindingAnnotationsList = new ArrayList();
/*      */
/* 1779 */     for (RemoteBindingMetaData binding : bindingsList)
/*      */     {
View Full Code Here

/*      */     }
/*      */   }
/*      */
/*      */   protected void overrideAnnotations(EJBContainer container, Member m, String annotation, Object value)
/*      */   {
/* 2025 */     AnnotationRepository annotations = container.getAnnotations();
/*      */
/* 2027 */     if ((value instanceof DenyAll))
/*      */     {
/* 2029 */       annotations.disableAnnotation(m, PermitAll.class.getName());
/*      */
/* 2031 */       annotations.disableAnnotation(m, RolesAllowed.class.getName());
/*      */     }
/* 2033 */     else if ((value instanceof PermitAll))
/*      */     {
/* 2035 */       annotations.disableAnnotation(m, DenyAll.class.getName());
/*      */
/* 2037 */       annotations.disableAnnotation(m, RolesAllowed.class.getName());
/*      */     }
/* 2039 */     else if ((value instanceof RolesAllowed))
/*      */     {
/* 2041 */       annotations.disableAnnotation(m, PermitAll.class.getName());
/*      */
/* 2043 */       annotations.disableAnnotation(m, DenyAll.class.getName());
/*      */     }
/*      */   }
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 = 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

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.