Package org.codehaus.plexus.classworlds.realm

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


                + "\n(trying to remove container realm as if it were a component realm)." );
        }

        componentRegistry.removeComponentRealm( realm );

        ClassRealm lookupRealm = getLookupRealm();
        if ( ( lookupRealm != null ) && lookupRealm.getId().equals( realm.getId() ) )
        {
            setLookupRealm( getContainerRealm() );
        }
    }
View Full Code Here


        Set<ClassRealm> realms = new LinkedHashSet<ClassRealm>();
        for ( ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); classLoader != null; classLoader = classLoader.getParent() )
        {
            if ( classLoader instanceof ClassRealm && ((ClassRealm) classLoader).getWorld() == container.getClassWorld() )
            {
                ClassRealm realm = (ClassRealm) classLoader;
                while ( realm != null )
                {
                    realms.add( realm );
                    realm = realm.getParentRealm();
                }
            }
        }

        if ( realms.isEmpty() )
View Full Code Here

                throw new ConstructionException("Unable to convert configuration for property " + child.getName() + " to " + toClass(expectedType).getName());
            }
        }

        private ConverterLookup createConverterLookup() {
            ClassRealm realm = (ClassRealm) Thread.currentThread().getContextClassLoader();
            ConverterLookup lookup = new DefaultConverterLookup();
            lookup.registerConverter( new ClassRealmConverter(realm) );
            return lookup;
        }
View Full Code Here

        // determine realms to search
        LinkedHashSet<ClassRealm> realms = new LinkedHashSet<ClassRealm>();
        for (ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); classLoader != null; classLoader = classLoader.getParent()) {
            if ( classLoader instanceof ClassRealm )
            {
                ClassRealm realm = (ClassRealm) classLoader;
                while (realm != null) {
                    realms.add(realm);
                    realm = realm.getParentRealm();
                }
            }
        }
        if (realms.isEmpty()) {
            realms.addAll( index.keySet() );
View Full Code Here

    // ----------------------------------------------------------------------

    public void addComponentDescriptor( ComponentDescriptor<?> componentDescriptor )
        throws CycleDetectedInComponentGraphException
    {
        ClassRealm classRealm = componentDescriptor.getRealm();
        SortedMap<String, Multimap<String, ComponentDescriptor<?>>> roleIndex = index.get( classRealm );
        if (roleIndex == null) {
            roleIndex = new TreeMap<String, Multimap<String, ComponentDescriptor<?>>>();
            index.put(classRealm,  roleIndex);
        }
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

        return mavenRealm;
    }

    private void importMavenApi( Map<String, ClassLoader> imports )
    {
        ClassRealm coreRealm = getCoreRealm();

        // maven-*
        imports.put( "org.apache.maven.*", coreRealm );
        imports.put( "org.apache.maven.artifact", coreRealm );
        imports.put( "org.apache.maven.classrealm", coreRealm );
View Full Code Here

        else
        {
            foreignImports = new TreeMap<String, ClassLoader>();
        }

        ClassRealm classRealm = newRealm( baseRealmId );

        if ( parent != null )
        {
            classRealm.setParentClassLoader( parent );
        }

        callDelegates( classRealm, type, parent, parentImports, foreignImports, constituents );

        wireRealm( classRealm, parentImports, foreignImports );
View Full Code Here

        List<org.sonatype.aether.artifact.Artifact> pluginArtifacts = nlg.getArtifacts( true );

        Map<String, ClassLoader> foreignImports = calcImports( project, parent, imports );

        ClassRealm pluginRealm =
            classRealmManager.createPluginRealm( plugin, parent, null, foreignImports, pluginArtifacts );

        pluginDescriptor.setClassRealm( pluginRealm );
        pluginDescriptor.setArtifacts( exposedPluginArtifacts );
View Full Code Here

    {
        MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();

        PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();

        ClassRealm pluginRealm = pluginDescriptor.getClassRealm();

        if ( logger.isDebugEnabled() )
        {
            logger.debug( "Configuring mojo " + mojoDescriptor.getId() + " from plugin realm " + pluginRealm );
        }

        // We are forcing the use of the plugin realm for all lookups that might occur during
        // the lifecycle that is part of the lookup. Here we are specifically trying to keep
        // lookups that occur in contextualize calls in line with the right realm.
        ClassRealm oldLookupRealm = container.setLookupRealm( pluginRealm );
        container.setLookupRealm( pluginRealm );

        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader( pluginRealm );
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.