Package org.apache.maven.model

Examples of org.apache.maven.model.Developer


            {
                Element listElement = element;
                listElement = element.addElement( "developers" );
                for ( Iterator iter = model.getDevelopers().iterator(); iter.hasNext(); )
                {
                    Developer o = (Developer) iter.next();
                    writeDeveloper( o, "developer", listElement );
                }
            }
            if ( model.getContributors() != null && model.getContributors().size() > 0 )
            {
View Full Code Here


                elIt = null;
            }
            Counter innerCount = new Counter( counter.getDepth() + 1 );
            while ( it.hasNext() )
            {
                Developer value = (Developer) it.next();
                Element el;
                if ( elIt != null && elIt.hasNext() )
                {
                    el = (Element) elIt.next();
                    if ( !elIt.hasNext() )
View Full Code Here

     */
    private Developer parseDeveloper( XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        String tagName = parser.getName();
        Developer developer = new Developer();
        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
            {
                checkUnknownAttribute( parser, name, tagName, strict );
            }
        }
        java.util.Set parsed = new java.util.HashSet();
        while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
        {
            if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
            {
                developer.setId( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
            {
                developer.setName( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "email", null, parsed ) )
            {
                developer.setEmail( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
            {
                developer.setUrl( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
            {
                developer.setOrganization( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "organizationUrl", "organisationUrl", parsed ) )
            {
                developer.setOrganizationUrl( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "roles", null, parsed ) )
            {
                java.util.List roles = new java.util.ArrayList/*<String>*/();
                developer.setRoles( roles );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( "role".equals( parser.getName() ) )
                    {
                        roles.add( getTrimmedValue( parser.nextText() ) );
                    }
                    else
                    {
                        checkUnknownElement( parser, strict );
                    }
                }
            }
            else if ( checkFieldWithDuplicate( parser, "timezone", null, parsed ) )
            {
                developer.setTimezone( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
            {
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    String key = parser.getName();
                    String value = parser.nextText().trim();
                    developer.addProperty( key, value );
                }
            }
            else
            {
                checkUnknownElement( parser, strict );
View Full Code Here

        if ( ( model.getDevelopers() != null ) && ( model.getDevelopers().size() > 0 ) )
        {
            serializer.startTag( NAMESPACE, "developers" );
            for ( Iterator iter = model.getDevelopers().iterator(); iter.hasNext(); )
            {
                Developer o = (Developer) iter.next();
                writeDeveloper( o, "developer", serializer );
            }
            serializer.endTag( NAMESPACE, "developers" );
        }
        if ( ( model.getContributors() != null ) && ( model.getContributors().size() > 0 ) )
View Full Code Here

     */
    private Developer parseDeveloper( XmlPullParser parser, boolean strict, InputSource source )
        throws IOException, XmlPullParserException
    {
        String tagName = parser.getName();
        Developer developer = new Developer();
        InputLocation _location;
        _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
        developer.setLocation( "", _location );
        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
            {
                checkUnknownAttribute( parser, name, tagName, strict );
            }
        }
        java.util.Set parsed = new java.util.HashSet();
        while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
        {
            if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                developer.setLocation( "id", _location );
                developer.setId( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                developer.setLocation( "name", _location );
                developer.setName( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "email", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                developer.setLocation( "email", _location );
                developer.setEmail( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                developer.setLocation( "url", _location );
                developer.setUrl( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                developer.setLocation( "organization", _location );
                developer.setOrganization( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "organizationUrl", "organisationUrl", parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                developer.setLocation( "organizationUrl", _location );
                developer.setOrganizationUrl( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "roles", null, parsed ) )
            {
                java.util.List roles = new java.util.ArrayList/*<String>*/();
                developer.setRoles( roles );
                InputLocation _locations;
                _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                developer.setLocation( "roles", _locations );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( "role".equals( parser.getName() ) )
                    {
                        _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                        _locations.setLocation( Integer.valueOf( roles.size() ), _location );
                        roles.add( getTrimmedValue( parser.nextText() ) );
                    }
                    else
                    {
                        checkUnknownElement( parser, strict );
                    }
                }
            }
            else if ( checkFieldWithDuplicate( parser, "timezone", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                developer.setLocation( "timezone", _location );
                developer.setTimezone( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
            {
                InputLocation _locations;
                _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                developer.setLocation( "properties", _locations );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    String key = parser.getName();
                    _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                    _locations.setLocation( key, _location );
                    String value = parser.nextText().trim();
                    developer.addProperty( key, value );
                }
            }
            else
            {
                checkUnknownElement( parser, strict );
View Full Code Here

        assertEquals( "1.0-SNAPSHOT", model.getVersion() );
        assertEquals( "Raven", model.getName() );

        // Developers
        List<Developer> developers = model.getDevelopers();
        Developer dev0 = developers.get( 0 );
        assertEquals( "jvanzyl", dev0.getId() );
        assertEquals( "Jason van Zyl", dev0.getName() );

        // Contributors
        List<Contributor> contributors = model.getContributors();
        Contributor con0 = contributors.get( 0 );
        assertEquals( "Will Price", con0.getName() );
View Full Code Here

TOP

Related Classes of org.apache.maven.model.Developer

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.