Package org.codehaus.plexus.classworlds

Examples of org.codehaus.plexus.classworlds.ClassWorld.newRealm()


            // OK
        }

        // Prepare the child class loaders which can load Snappy.class
        URL classPath = new File("target/classes").toURI().toURL();
        ClassRealm L1 = cw.newRealm("l1", URLClassLoader.newInstance(new URL[] { classPath }, parent));
        ClassRealm L2 = cw.newRealm("l2", URLClassLoader.newInstance(new URL[] { classPath }, parent));

        // Actually load Snappy.class in a child class loader

        Class< ? > S1 = L1.loadClass("org.xerial.snappy.Snappy");
View Full Code Here


        }

        // Prepare the child class loaders which can load Snappy.class
        URL classPath = new File("target/classes").toURI().toURL();
        ClassRealm L1 = cw.newRealm("l1", URLClassLoader.newInstance(new URL[] { classPath }, parent));
        ClassRealm L2 = cw.newRealm("l2", URLClassLoader.newInstance(new URL[] { classPath }, parent));

        // Actually load Snappy.class in a child class loader

        Class< ? > S1 = L1.loadClass("org.xerial.snappy.Snappy");
        Method m = S1.getMethod("compress", String.class);
View Full Code Here

            while ( true )
            {
                try
                {
                    classRealm = world.newRealm( realmId, null );

                    if ( logger.isDebugEnabled() )
                    {
                        logger.debug( "Created new class realm " + realmId );
                    }
View Full Code Here

            while ( true )
            {
                try
                {
                    classRealm = world.newRealm( realmId, null );

                    if ( logger.isDebugEnabled() )
                    {
                        logger.debug( "Created new class realm " + realmId );
                    }
View Full Code Here

            while ( true )
            {
                try
                {
                    ClassRealm classRealm = world.newRealm( realmId, null );

                    if ( logger.isDebugEnabled() )
                    {
                        logger.debug( "Created new class realm " + realmId );
                    }
View Full Code Here

    public void loadSnappyByDiffentClassloadersInTheSameJVM() throws Exception {

        // Parent class loader cannot see Snappy.class
        ClassLoader parent = this.getClass().getClassLoader().getParent();
        ClassWorld cw = new ClassWorld();
        ClassRealm P = cw.newRealm("P", parent);
        try {
            P.loadClass("org.xerial.snappy.Snappy");
            fail("org.xerial.snappy.Snappy is found in the parent");
        }
        catch (ClassNotFoundException e) {
View Full Code Here

            // OK
        }

        // Prepare the child class loaders which can load Snappy.class
        URL classPath = new File("target/classes").toURI().toURL();
        ClassRealm L1 = cw.newRealm("l1", URLClassLoader.newInstance(new URL[] { classPath }, parent));
        ClassRealm L2 = cw.newRealm("l2", URLClassLoader.newInstance(new URL[] { classPath }, parent));

        // Actually load Snappy.class in a child class loader

        Class< ? > S1 = L1.loadClass("org.xerial.snappy.Snappy");
View Full Code Here

        }

        // Prepare the child class loaders which can load Snappy.class
        URL classPath = new File("target/classes").toURI().toURL();
        ClassRealm L1 = cw.newRealm("l1", URLClassLoader.newInstance(new URL[] { classPath }, parent));
        ClassRealm L2 = cw.newRealm("l2", URLClassLoader.newInstance(new URL[] { classPath }, parent));

        // Actually load Snappy.class in a child class loader

        Class< ? > S1 = L1.loadClass("org.xerial.snappy.Snappy");
        Method m = S1.getMethod("compress", String.class);
View Full Code Here

    private void extendClassLoader() throws DuplicateRealmException, MalformedURLException {
        ClassRealm realm = descriptor.getClassRealm();
        if (realm == null) {
            ClassWorld world = new ClassWorld();
            realm = world.newRealm("maven.plugin." + getClass().getSimpleName(), Thread
                    .currentThread().getContextClassLoader());
        }
        File cls = new File(buildDir + File.separator + DEFAULT_CLASSES_DIRECTORY);
        File testCls = new File(buildDir + File.separator + DEFAULT_TEST_CLASSES_DIRECTORY);
        realm.addURL(cls.toURI().toURL());
View Full Code Here

  public void detect_plugins_compiled_for_bad_java_version() throws Exception {
    thrown.expect(SonarException.class);
    thrown.expectMessage("The plugin checkstyle is not supported with Java 1.");

    ClassWorld world = mock(ClassWorld.class);
    when(world.newRealm(anyString(), any(ClassLoader.class))).thenThrow(new UnsupportedClassVersionError());

    classloaders = new PluginClassloaders(getClass().getClassLoader(), world);

    DefaultPluginMetadata checkstyle = DefaultPluginMetadata.create("checkstyle")
      .setMainClass("org.sonar.plugins.checkstyle.CheckstylePlugin")
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.