Package org.jboss.classloader.spi

Examples of org.jboss.classloader.spi.DelegateLoader


      this.policy = policy;

      BaseClassLoaderPolicy basePolicy = policy;
      basePolicy.setClassLoader(this);

      loader = new DelegateLoader(policy);

      if (basePolicy.isCacheable())
         resourceCache = new ConcurrentHashMap<String, URL>();

      if (basePolicy.isBlackListable())
View Full Code Here


               throw new IllegalStateException("Item not resolved: " + item);
           
            // Dynamic requirement, create it lazily
            if (requirement.isDynamic())
            {
               DelegateLoader delegate = createLazyDelegateLoader(checkDomain(), item);
               dynamic.add(delegate);
               continue;
            }

            String name = (String) item.getIDependOn();
            if (name == null)
            {
               // Optional requirement, just ignore
               if (requirement.isOptional())
                  continue;
               // Something has gone wrong
               throw new IllegalStateException("No iDependOn for item: " + item);
            }
            Module iDependOnModule = checkDomain().getModule(name);
            if (iDependOnModule == null)
               throw new IllegalStateException("Module not found with name: " + name);

            // Determine the delegate loader for the module
            Module other = item.getModule();
            DelegateLoader delegate = iDependOnModule.getDelegateLoader(other, requirement);

            // Check for re-export by the module
            if (requirement.wantReExports())
               addDelegates(iDependOnModule, delegates, dynamic, visited, true);
           
View Full Code Here

               throw new IllegalStateException("Item not resolved: " + item);
           
            // Dynamic requirement, create it lazily
            if (requirement.isDynamic())
            {
               DelegateLoader delegate = createLazyDelegateLoader(checkDomain(), item);
               delegate.setImportType(getImportType(requirement));
               dynamic.add(delegate);
               continue;
            }
           
            Module iDependOnModule = item.getResolvedModule();
            if (iDependOnModule == null)
            {
               // Do it the hard way - probably optional or a self dependency?
               String name = (String) item.getIDependOn();
               if (name != null)
                  iDependOnModule = checkDomain().getModule(name);
               if (iDependOnModule == null)
               {
                  if (requirement.isOptional())
                     continue;
                  throw new IllegalStateException("Module not found for requirement: " + item);
               }
            }

            // Check for re-export by the module
            if (requirement.wantReExports())
               addDelegates(iDependOnModule, delegates, dynamic, visited, true);
           
            // Only add a the delegate if this is not a self-dependency
            if (iDependOnModule != module)
            {
               // If we are connecting to another module we collect the imported package names per delegate
               if (requirement instanceof PackageRequirement)
               {
                  List<String> packageNames = delegateToRequiredPackages.get(iDependOnModule);
                  if (packageNames == null)
                  {
                     packageNames = new ArrayList<String>();
                     delegateToRequiredPackages.put(iDependOnModule, packageNames);
                  }
                 
                  PackageRequirement packageRequirement = (PackageRequirement)requirement;
                  packageNames.add(packageRequirement.getName());
               }
               else
               {
                  // Determine the delegate loader for the module
                  DelegateLoader delegate = iDependOnModule.getDelegateLoader(module, requirement);
                  if (delegate == null)
                     throw new IllegalStateException("Cannot obtain delegate for: " + requirement);
                  delegate.setImportType(getImportType(requirement));
                  delegates.add(delegate);
               }
            }
         }
      }
     
      // Add FilteredDelegateLoaders for all collected package requirements
      for (Entry<Module, List<String>> entry : delegateToRequiredPackages.entrySet())
      {
         Module iDependOnModule = entry.getKey();
         DelegateLoader delegate = iDependOnModule.getDelegateLoader(module, entry.getValue());
         delegates.add(delegate);
      }
   }
View Full Code Here

      WildcardRequirementDependencyItem item = new WildcardRequirementDependencyItem(module, requirement, state, state);
      if (item.resolve(controller))
      {
         Module resolvedModule = item.getResolvedModule();

         DelegateLoader loader = resolvedModule.getDelegateLoader(module, requirement);
         loader.setImportType(ImportType.AFTER); // allow normal imports to run before
         item.setLoader(loader); // remember the loader wrt item

         ClassLoaderPolicy policy = getPolicy();
         policy.addExtraDelegate(loader);
View Full Code Here

   }

   @Override
   protected Class<?> doLoadClass(String className)
   {
      DelegateLoader loader = resolve(ClassLoaderUtils.getClassPackageName(className));
      return loader != null ? loader.loadClass(className) : null;
   }
View Full Code Here

   }

   @Override
   protected URL doGetResource(String name)
   {
      DelegateLoader loader = resolve(ClassLoaderUtils.getResourcePackageName(name));
      return loader != null ? loader.getResource(name) : null;
   }
View Full Code Here

   }

   @Override
   protected void doGetResources(String name, Set<URL> urls) throws IOException
   {
      DelegateLoader loader = resolve(ClassLoaderUtils.getResourcePackageName(name));
      if (loader != null)
      {
         loader.getResources(name, urls);
      }
   }
View Full Code Here

   }

   @Override
   protected Package doGetPackage(String name)
   {
      DelegateLoader loader = resolve(ClassLoaderUtils.pathToPackage(name));
      return loader != null ? loader.getPackage(name) : null;
   }
View Full Code Here

      this.policy = policy;

      BaseClassLoaderPolicy basePolicy = policy;
      basePolicy.setClassLoader(this);

      loader = new DelegateLoader(policy);

      if (basePolicy.isCacheable())
         resourceCache = new ConcurrentHashMap<String, URL>();

      if (basePolicy.isBlackListable())
View Full Code Here

               throw new IllegalStateException("Item not resolved: " + item);
           
            // Dynamic requirement, create it lazily
            if (requirement.isDynamic())
            {
               DelegateLoader delegate = createLazyDelegateLoader(checkDomain(), item);
               dynamic.add(delegate);
               continue;
            }

            String name = (String) item.getIDependOn();
            if (name == null)
            {
               // Optional requirement, just ignore
               if (requirement.isOptional())
                  continue;
               // Something has gone wrong
               throw new IllegalStateException("No iDependOn for item: " + item);
            }
            Module iDependOnModule = checkDomain().getModule(name);
            if (iDependOnModule == null)
               throw new IllegalStateException("Module not found with name: " + name);

            // Determine the delegate loader for the module
            Module other = item.getModule();
            DelegateLoader delegate = iDependOnModule.getDelegateLoader(other, requirement);

            // Check for re-export by the module
            if (requirement.wantReExports())
               addDelegates(iDependOnModule, delegates, dynamic, visited, true);
           
View Full Code Here

TOP

Related Classes of org.jboss.classloader.spi.DelegateLoader

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.