Package org.codehaus.plexus.classworlds.realm

Examples of org.codehaus.plexus.classworlds.realm.ClassRealm


        PluginDescriptor pluginDescriptor = new PluginDescriptor();
        pluginDescriptor.setGroupId("com.test");
        pluginDescriptor.setArtifactId("testPlugin");
        pluginDescriptor.setVersion("1.0");
       
        ClassRealm classRealm = new ClassRealm(null, "test", getClass().getClassLoader());
        pluginDescriptor.setClassRealm(classRealm);
       
        MojoDescriptor descriptor = new MojoDescriptor();
        descriptor.setPluginDescriptor(pluginDescriptor);
        this.mojoDescriptor = descriptor;
View Full Code Here


        if ( realms.containsKey( id ) )
        {
            throw new DuplicateRealmException( this, id );
        }

        ClassRealm realm;

        realm = new ClassRealm( this, id, classLoader );

        realms.put( id, realm );

        for ( ClassWorldListener listener : listeners )
        {
View Full Code Here

    }

    public synchronized void disposeRealm( String id )
        throws NoSuchRealmException
    {
        ClassRealm realm = (ClassRealm) realms.remove( id );

        if ( realm != null )
        {
            closeIfJava7( realm );
            for ( ClassWorldListener listener : listeners )
View Full Code Here

     */
    protected void launchEnhanced( String[] args )
        throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException,
        NoSuchRealmException
    {
        ClassRealm mainRealm = getMainRealm();

        Class<?> mainClass = getMainClass();

        Method mainMethod = getEnhancedMainMethod();

View Full Code Here

     */
    protected void launchStandard( String[] args )
        throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, NoSuchMethodException,
        NoSuchRealmException
    {
        ClassRealm mainRealm = getMainRealm();

        Class<?> mainClass = getMainClass();

        Method mainMethod = getMainMethod();

View Full Code Here

        {
            launcher.launch( args );
        }
        catch ( InvocationTargetException e )
        {
            ClassRealm realm = launcher.getWorld().getRealm( launcher.getMainRealmName() );

            URL[] constituents = realm.getURLs();

            System.out.println( "---------------------------------------------------" );

            for ( int i = 0; i < constituents.length; i++ )
            {
View Full Code Here

            if ( j > 0 )
            {
                String parentRealmName = realmName.substring( 0, j );

                ClassRealm parentRealm = configuredRealms.get( parentRealmName );

                if ( parentRealm != null )
                {
                    ClassRealm realm = configuredRealms.get( realmName );

                    realm.setParentRealm( parentRealm );
                }
            }
        }
    }
View Full Code Here

         }
    }

  private String addArtifactsToClasspath(final Set<Artifact> artifacts) {
        final StringBuilder wikiFormatClasspath = new StringBuilder("\n");
    final ClassRealm realm = this.pluginDescriptor.getClassRealm();
      setupLocalTestClasspath(realm, wikiFormatClasspath);
        for (Artifact artifact : artifacts) {
        final File artifactFile = artifact.getFile();
            if(artifactFile != null) {
                getLog().debug(String.format("Adding artifact to FitNesse classpath [%s]", artifact));
View Full Code Here

            // It seems there is nothing we can do if the current class loader is not a ClassRealm.
            return;
        }

        // Modify the current class loader so that classes that was not loaded during the Maven build will be loaded by the new class loader.
        final ClassRealm classRealm = (ClassRealm) classLoader;
        ClassLoader newClassLoader = new URLClassLoader(classRealm.getURLs(), classRealm.getParentClassLoader()) {
            @Override
            protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
                // We should first check whether the requested class was already loaded by the old class loader in order not to break compatibility with already loaded classes.
                Class<?> clazz = classRealm.loadClassFromSelf(name);
                return clazz != null ? clazz : super.loadClass(name, resolve);
            }
        };
        classRealm.setParentClassLoader(newClassLoader);
    }
View Full Code Here

    private List<MavenReportExecution> buildReports( ReportSet... javadocReportSets )
        throws Exception
    {
        ClassLoader orig = Thread.currentThread().getContextClassLoader();
        ClassRealm realm = getContainer().getContainerRealm();

        Thread.currentThread().setContextClassLoader( realm );
        try
        {
            MavenReportExecutorRequest mavenReportExecutorRequest = new MavenReportExecutorRequest();
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.classworlds.realm.ClassRealm

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.