Package org.codehaus.plexus.component.repository

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


    }

    private ComponentSetDescriptor createComponentDescriptors( PlexusConfiguration configuration, ClassRealm realm )
        throws PlexusConfigurationException
    {
        ComponentSetDescriptor componentSetDescriptor = new ComponentSetDescriptor();

        if ( configuration != null )
        {
            PlexusConfiguration[] componentConfigurations = configuration.getChild( "components" ).getChildren(
                "component" );

            for ( PlexusConfiguration componentConfiguration : componentConfigurations )
            {
                ComponentDescriptor<?> componentDescriptor;
                try
                {
                    componentDescriptor = PlexusTools.buildComponentDescriptor( componentConfiguration );
                }
                catch ( PlexusConfigurationException e )
                {
                    throw new PlexusConfigurationException(
                        "Cannot build component descriptor from resource found in:\n" +
                            Arrays.asList( realm.getURLs() ), e );
                }

                componentDescriptor.setComponentType( "plexus" );

                componentDescriptor.setRealm( realm );

                componentDescriptor.setComponentSetDescriptor( componentSetDescriptor );

                componentSetDescriptor.addComponentDescriptor( componentDescriptor );
            }

            // TODO: read and store the dependencies
        }
View Full Code Here


    public ComponentSetDescriptor createComponentDescriptors( Reader componentDescriptorReader, String source )
        throws PlexusConfigurationException
    {
        PlexusConfiguration componentDescriptorConfiguration = PlexusTools.buildConfiguration( source, componentDescriptorReader );

        ComponentSetDescriptor componentSetDescriptor = new ComponentSetDescriptor();

        List<ComponentDescriptor<?>> componentDescriptors = new ArrayList<ComponentDescriptor<?>>();

        PlexusConfiguration[] componentConfigurations =
            componentDescriptorConfiguration.getChild( "components" ).getChildren( "component" );

        for ( PlexusConfiguration componentConfiguration : componentConfigurations )
        {
            ComponentDescriptor<?> componentDescriptor;
            try
            {
                componentDescriptor = PlexusTools.buildComponentDescriptor( componentConfiguration );
            }
            catch ( PlexusConfigurationException e )
            {
                throw new PlexusConfigurationException( "Cannot process component descriptor: " + source, e );
            }

            componentDescriptor.setSource( source );

            componentDescriptor.setComponentType( "plexus" );

            componentDescriptors.add( componentDescriptor );
        }

        componentSetDescriptor.setComponents( componentDescriptors );

        componentSetDescriptor.setSource( source );

        return componentSetDescriptor;
    }
View Full Code Here

                reader = ReaderFactory.newXmlReader( conn.getInputStream() );

                InterpolationFilterReader interpolationFilterReader =
                    new InterpolationFilterReader( reader, new ContextMapAdapter( context ) );

                ComponentSetDescriptor componentSetDescriptor =
                    createComponentDescriptors( interpolationFilterReader, url.toString() );

                if ( componentSetDescriptor.getComponents() != null )
                {
                    for ( ComponentDescriptor<?> cd : componentSetDescriptor.getComponents() )
                    {
                        cd.setComponentSetDescriptor( componentSetDescriptor );
                        cd.setRealm( realm );
                    }
                }
View Full Code Here

    }

    public static ComponentSetDescriptor buildComponentSet( PlexusConfiguration c )
        throws PlexusConfigurationException
    {
        ComponentSetDescriptor csd = new ComponentSetDescriptor();

        // ----------------------------------------------------------------------
        // Components
        // ----------------------------------------------------------------------

        PlexusConfiguration[] components = c.getChild( "components" ).getChildren( "component" );

        for ( int i = 0; i < components.length; i++ )
        {
            PlexusConfiguration component = components[i];

            csd.addComponentDescriptor( buildComponentDescriptor( component ) );
        }

        // ----------------------------------------------------------------------
        // Dependencies
        // ----------------------------------------------------------------------

        PlexusConfiguration[] dependencies = c.getChild( "dependencies" ).getChildren( "dependency" );

        for ( int i = 0; i < dependencies.length; i++ )
        {
            PlexusConfiguration d = dependencies[i];

            ComponentDependency cd = new ComponentDependency();

            cd.setArtifactId( d.getChild( "artifact-id" ).getValue() );

            cd.setGroupId( d.getChild( "group-id" ).getValue() );

            String type = d.getChild( "type" ).getValue();
            if(type != null)
            {
                cd.setType( type );
            }

            cd.setVersion( d.getChild( "version" ).getValue() );

            csd.addDependency( cd );
        }

        return csd;
    }
