Package org.apache.maven.toolchain.model

Examples of org.apache.maven.toolchain.model.PersistedToolchains


    public ToolchainPrivate[] getToolchainsForType( String type )
        throws MisconfiguredToolchainException
    {
        try
        {
            PersistedToolchains pers = readToolchainSettings ();
            Map factories = container.lookupMap( ToolchainFactory.ROLE );
            List toRet = new ArrayList(  );
            if ( pers != null )
            {
                List lst = pers.getToolchains();
                if ( lst != null )
                {
                    Iterator it = lst.iterator();
                    while ( it.hasNext() )
                    {
View Full Code Here


     * @return PersistedToolchains
     */
    private PersistedToolchains parsePersistedToolchains( String tagName, XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        PersistedToolchains persistedToolchains = new PersistedToolchains();
        java.util.Set parsed = new java.util.HashSet();
        int eventType = parser.getEventType();
        boolean foundRoot = false;
        persistedToolchains.setModelEncoding( parser.getInputEncoding() );
        while ( eventType != XmlPullParser.END_DOCUMENT )
        {
            if ( eventType == XmlPullParser.START_TAG )
            {
                if ( parser.getName().equals( tagName ) )
                {
                    foundRoot = true;
                }
                else if ( strict && ! foundRoot )
                {
                    throw new XmlPullParserException( "Expected root element '" + tagName + "' but found '" + parser.getName() + "'", parser, null );
                }
                else if ( parser.getName().equals( "toolchain" ) )
                {
                    java.util.List toolchains = persistedToolchains.getToolchains();
                    if ( toolchains == null )
                    {
                        toolchains = new java.util.ArrayList/*<ToolchainModel>*/();
                        persistedToolchains.setToolchains( toolchains );
                    }
                    toolchains.add( parseToolchainModel( "toolchain", parser, strict ) );
                }
                else if ( strict )
                {
View Full Code Here

    private ToolchainsBuilder toolchainsBuilder;

    public ToolchainPrivate[] getToolchainsForType( String type, MavenSession context )
        throws MisconfiguredToolchainException
    {
        PersistedToolchains pers = toolchainsBuilder.build( context.getRequest().getUserToolchainsFile() );

        List<ToolchainPrivate> toRet = new ArrayList<ToolchainPrivate>();

        if ( pers != null )
        {
            List<ToolchainModel> lst = pers.getToolchains();
            if ( lst != null )
            {
                for ( ToolchainModel toolchainModel : lst )
                {
                    ToolchainFactory fact = factories.get( toolchainModel.getType() );
View Full Code Here

    private Logger logger;

    public PersistedToolchains build( File userToolchainsFile )
        throws MisconfiguredToolchainException
    {
        PersistedToolchains toolchains = null;

        if ( userToolchainsFile != null && userToolchainsFile.isFile() )
        {
            Reader in = null;
            try
View Full Code Here

    private ToolchainsBuilder toolchainsBuilder;

    public ToolchainPrivate[] getToolchainsForType( String type, MavenSession context )
        throws MisconfiguredToolchainException
    {
        PersistedToolchains pers = toolchainsBuilder.build( context.getRequest().getUserToolchainsFile() );

        List<ToolchainPrivate> toRet = new ArrayList<ToolchainPrivate>();

        ToolchainFactory fact = factories.get( type );
        if ( fact == null )
        {
            logger.error( "Missing toolchain factory for type: " + type
                + ". Possibly caused by misconfigured project." );
        }
        else if ( pers != null )
        {
            List<ToolchainModel> lst = pers.getToolchains();
            if ( lst != null )
            {
                for ( ToolchainModel toolchainModel : lst )
                {
                    if ( type.equals( toolchainModel.getType() ) )
View Full Code Here

        try
        {
            jdksIS = ToolchainModel.class.getResourceAsStream( "toolchains-jdks.xml" );
            jdksExtraIS = ToolchainModel.class.getResourceAsStream( "toolchains-jdks-extra.xml" );
           
            PersistedToolchains jdks = reader.read( jdksIS );
            PersistedToolchains jdksExtra = reader.read( jdksExtraIS );
           
            JavaToolchainImpl tc1 = new JavaToolchainImpl( jdks.getToolchains().get( 0 ), null );
            JavaToolchainImpl tc2 = new JavaToolchainImpl( jdksExtra.getToolchains().get( 0 ), null );
           
            assertTrue( tc1.equals( tc1 ) );
            assertFalse( tc1.equals( tc2 ) );
            assertFalse( tc2.equals( tc1 ) );
            assertTrue( tc2.equals( tc2 ) );
View Full Code Here

    public ToolchainPrivate[] getToolchainsForType( String type )
        throws MisconfiguredToolchainException
    {
        try
        {
            PersistedToolchains pers = readToolchainSettings ();
            Map factories = container.lookupMap( ToolchainFactory.ROLE );
            List toRet = new ArrayList(  );
            if ( pers != null )
            {
                List lst = pers.getToolchains();
                if ( lst != null )
                {
                    Iterator it = lst.iterator();
                    while ( it.hasNext() )
                    {
View Full Code Here

     */
    private PersistedToolchains parsePersistedToolchains( XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        String tagName = parser.getName();
        PersistedToolchains persistedToolchains = new PersistedToolchains();
        for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
        {
            String name = parser.getAttributeName( i );
            String value = parser.getAttributeValue( i );

            if ( name.indexOf( ':' ) >= 0 )
            {
                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
            }
            else if ( "xmlns".equals( name ) )
            {
                // ignore xmlns attribute in root class, which is a reserved attribute name
            }
            else
            {
                checkUnknownAttribute( parser, name, tagName, strict );
            }
        }
        java.util.Set parsed = new java.util.HashSet();
        while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
        {
            if ( "toolchain".equals( parser.getName() ) )
            {
                java.util.List toolchains = persistedToolchains.getToolchains();
                if ( toolchains == null )
                {
                    toolchains = new java.util.ArrayList/*<ToolchainModel>*/();
                    persistedToolchains.setToolchains( toolchains );
                }
                toolchains.add( parseToolchainModel( parser, strict ) );
            }
            else
            {
View Full Code Here

            {
                if ( strict && ! "toolchains".equals( parser.getName() ) )
                {
                    throw new XmlPullParserException( "Expected root element 'toolchains' but found '" + parser.getName() + "'", parser, null );
                }
                PersistedToolchains persistedToolchains = parsePersistedToolchains( parser, strict );
                persistedToolchains.setModelEncoding( parser.getInputEncoding() );
                return persistedToolchains;
            }
            eventType = parser.next();
        }
        throw new XmlPullParserException( "Expected root element 'toolchains' but found no element at all: invalid XML document", parser, null );
View Full Code Here

TOP

Related Classes of org.apache.maven.toolchain.model.PersistedToolchains

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.