private  Set<Class<?>> getInterfaces(Bundle bundle) {
        ServiceReference ref = bundleContext.getServiceReference(PackageAdmin.class.getName());
        PackageAdmin pa = (PackageAdmin) ref;
        ExportedPackage[] packages = pa.getExportedPackages(bundle);
        Set<Class<?>> interfaceClasses = new HashSet<Class<?>>();
        for (ExportedPackage ePackage : packages) {
            String packageName = ePackage.getName();
            String packagePath = "/" + packageName.replace('.', '/');
            // find all the class files in current exported package
            Enumeration<URL> clazzes = bundle.findEntries(packagePath, "*.class", false);
            
            while (clazzes.hasMoreElements()) {
                URL url = clazzes.nextElement();
                String path = url.getPath();
                int index = path.lastIndexOf("/");
                int endIndex = path.length() - 6;// Strip ".class" substring
                String className = path.substring(index + 1, endIndex);
                String fullClassName = packageName + "." + className;
                try {
                    Class<?> clazz = bundle.loadClass(fullClassName);
                    if(clazz.isInterface()) {
                        interfaceClasses.add(clazz);
                    }
                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                }

            }
        }
        return interfaceClasses;
    }