public static Collection findJPAAnnotatedClasses()

in jpa-container/src/main/java/org/apache/aries/jpa/container/parser/impl/JPAAnnotationScanner.java [39:64]


    public static Collection<String> findJPAAnnotatedClasses(Bundle b) {
        BundleWiring bw = b.adapt(BundleWiring.class);
        Collection<String> resources = bw.listResources("/", "*.class", 
            BundleWiring.LISTRESOURCES_LOCAL | BundleWiring.LISTRESOURCES_RECURSE);
        
        Collection<String> classes = new ArrayList<String>(); 
        ClassLoader cl = new TempBundleDelegatingClassLoader(b, JPAAnnotationScanner.class.getClassLoader());
        for(String s : resources) {
          s = s.replace('/', '.').substring(0, s.length() - 6);
          try {
            Class<?> clazz = Class.forName(s, false, cl);
            
            if(clazz.isAnnotationPresent(Entity.class) ||
               clazz.isAnnotationPresent(MappedSuperclass.class) ||
               clazz.isAnnotationPresent(Embeddable.class)) {
              classes.add(s);
            }
            
          } catch (ClassNotFoundException e) {
              logEx(e);
          } catch (NoClassDefFoundError e) {
              logEx(e);
          }
        }
        return classes;
      }