Package net.jini.loader.pref

Examples of net.jini.loader.pref.PreferredClassLoader


        // Get system class loader to load classes.
        ClassLoader ldr01 = ClassLoader.getSystemClassLoader();

        // Create preferred class loader to load classes.
        PreferredClassLoader ldr02 = new PreferredClassLoader(urls, ldr01,
                (String) null, false);

        // Create preferred class loader to load classes.
        PreferredClassLoader ldr03 = new PreferredClassLoader(urls, ldr02,
                (String) null, false);

        // return array of class loaders to load classes.
        return new ClassLoader[] { ldr01, ldr02, ldr03 };
    }
View Full Code Here


         * 1) construct a PreferredClassLoader with a single URL
         *    to the "qa1-loader-pref.jar file and appropriate parameters.
         */
        String jarfile = Util.PREFERREDJarFile;
        URL[] urls = Util.getUrls(isHttp, jarfile, null, config, port);
        PreferredClassLoader loader = PreferredClassLoader.newInstance(urls,
                parent, annotation, dlPerm);
        String msg = "PreferredClassLoader.newInstance(";

        for (int i = 0; i < urls.length; i++) {
            msg += urls[i].toExternalForm() + ", ";
View Full Code Here

  throws Exception
    {
  SecurityException sex = null;
  Class fooClass = null;
  try {
      PreferredClassLoader loader =
    PreferredClassLoader.newInstance(new URL[] {fooUrl},
        ClassLoader.getSystemClassLoader(),
        "not used", true);

      fooClass = loader.loadClass("Foo");

      System.err.println("Foo class incorrectly loaded from: " +
             fooClass.getProtectionDomain().
             getCodeSource().getLocation());
  } catch (SecurityException e) {
View Full Code Here

    }

    private static void checkNewInstanceAnnotations(URL fooUrl)
  throws ClassNotFoundException
    {
  PreferredClassLoader loader =
      PreferredClassLoader.newInstance(new URL[] {fooUrl},
    ClassLoader.getSystemClassLoader(),
    "test annotation", false);

  Class c = loader.loadClass("Foo");
  if (!RMIClassLoader.getClassAnnotation(c).
      equals("test annotation"))
  {
      TestLibrary.bomb("class Foo had incorrect annotation in " +
           "loader: test annotation");
View Full Code Here

   */
  ClassLoader matchingURLLoader =
      new URLLoader(new URL[] { new URL("http://java.sun.com/") },
        codebase, NonURLAncestor.class.getClassLoader());
  ClassLoader nonmatchingPreferredLoader =
      new PreferredClassLoader(codebaseURLs, matchingURLLoader,
             "", false);
  Thread.currentThread().setContextClassLoader(
      nonmatchingPreferredLoader);

  c = RMIClassLoader.loadClass(codebase, CLASS_NAME, null);
View Full Code Here

        // Get system class loader to load classes.
        ClassLoader ldr01 = ClassLoader.getSystemClassLoader();

        // Create preferred class loader to load classes.
        PreferredClassLoader ldr02 = new PreferredClassLoader(urls, ldr01,
                (String) null, false);

        // Create preferred class loader to load classes.
        PreferredClassLoader ldr03 = new PreferredClassLoader(urls, ldr02,
                (String) null, false);

        // return array of class loaders to load classes.
        return new ClassLoader[] { ldr01, ldr02, ldr03 };
    }
View Full Code Here

         * 1) construct a PreferredClassLoader with a single URL
         *    to the "qa1-loader-pref.jar file and appropriate parameters.
         */
        String jarfile = Util.PREFERREDJarFile;
        URL[] urls = Util.getUrls(isHttp, jarfile, null, config, port);
        PreferredClassLoader loader = new PreferredClassLoader(urls, parent,
                annotation, dlPerm);
        String msg = "new PreferredClassLoader(";

        for (int i = 0; i < urls.length; i++) {
            msg += urls[i].toExternalForm() + ", ";
View Full Code Here

  String testsrc = System.getProperty("test.src", ".");
  URL[] codebaseURLs = new URL[] {
      new URL((new File(testsrc)).toURI().toURL(), "foo.jar"),
  };
  Factory factory = new Factory(null);
  ClassLoader loader = new PreferredClassLoader(
       codebaseURLs,
       TestURLStreamHandlerFactory.class.getClassLoader(),
       null,
       false,
       factory);
View Full Code Here

TOP

Related Classes of net.jini.loader.pref.PreferredClassLoader

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.