@Override
 public boolean hasPermission(Object permission) {
   Generation current = (Generation) module.getCurrentRevision().getRevisionInfo();
   ProtectionDomain domain = current.getDomain();
   if (domain != null) {
     if (permission instanceof Permission) {
       SecurityManager sm = System.getSecurityManager();
       if (sm instanceof EquinoxSecurityManager) {
         /*
          * If the FrameworkSecurityManager is active, we need to do checks the "right" way.
          * We can exploit our knowledge that the security context of FrameworkSecurityManager
          * is an AccessControlContext to invoke it properly with the ProtectionDomain.
          */
         AccessControlContext acc = new AccessControlContext(new ProtectionDomain[] {domain});
         try {
           sm.checkPermission((Permission) permission, acc);
           return true;
         } catch (Exception e) {
           return false;
         }
       }
       return domain.implies((Permission) permission);
     }
     return false;
   }
   return true;
 }
 /** Check for permission to get a service. */
 private <A> void checkAdaptPermission(Class<A> adapterType) {
   SecurityManager sm = System.getSecurityManager();
   if (sm == null) {
     return;
   }
   sm.checkPermission(new AdaptPermission(adapterType.getName(), this, AdaptPermission.ADAPT));
 }
  private String findLibrary0(String libname) {
    String path = null;
    List<ClassLoaderHook> hooks =
        generation
            .getBundleInfo()
            .getStorage()
            .getConfiguration()
            .getHookRegistry()
            .getClassLoaderHooks();
    for (ClassLoaderHook hook : hooks) {
      path = hook.findLocalLibrary(generation, libname);
      if (path != null) {
        return path;
      }
    }
    String mappedName = System.mapLibraryName(libname);
    String[] altMappedNames = mapLibraryNames(mappedName);

    // first check Bundle-NativeCode header
    path = findBundleNativeCode(libname, mappedName, altMappedNames);
    // next check eclipse specific support
    return path != null ? path : findEclipseNativeCode(libname, mappedName, altMappedNames);
  }