Package org.codehaus.plexus.component.repository

Examples of org.codehaus.plexus.component.repository.ComponentDescriptor


                if ( componentSetDescriptor.getComponents() != null )
                {
                    for ( Iterator i = componentSetDescriptor.getComponents().iterator(); i.hasNext(); )
                    {
                        ComponentDescriptor cd = (ComponentDescriptor) i.next();

                        cd.setRealmId( classRealm.getId() );
                    }
                }

                componentSetDescriptors.add( componentSetDescriptor );
View Full Code Here


        return getComponentDescriptor( role, hint, getLookupRealm() );
    }

    public ComponentDescriptor getComponentDescriptor( String role, String hint, ClassRealm classRealm )
    {
        ComponentDescriptor result = componentRepository.getComponentDescriptor( role, hint, classRealm );

        ClassRealm tmpRealm = classRealm.getParentRealm();

        while ( result == null && tmpRealm != null )
        {
View Full Code Here

        {
            PropertyDescriptor pd = propertyDescriptors[i];

            String role = pd.getPropertyType().getName();

            ComponentDescriptor componentDescriptor = container.getComponentDescriptor( role, componentRealm );

            if ( componentDescriptor != null )
            {
                ComponentRequirement requirement = new ComponentRequirement();
View Full Code Here

        if ( componentDescriptor == null )
        {
            // Create a componentDescriptor to keep everything happy when we're trying to autowire.

            componentDescriptor = new ComponentDescriptor();

            componentDescriptor.setImplementation( component.getClass().getName() );

            componentDescriptor.setRole( component.getClass().getName() );
View Full Code Here

            }
            else
            {
                assignment = container.lookup( role, roleHint, lookupRealm );

                ComponentDescriptor componentDescriptor = container.getComponentDescriptor( role, roleHint, lookupRealm );

                componentDescriptors = new ArrayList( 1 );

                componentDescriptors.add( componentDescriptor );
            }
View Full Code Here

                "This is highly irregular, your plexus JAR is most likely corrupt.";

            throw new ContainerInitializationException( msg );
        }

        ComponentDescriptor componentDescriptor = new ComponentDescriptor();

        componentDescriptor.setRole( role );

        componentDescriptor.setImplementation( implementation );

        PlexusConfiguration configuration = new XmlPlexusConfiguration( "containerConfiguration" );

        configuration.addChild( c );

        try
        {
            configurator.configureComponent( container, configuration, container.getContainerRealm() );
        }
        catch ( ComponentConfigurationException e )
        {
            // TODO: don't like rewrapping the same exception, but better than polluting this all through the config code
            String message = "Error configuring component: " + componentDescriptor.getHumanReadableKey();
            throw new ContainerInitializationException( message, e );
        }
    }
View Full Code Here

            // it's a single-value, not a collection.
            if ( StringUtils.isNotEmpty( hint ) && !hint.equals( PlexusConstants.PLEXUS_DEFAULT_HINT ) )
            {
                value = container.lookup( role, hint );

                ComponentDescriptor componentDescriptor = container.getComponentDescriptor( role, hint, componentRealm );

                retValue = Collections.singletonList( componentDescriptor );
            }
            else if ( SINGLE_MAPPING_TYPE.equals( mappingType ) )
            {
                value = container.lookup( role, hint );

                ComponentDescriptor componentDescriptor = container.getComponentDescriptor( role, hint, componentRealm );

                retValue = Collections.singletonList( componentDescriptor );
            }
            else if ( MAP_MAPPING_TYPE.equals( mappingType ) )
            {
                value = container.lookupMap( role );

                retValue = container.getComponentDescriptorList( role );
            }
            else if ( SET_MAPPING_TYPE.equals( mappingType ) )
            {
                value = new HashSet( container.lookupList( role ) );

                retValue = container.getComponentDescriptorList( role );
            }
            else
            {
                value = container.lookup( role, hint );

                ComponentDescriptor componentDescriptor = container.getComponentDescriptor( role, hint, componentRealm );

                retValue = Collections.singletonList( componentDescriptor );
            }

            component.addComponentRequirement( requirement, value );
View Full Code Here

                if ( componentDescriptors != null )
                {
                    for ( Iterator k = componentDescriptors.iterator(); k.hasNext(); )
                    {
                        ComponentDescriptor componentDescriptor = (ComponentDescriptor) k.next();

                        componentDescriptor.setComponentSetDescriptor( componentSet );

                        // If the user has already defined a component descriptor for this particular
                        // component then do not let the discovered component descriptor override
                        // the user defined one.

                        // Use the parent realm to search for the original descriptor. It won't
                        // be in the current realm (yet).
                        ComponentDescriptor orig = container.getComponentDescriptor( componentDescriptor
                            .getRole(), componentDescriptor.getRoleHint(), realm );

                        // System.out.println("Found new descriptor: " + componentDescriptor.getHumanReadableKey() + "
                        // realm="+ componentDescriptor.getRealmId() );
                        // System.out.println(" Existing descriptor: " + (orig == null ? "none":
                        // orig.getHumanReadableKey() + " realm= " + orig.getRealmId() ) );

                        if ( orig == null )
                        {
                            container.addComponentDescriptor( componentDescriptor );

                            // We only want to add components that have not yet been
                            // discovered in a parent realm. We don't quite have fine
                            // grained control over this right now but this is for
                            // dynamic additions which are only happening from maven
                            // at the moment. And plugins have a parent realm and
                            // a grand parent realm so if the component has been
                            // discovered it's most likely in those realms.

                            // I actually need to keep track of what realm a component
                            // was discovered in so that i can accurately search the
                            // parents.

                            discoveredComponentDescriptors.add( componentDescriptor );
                        }
                        else if ( override && orig.getRealmId() != null
                            && !orig.getRealmId().equals( componentDescriptor.getRealmId() ) )
                        {
                            container.getLogger().debug( "Duplicate component found, merging:" + "\n  Original: "
                                + orig.getRealmId() + ": " + orig.getRole() + " [" + orig.getRoleHint() + "] impl="
                                + orig.getImplementation() + "\n  Config: " + orig.getConfiguration()
                                + "\n  New:      " + componentDescriptor.getRealmId() + ": "
                                + componentDescriptor.getRole() + " [" + orig.getRoleHint() + "] impl="
                                + componentDescriptor.getImplementation() + "\n  Config: " + orig.getConfiguration() );

                            PlexusComponentDescriptorMerger.merge( componentDescriptor, orig );
                        }
                    }
                }
View Full Code Here

            catch ( ComponentLookupException e )
            {
                throw new PhaseExecutionException( "Unable to locate logger manager", e );
            }

            ComponentDescriptor descriptor = componentManager.getComponentDescriptor();
            loggerManager.returnComponentLogger( descriptor.getRole(), descriptor.getRoleHint() );
        }
    }
View Full Code Here

    extends AbstractPhase
{
    public void execute( Object object, ComponentManager manager, ClassRealm lookupRealm )
        throws PhaseExecutionException
    {
        ComponentDescriptor descriptor = manager.getComponentDescriptor();

        if ( descriptor.getRequirements() == null )
        {
            return;
        }

        try
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.component.repository.ComponentDescriptor

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.