コード例 #1
0
 @Override
 public URL getEntry(String path) {
   try {
     equinoxContainer.checkAdminPermission(this, AdminPermission.RESOURCE);
   } catch (SecurityException e) {
     return null;
   }
   checkValid();
   Generation current = (Generation) getModule().getCurrentRevision().getRevisionInfo();
   return current.getEntry(path);
 }
コード例 #2
0
 @Override
 public Enumeration<URL> findEntries(String path, String filePattern, boolean recurse) {
   try {
     equinoxContainer.checkAdminPermission(this, AdminPermission.RESOURCE);
   } catch (SecurityException e) {
     return null;
   }
   checkValid();
   resolve();
   return Storage.findEntries(
       getGenerations(), path, filePattern, recurse ? BundleWiring.FINDENTRIES_RECURSE : 0);
 }
コード例 #3
0
  @Override
  public URL getResource(String name) {
    try {
      equinoxContainer.checkAdminPermission(this, AdminPermission.RESOURCE);
    } catch (SecurityException e) {
      return null;
    }
    checkValid();
    if (isFragment()) {
      return null;
    }

    ModuleClassLoader classLoader = getModuleClassLoader(false);
    if (classLoader != null) {
      return classLoader.getResource(name);
    }

    return new ClasspathManager((Generation) module.getCurrentRevision().getRevisionInfo(), null)
        .findLocalResource(name);
  }
コード例 #4
0
 @Override
 public Enumeration<URL> getResources(String name) throws IOException {
   try {
     equinoxContainer.checkAdminPermission(this, AdminPermission.RESOURCE);
   } catch (SecurityException e) {
     return null;
   }
   checkValid();
   if (isFragment()) {
     return null;
   }
   ModuleClassLoader classLoader = getModuleClassLoader(false);
   Enumeration<URL> result = null;
   if (classLoader != null) {
     result = classLoader.getResources(name);
   } else {
     result =
         new ClasspathManager((Generation) module.getCurrentRevision().getRevisionInfo(), null)
             .findLocalResources(name);
   }
   return result != null && result.hasMoreElements() ? result : null;
 }
コード例 #5
0
 @Override
 public Class<?> loadClass(String name) throws ClassNotFoundException {
   try {
     equinoxContainer.checkAdminPermission(this, AdminPermission.CLASS);
   } catch (SecurityException e) {
     throw new ClassNotFoundException(name, e);
   }
   checkValid();
   if (isFragment()) {
     throw new ClassNotFoundException(
         "Can not load a class from a fragment bundle: " + this); // $NON-NLS-1$
   }
   try {
     ModuleClassLoader classLoader = getModuleClassLoader(true);
     if (classLoader != null) {
       if (name.length() > 0 && name.charAt(0) == '[')
         return Class.forName(name, false, classLoader);
       return classLoader.loadClass(name);
     }
   } catch (ClassNotFoundException e) {
     // This is an equinox-ism.  Not sure it is worth it to offer an option to disable ...
     // On failure attempt to activate lazy activating bundles.
     if (State.LAZY_STARTING.equals(module.getState())) {
       try {
         module.start(StartOptions.LAZY_TRIGGER);
       } catch (BundleException e1) {
         equinoxContainer
             .getLogServices()
             .log(EquinoxContainer.NAME, FrameworkLogEntry.WARNING, e.getMessage(), e);
       }
     }
     throw e;
   }
   throw new ClassNotFoundException(
       "No class loader available for the bundle: " + this); // $NON-NLS-1$
 }
コード例 #6
0
 @Override
 public BundleContext getBundleContext() {
   equinoxContainer.checkAdminPermission(this, AdminPermission.CONTEXT);
   return createBundleContext(true);
 }
コード例 #7
0
 @Override
 public String getLocation() {
   equinoxContainer.checkAdminPermission(getBundle(), AdminPermission.METADATA);
   return module.getLocation();
 }
コード例 #8
0
 @Override
 public Dictionary<String, String> getHeaders(String locale) {
   equinoxContainer.checkAdminPermission(this, AdminPermission.METADATA);
   return privGetHeaders(locale);
 }