Package org.jboss.classloader.spi

Examples of org.jboss.classloader.spi.ClassLoaderPolicy


      VirtualFile vf = getRoot();
      VirtualFile childWar = vf.getChild("jboss-seam-booking.war");
      VirtualFile child = childWar.getChild("/WEB-INF/lib/jboss-seam-debug.jar");
      assertTrue(child.exists());
      VirtualFile[] roots = {child};
      ClassLoaderPolicy policy = new VFSClassLoaderPolicy(roots);
      URL url = policy.getResource("org/jboss/seam/debug/Contexts.class");
      log.info(url);
      assertNotNull(url);
   }
View Full Code Here


            {
               log.trace("Factory did not create a delegate: " + factory);
            }
            else
            {
               ClassLoaderPolicy policy = (ClassLoaderPolicy) delegate;
               initialise(policy);
               this.delegate = delegate;
            }
         }
         catch (Throwable t)
View Full Code Here

      }
     
      // If we failed, try any class not found handlers and retry if one says it is resolved
      if (result == null)
      {
         ClassLoaderPolicy policy = getPolicy();
         if (policy != null && policy.classNotFound(new ClassNotFoundEvent(this, name)))
         {
            try
            {
               result = doLoadClass(name, resolve, trace);
            }
View Full Code Here

         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);

         module.addIDependOn(item);

         return loader;
      }
View Full Code Here

      @Override
      public boolean unresolved(Controller controller)
      {
         if (loader != null)
         {
            ClassLoaderPolicy policy = getPolicy();
            policy.removeExtraDelegate(loader);
         }

         Object iDependOn = getIDependOn();
         if (iDependOn != null)
         {
View Full Code Here

      log.debug(this + " registerClassLoader " + classLoader.toString());

      if (getClassLoaderSystem() == null)
         throw new IllegalStateException("Domain is not registered with a classloader system: " + toLongString());
     
      ClassLoaderPolicy policy = classLoader.getPolicy();
      BaseDelegateLoader exported = policy.getExported();
      if (exported != null && exported.getPolicy() == null)
         throw new IllegalStateException("The exported delegate " + exported + " is too lazy for " + policy.toLongString());
     
      try
      {
         beforeRegisterClassLoader(classLoader, policy);
      }
      catch (Throwable t)
      {
         log.warn("Error in beforeRegisterClassLoader: " + this + " classLoader=" + classLoader.toLongString(), t);
      }
     
      BaseClassLoaderPolicy basePolicy = classLoader.getPolicy();
      basePolicy.setClassLoaderDomain(this);

      // FINDBUGS: This synchronization is correct - more than addIfNotPresent behaviour
      synchronized (classLoaders)
      {
         // Create the information
         ClassLoaderInformation info = new ClassLoaderInformation(classLoader, policy, order++);
         classLoaders.add(info);
         infos.put(classLoader, info);

         // Index the packages
         String[] packageNames = policy.getPackageNames();
         if (packageNames != null && info.getExported() != null)
         {
            for (String packageName : packageNames)
            {
               List<ClassLoaderInformation> list = classLoadersByPackageName.get(packageName);
View Full Code Here

            {
               log.trace("Factory did not create a delegate: " + factory);
            }
            else
            {
               ClassLoaderPolicy policy = (ClassLoaderPolicy) delegate;
               initialise(policy);
               this.delegate = delegate;
            }
         }
         catch (Throwable t)
View Full Code Here

      log.debug(this + " registerClassLoader " + classLoader.toString());

      if (getClassLoaderSystem() == null)
         throw new IllegalStateException("Domain is not registered with a classloader system: " + toLongString());
     
      ClassLoaderPolicy policy = classLoader.getPolicy();
      BaseDelegateLoader exported = policy.getExported();
      if (exported != null && exported.getPolicy() == null)
         throw new IllegalStateException("The exported delegate " + exported + " is too lazy for " + policy.toLongString());
     
      try
      {
         beforeRegisterClassLoader(classLoader, policy);
      }
      catch (Throwable t)
      {
         log.warn("Error in beforeRegisterClassLoader: " + this + " classLoader=" + classLoader.toLongString(), t);
      }
     
      BaseClassLoaderPolicy basePolicy = classLoader.getPolicy();
      basePolicy.setClassLoaderDomain(this);

      synchronized (classLoaders)
      {
         // Create the information
         ClassLoaderInformation info = new ClassLoaderInformation(classLoader, policy, order++);
         classLoaders.add(info);
         infos.put(classLoader, info);

         // Index the packages
         String[] packageNames = policy.getPackageNames();
         if (packageNames != null && info.getExported() != null)
         {
            for (String packageName : packageNames)
            {
               List<ClassLoaderInformation> list = classLoadersByPackageName.get(packageName);
View Full Code Here

            {
               log.trace("Factory did not create a delegate: " + factory);
            }
            else
            {
               ClassLoaderPolicy policy = (ClassLoaderPolicy) delegate;
               initialise(policy);
               this.delegate = delegate;
            }
         }
         catch (Throwable t)
View Full Code Here

         List<ClassLoadingTranslatorMetaData> translators = deployment.getTranslators();
         if (translators != null)
         {
            ClassLoaderPolicyModule clpm = (ClassLoaderPolicyModule) module;
            ClassLoaderDomain domain = system.getDomain(module.getDeterminedDomainName());
            ClassLoaderPolicy policy = clpm.getPolicy();
            ClassLoader cl = unit.getClassLoader();

            for (ClassLoadingTranslatorMetaData cltmd : translators)
            {
               TranslatorScope scope = cltmd.getScope();
               if (scope == null)
                  throw new IllegalArgumentException("Null scope for: " + cltmd);

               String className = cltmd.getClassName();
               Object instance = cl.loadClass(className).newInstance();
               String methodName = cltmd.getMethod();
               Translator translator;
               if (methodName != null)
                  translator = new ReflectionTranslator(instance, methodName);
               else
                  translator = Translator.class.cast(instance);

               scope.addTranslator(system, domain, policy, translator);
               added.put(translator, scope);
            }

            unit.addAttachment(TRANSLATORS_KEY, added);
         }
      }
      catch (Exception e)
      {
         ClassLoaderPolicyModule clpm = (ClassLoaderPolicyModule) module;
         ClassLoaderDomain domain = system.getDomain(module.getDeterminedDomainName());
         ClassLoaderPolicy policy = clpm.getPolicy();

         for (Map.Entry<Translator, TranslatorScope> entry : added.entrySet())
         {
            entry.getValue().removeTranslator(system, domain, policy, entry.getKey());
         }
View Full Code Here

TOP

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

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.