View Full Code Here

    }

    public static ComponentSetDescriptor buildComponentSet( PlexusConfiguration c, ClassRealm realm )
        throws PlexusConfigurationException
    {
        ComponentSetDescriptor csd = new ComponentSetDescriptor();

        // ----------------------------------------------------------------------
        // Components
        // ----------------------------------------------------------------------

        PlexusConfiguration[] components = c.getChild( "components" ).getChildren( "component" );

        for ( int i = 0; i < components.length; i++ )
        {
            PlexusConfiguration component = components[i];

            csd.addComponentDescriptor( buildComponentDescriptorImpl( component, realm ) );
        }

        // ----------------------------------------------------------------------
        // Dependencies
        // ----------------------------------------------------------------------

        PlexusConfiguration[] dependencies = c.getChild( "dependencies" ).getChildren( "dependency" );

        for ( int i = 0; i < dependencies.length; i++ )
        {
            PlexusConfiguration d = dependencies[i];

            ComponentDependency cd = new ComponentDependency();

            cd.setArtifactId( d.getChild( "artifact-id" ).getValue() );

            cd.setGroupId( d.getChild( "group-id" ).getValue() );

            String type = d.getChild( "type" ).getValue();
            if(type != null)
            {
                cd.setType( type );
            }

            cd.setVersion( d.getChild( "version" ).getValue() );

            csd.addDependency( cd );
        }

        return csd;
    }
View Full Code Here

    @Override
    protected ComponentSetDescriptor createComponentDescriptors( Reader reader, String source, ClassRealm realm )
        throws PlexusConfigurationException
    {
        ComponentSetDescriptor componentSetDescriptor = new ComponentSetDescriptor();

        PlexusConfiguration configuration = PlexusTools.buildConfiguration( source, reader );

        if ( configuration != null )
        {
            PlexusConfiguration[] componentConfigurations = configuration.getChild( "components" ).getChildren( "component" );

            for ( PlexusConfiguration componentConfiguration : componentConfigurations )
            {
                ComponentDescriptor<?> componentDescriptor;
               
                try
                {
                    componentDescriptor = PlexusTools.buildComponentDescriptor( componentConfiguration, realm );

                    if ( componentDescriptor == null )
                    {
                        continue;
                    }
                }
                catch ( PlexusConfigurationException e )
                {
                    throw new PlexusConfigurationException( "Cannot build component descriptor from resource found in:\n" + Arrays.asList( realm.getURLs() ), e );
                }

                componentDescriptor.setComponentType( "plexus" );

                componentDescriptor.setComponentSetDescriptor( componentSetDescriptor );

                componentSetDescriptor.addComponentDescriptor( componentDescriptor );
            }
        }

        return componentSetDescriptor;
    }
View Full Code Here

    public ComponentSetDescriptor createComponentDescriptors( Reader componentDescriptorReader, String source, ClassRealm realm )
        throws PlexusConfigurationException
    {
        PlexusConfiguration componentDescriptorConfiguration = PlexusTools.buildConfiguration( source, componentDescriptorReader );

        ComponentSetDescriptor componentSetDescriptor = new ComponentSetDescriptor();

        List<ComponentDescriptor<?>> componentDescriptors = new ArrayList<ComponentDescriptor<?>>();

        PlexusConfiguration[] componentConfigurations = componentDescriptorConfiguration.getChild( "components" ).getChildren( "component" );

        for ( PlexusConfiguration componentConfiguration : componentConfigurations )
        {
            ComponentDescriptor<?> componentDescriptor;
            try
            {
                componentDescriptor = PlexusTools.buildComponentDescriptor( componentConfiguration, realm );
            }
            catch ( PlexusConfigurationException e )
            {
                 // This is not the most accurate of exceptions as the only real case where this exception
              // will be thrown is when the implementation class of the component sited cannot be loaded.
              // In the case where role and implementation classes do not exist then we just shouldn't
              // create the component descriptor. All information should be taken from annotations which
              // will be correct, so in the case we can't load the class it must be coming from and older
              // hand written descriptor which is incorrect.
             
              continue;             
            }

            componentDescriptor.setSource( source );

            componentDescriptor.setComponentType( "plexus" );

            componentDescriptor.setComponentSetDescriptor( componentSetDescriptor );

            componentDescriptors.add( componentDescriptor );
        }

        componentSetDescriptor.setComponents( componentDescriptors );

        componentSetDescriptor.setSource( source );

        return componentSetDescriptor;
    }
View Full Code Here

                reader = ReaderFactory.newXmlReader( conn.getInputStream() );

                InterpolationFilterReader interpolationFilterReader = new InterpolationFilterReader( reader, new ContextMapAdapter( context ) );

                ComponentSetDescriptor componentSetDescriptor = createComponentDescriptors( interpolationFilterReader, url.toString(), realm );

                componentSetDescriptors.add( componentSetDescriptor );
            }
            catch ( IOException ex )
            {
View Full Code Here

            List componentSetDescriptors = componentDiscoverer.findComponents( container.getContext(), realm );

            for ( Iterator j = componentSetDescriptors.iterator(); j.hasNext(); )
            {
                ComponentSetDescriptor componentSet = (ComponentSetDescriptor) j.next();

                List componentDescriptors = componentSet.getComponents();

                if ( componentDescriptors != null )
                {
                    for ( Iterator k = componentDescriptors.iterator(); k.hasNext(); )
                    {
View Full Code Here

    {
        PlexusConfiguration configuration = discoverConfiguration( context, classRealm );

        List componentSetDescriptors = new ArrayList();

        ComponentSetDescriptor componentSetDescriptor = createComponentDescriptors( configuration, classRealm );

        componentSetDescriptors.add( componentSetDescriptor );

        // Fire the event
        ComponentDiscoveryEvent event = new ComponentDiscoveryEvent( componentSetDescriptor );
View Full Code Here

TOP

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

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.