Examples of PlexusConfigurationException


Examples of org.codehaus.plexus.configuration.PlexusConfigurationException

                {
                    componentConfigurationFiles = FileUtils.getFiles( configurationsDirectory, "**/*.conf", "**/*.xml" );
                }
                catch ( IOException e )
                {
                    throw new PlexusConfigurationException( "Unable to locate configuration files", e );
                }

                for ( Iterator i = componentConfigurationFiles.iterator(); i.hasNext(); )
                {
                    File componentConfigurationFile = (File) i.next();

                    Reader reader = null;
                    try
                    {
                        reader = ReaderFactory.newXmlReader( componentConfigurationFile );
                        PlexusConfiguration componentConfiguration = PlexusTools
                            .buildConfiguration( componentConfigurationFile.getAbsolutePath(),
                                getInterpolationConfigurationReader( reader ) );

                        componentsConfiguration.addChild( componentConfiguration.getChild( "components" ) );
                    }
                    catch ( FileNotFoundException e )
                    {
                        throw new PlexusConfigurationException( "File " + componentConfigurationFile
                            + " disappeared before processing", e );
                    }
                    catch ( IOException e )
                    {
                        throw new PlexusConfigurationException( "IO error while reading " + componentConfigurationFile, e );
                    }
                    finally
                    {
                        IOUtil.close( reader );
                    }
View Full Code Here

Examples of org.codehaus.plexus.configuration.PlexusConfigurationException

        {
            return new XmlPlexusConfiguration( Xpp3DomBuilder.build( configuration ) );
        }
        catch ( IOException e )
        {
            throw new PlexusConfigurationException( "Error creating configuration", e );
        }
        catch ( XmlPullParserException e )
        {
            throw new PlexusConfigurationException( "Error creating configuration", e );
        }
    }
View Full Code Here

Examples of org.codehaus.plexus.configuration.PlexusConfigurationException

        {
            resources = classRealm.findResources( PLEXUS_XML_RESOURCE );
        }
        catch ( IOException e )
        {
            throw new PlexusConfigurationException( "Error retrieving configuration resources: " + PLEXUS_XML_RESOURCE + " from class realm: " + classRealm.getId(), e );
        }

        for ( Enumeration e = resources; e.hasMoreElements(); )
        {
            URL url = (URL) e.nextElement();

            InputStreamReader reader = null;
            try
            {
                reader = new InputStreamReader( url.openStream() );

                ContextMapAdapter contextAdapter = new ContextMapAdapter( context );

                InterpolationFilterReader interpolationFilterReader = new InterpolationFilterReader( reader,
                                                                                                     contextAdapter );

                PlexusConfiguration discoveredConfig = PlexusTools.buildConfiguration( url.toExternalForm(), interpolationFilterReader );

                if ( configuration == null )
                {
                    configuration = discoveredConfig;
                }
                else
                {
                    configuration = PlexusConfigurationMerger.merge( configuration, discoveredConfig );
                }
            }
            catch ( IOException ex )
            {
                throw new PlexusConfigurationException( "Error reading configuration from: " + url.toExternalForm(), ex );
            }
            finally
            {
                IOUtil.close( reader );
            }
View Full Code Here

Examples of org.codehaus.plexus.configuration.PlexusConfigurationException

                {
                    componentDescriptor = PlexusTools.buildComponentDescriptor( componentConfiguration );
                }
                catch ( PlexusConfigurationException e )
                {
                    throw new PlexusConfigurationException( "Cannot build component descriptor from resource found in:\n" +
                                         Arrays.asList( classRealm.getURLs() ), e );
                }

                componentDescriptor.setComponentType( "plexus" );
View Full Code Here

Examples of org.codehaus.plexus.configuration.PlexusConfigurationException

            {
                componentDescriptor = PlexusTools.buildComponentDescriptor( componentConfiguration );
            }
            catch ( PlexusConfigurationException e )
            {
                throw new PlexusConfigurationException( "Cannot process component descriptor: " + source, e );
            }

            componentDescriptor.setComponentType( "plexus" );

            componentDescriptors.add( componentDescriptor );
View Full Code Here

Examples of org.codehaus.plexus.configuration.PlexusConfigurationException

            else
                resources = classRealm.findResources( getComponentDescriptorLocation() );
        }
        catch ( IOException e )
        {
            throw new PlexusConfigurationException( "Unable to retrieve resources for: " +
                getComponentDescriptorLocation() + " in class realm: " + classRealm.getId() );
        }
        for ( Enumeration e = resources; e.hasMoreElements(); )
        {
            URL url = (URL) e.nextElement();

            InputStreamReader reader = null;
            try
            {
                URLConnection conn = url.openConnection();

                conn.setUseCaches( false );

                conn.connect();

                reader = new InputStreamReader( conn.getInputStream() );

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

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

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

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

                componentSetDescriptors.add( componentSetDescriptor );

                // Fire the event
                ComponentDiscoveryEvent event = new ComponentDiscoveryEvent( componentSetDescriptor );

                manager.fireComponentDiscoveryEvent( event );
            }
            catch ( IOException ex )
            {
                throw new PlexusConfigurationException( "Error reading configuration " + url, ex );
            }
            finally
            {
                IOUtil.close( reader );
            }
View Full Code Here

Examples of org.codehaus.plexus.configuration.PlexusConfigurationException

                {
                    componentConfigurationFiles = FileUtils.getFiles( configurationsDirectory, "**/*.conf", "**/*.xml" );
                }
                catch ( IOException e )
                {
                    throw new PlexusConfigurationException( "Unable to locate configuration files", e );
                }

                for ( Iterator i = componentConfigurationFiles.iterator(); i.hasNext(); )
                {
                    File componentConfigurationFile = (File) i.next();

                    FileReader reader = null;
                    try
                    {
                        reader = new FileReader( componentConfigurationFile );
                        PlexusConfiguration componentConfiguration = PlexusTools
                            .buildConfiguration( componentConfigurationFile.getAbsolutePath(),
                                                 getInterpolationConfigurationReader( reader ) );

                        componentsConfiguration.addChild( componentConfiguration.getChild( "components" ) );
                    }
                    catch ( FileNotFoundException e )
                    {
                        throw new PlexusConfigurationException( "File " + componentConfigurationFile
                            + " disappeared before processing", e );
                    }
                    finally
                    {
                        IOUtil.close( reader );
View Full Code Here

Examples of org.codehaus.plexus.configuration.PlexusConfigurationException

        {
            return new XmlPlexusConfiguration( Xpp3DomBuilder.build( configuration ) );
        }
        catch ( XmlPullParserException e )
        {
            throw new PlexusConfigurationException( "Failed to parse configuration resource: \'" + resourceName + "\'\nError was: \'" + e.getLocalizedMessage() + "\'", e );
        }
        catch ( IOException e )
        {
            throw new PlexusConfigurationException( "IO error building configuration from: " + resourceName, e );
        }
    }
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.