Package org.apache.maven.project

Examples of org.apache.maven.project.Model


     * @param parser
     */
    private Model parseModel(String tagName, XmlPullParser parser, boolean strict, String encoding)
        throws IOException, XmlPullParserException
    {
        Model model = new Model();
        model.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        int eventType = parser.getEventType();
        boolean foundRoot = false;
        while ( eventType != XmlPullParser.END_DOCUMENT )
        {
            if ( eventType == XmlPullParser.START_TAG )
            {
                if ( parser.getName().equals( tagName ) )
                {
                    foundRoot = true;
                }
                else if ( parser.getName().equals( "extend" )  )
                {
                    if ( parsed.contains( "extend" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "extend" );
                    model.setExtend( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "pomVersion" )  )
                {
                    if ( parsed.contains( "pomVersion" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "pomVersion" );
                    model.setPomVersion( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "groupId" )  )
                {
                    if ( parsed.contains( "groupId" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "groupId" );
                    model.setGroupId( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "artifactId" )  )
                {
                    if ( parsed.contains( "artifactId" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "artifactId" );
                    model.setArtifactId( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "id" )  )
                {
                    if ( parsed.contains( "id" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "id" );
                    model.setId( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "name" )  )
                {
                    if ( parsed.contains( "name" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "name" );
                    model.setName( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "currentVersion" )  )
                {
                    if ( parsed.contains( "currentVersion" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "currentVersion" );
                    model.setCurrentVersion( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "shortDescription" )  )
                {
                    if ( parsed.contains( "shortDescription" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "shortDescription" );
                    model.setShortDescription( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "description" )  )
                {
                    if ( parsed.contains( "description" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "description" );
                    model.setDescription( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "url" )  )
                {
                    if ( parsed.contains( "url" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "url" );
                    model.setUrl( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "logo" )  )
                {
                    if ( parsed.contains( "logo" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "logo" );
                    model.setLogo( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "issueTrackingUrl" )  )
                {
                    if ( parsed.contains( "issueTrackingUrl" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "issueTrackingUrl" );
                    model.setIssueTrackingUrl( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "inceptionYear" )  )
                {
                    if ( parsed.contains( "inceptionYear" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "inceptionYear" );
                    model.setInceptionYear( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "gumpRepositoryId" )  )
                {
                    if ( parsed.contains( "gumpRepositoryId" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "gumpRepositoryId" );
                    model.setGumpRepositoryId( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "siteAddress" )  )
                {
                    if ( parsed.contains( "siteAddress" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "siteAddress" );
                    model.setSiteAddress( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "siteDirectory" )  )
                {
                    if ( parsed.contains( "siteDirectory" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "siteDirectory" );
                    model.setSiteDirectory( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "distributionSite" )  )
                {
                    if ( parsed.contains( "distributionSite" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "distributionSite" );
                    model.setDistributionSite( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "distributionDirectory" )  )
                {
                    if ( parsed.contains( "distributionDirectory" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "distributionDirectory" );
                    model.setDistributionDirectory( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "mailingLists" )  )
                {
                    if ( parsed.contains( "mailingLists" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "mailingLists" );
                    java.util.List mailingLists = new java.util.ArrayList();
                    model.setMailingLists( mailingLists );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        if ( parser.getName().equals( "mailingList" ) )
                        {
                            mailingLists.add( parseMailingList( "mailingList", parser, strict, encoding ) );
                        }
                        else
                        {
                            parser.nextText();
                        }
                    }
                }
                else if ( parser.getName().equals( "developers" )  )
                {
                    if ( parsed.contains( "developers" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "developers" );
                    java.util.List developers = new java.util.ArrayList();
                    model.setDevelopers( developers );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        if ( parser.getName().equals( "developer" ) )
                        {
                            developers.add( parseDeveloper( "developer", parser, strict, encoding ) );
                        }
                        else
                        {
                            parser.nextText();
                        }
                    }
                }
                else if ( parser.getName().equals( "contributors" )  )
                {
                    if ( parsed.contains( "contributors" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "contributors" );
                    java.util.List contributors = new java.util.ArrayList();
                    model.setContributors( contributors );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        if ( parser.getName().equals( "contributor" ) )
                        {
                            contributors.add( parseContributor( "contributor", parser, strict, encoding ) );
                        }
                        else
                        {
                            parser.nextText();
                        }
                    }
                }
                else if ( parser.getName().equals( "licenses" )  )
                {
                    if ( parsed.contains( "licenses" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "licenses" );
                    java.util.List licenses = new java.util.ArrayList();
                    model.setLicenses( licenses );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        if ( parser.getName().equals( "license" ) )
                        {
                            licenses.add( parseLicense( "license", parser, strict, encoding ) );
                        }
                        else
                        {
                            parser.nextText();
                        }
                    }
                }
                else if ( parser.getName().equals( "versions" )  )
                {
                    if ( parsed.contains( "versions" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "versions" );
                    java.util.List versions = new java.util.ArrayList();
                    model.setVersions( versions );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        if ( parser.getName().equals( "version" ) )
                        {
                            versions.add( parseVersion( "version", parser, strict, encoding ) );
                        }
                        else
                        {
                            parser.nextText();
                        }
                    }
                }
                else if ( parser.getName().equals( "branches" )  )
                {
                    if ( parsed.contains( "branches" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "branches" );
                    java.util.List branches = new java.util.ArrayList();
                    model.setBranches( branches );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        if ( parser.getName().equals( "branch" ) )
                        {
                            branches.add( parseBranch( "branch", parser, strict, encoding ) );
                        }
                        else
                        {
                            parser.nextText();
                        }
                    }
                }
                else if ( parser.getName().equals( "packageGroups" )  )
                {
                    if ( parsed.contains( "packageGroups" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "packageGroups" );
                    java.util.List packageGroups = new java.util.ArrayList();
                    model.setPackageGroups( packageGroups );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        if ( parser.getName().equals( "packageGroup" ) )
                        {
                            packageGroups.add( parsePackageGroup( "packageGroup", parser, strict, encoding ) );
                        }
                        else
                        {
                            parser.nextText();
                        }
                    }
                }
                else if ( parser.getName().equals( "reports" )  )
                {
                    if ( parsed.contains( "reports" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "reports" );
                    java.util.List reports = new java.util.ArrayList();
                    model.setReports( reports );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        if ( parser.getName().equals( "report" ) )
                        {
                            reports.add( getTrimmedValue( parser.nextText()) );
                        }
                        else
                        {
                            parser.nextText();
                        }
                    }
                }
                else if ( parser.getName().equals( "repository" )  )
                {
                    if ( parsed.contains( "repository" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "repository" );
                    model.setRepository( parseRepository( "repository", parser, strict, encoding ) );
                }
                else if ( parser.getName().equals( "organization" ) || parser.getName().equals( "organisation" )  )
                {
                    if ( parsed.contains( "organization" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "organization" );
                    model.setOrganization( parseOrganization( "organization", parser, strict, encoding ) );
                }
                else if ( parser.getName().equals( "properties" )  )
                {
                    if ( parsed.contains( "properties" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "properties" );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        String key = parser.getName();
                        String value = parser.nextText()
                        .trim()
                        ;
                        model.addProperty( key, value );
                    }
                }
                else if ( parser.getName().equals( "package" )  )
                {
                    if ( parsed.contains( "package" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "package" );
                    model.setPackageName( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "build" )  )
                {
                    if ( parsed.contains( "build" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "build" );
                    model.setBuild( parseBuild( "build", parser, strict, encoding ) );
                }
                else if ( parser.getName().equals( "dependencies" )  )
                {
                    if ( parsed.contains( "dependencies" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "dependencies" );
                    java.util.List dependencies = new java.util.ArrayList();
                    model.setDependencies( dependencies );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        if ( parser.getName().equals( "dependency" ) )
                        {
                            dependencies.add( parseDependency( "dependency", parser, strict, encoding ) );
View Full Code Here


     * @param xmlStreamReader
     */
    private Model parseModel(String tagName, XMLStreamReader xmlStreamReader, boolean strict, String encoding)
        throws IOException, XMLStreamException
    {
        Model model = new Model();
        model.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        boolean foundRoot = false;
        while ( xmlStreamReader.hasNext() )
        {
            int eventType = xmlStreamReader.next();
            if ( eventType == XMLStreamConstants.START_ELEMENT )
            {
                if ( xmlStreamReader.getLocalName().equals( tagName ) )
                {
                    foundRoot = true;
                }
                else if ( xmlStreamReader.getLocalName().equals( "extend" )  )
                {
                    if ( parsed.contains( "extend" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "extend" );
                    model.setExtend( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "pomVersion" )  )
                {
                    if ( parsed.contains( "pomVersion" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "pomVersion" );
                    model.setPomVersion( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "groupId" )  )
                {
                    if ( parsed.contains( "groupId" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "groupId" );
                    model.setGroupId( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "artifactId" )  )
                {
                    if ( parsed.contains( "artifactId" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "artifactId" );
                    model.setArtifactId( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "id" )  )
                {
                    if ( parsed.contains( "id" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "id" );
                    model.setId( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "name" )  )
                {
                    if ( parsed.contains( "name" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "name" );
                    model.setName( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "currentVersion" )  )
                {
                    if ( parsed.contains( "currentVersion" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "currentVersion" );
                    model.setCurrentVersion( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "shortDescription" )  )
                {
                    if ( parsed.contains( "shortDescription" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "shortDescription" );
                    model.setShortDescription( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "description" )  )
                {
                    if ( parsed.contains( "description" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "description" );
                    model.setDescription( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "url" )  )
                {
                    if ( parsed.contains( "url" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "url" );
                    model.setUrl( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "logo" )  )
                {
                    if ( parsed.contains( "logo" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "logo" );
                    model.setLogo( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "issueTrackingUrl" )  )
                {
                    if ( parsed.contains( "issueTrackingUrl" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "issueTrackingUrl" );
                    model.setIssueTrackingUrl( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "inceptionYear" )  )
                {
                    if ( parsed.contains( "inceptionYear" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "inceptionYear" );
                    model.setInceptionYear( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "gumpRepositoryId" )  )
                {
                    if ( parsed.contains( "gumpRepositoryId" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "gumpRepositoryId" );
                    model.setGumpRepositoryId( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "siteAddress" )  )
                {
                    if ( parsed.contains( "siteAddress" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "siteAddress" );
                    model.setSiteAddress( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "siteDirectory" )  )
                {
                    if ( parsed.contains( "siteDirectory" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "siteDirectory" );
                    model.setSiteDirectory( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "distributionSite" )  )
                {
                    if ( parsed.contains( "distributionSite" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "distributionSite" );
                    model.setDistributionSite( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "distributionDirectory" )  )
                {
                    if ( parsed.contains( "distributionDirectory" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "distributionDirectory" );
                    model.setDistributionDirectory( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "mailingLists" )  )
                {
                    if ( parsed.contains( "mailingLists" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "mailingLists" );
                    java.util.List mailingLists = new java.util.ArrayList();
                    model.setMailingLists( mailingLists );
                    while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
                    {
                        if ( xmlStreamReader.getLocalName().equals( "mailingList" ) )
                        {
                            model.addMailingList( parseMailingList( "mailingList", xmlStreamReader, strict, encoding ) );
                        }
                        else
                        {
                            throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                        }
                    }
                }
                else if ( xmlStreamReader.getLocalName().equals( "developers" )  )
                {
                    if ( parsed.contains( "developers" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "developers" );
                    java.util.List developers = new java.util.ArrayList();
                    model.setDevelopers( developers );
                    while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
                    {
                        if ( xmlStreamReader.getLocalName().equals( "developer" ) )
                        {
                            model.addDeveloper( parseDeveloper( "developer", xmlStreamReader, strict, encoding ) );
                        }
                        else
                        {
                            throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                        }
                    }
                }
                else if ( xmlStreamReader.getLocalName().equals( "contributors" )  )
                {
                    if ( parsed.contains( "contributors" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "contributors" );
                    java.util.List contributors = new java.util.ArrayList();
                    model.setContributors( contributors );
                    while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
                    {
                        if ( xmlStreamReader.getLocalName().equals( "contributor" ) )
                        {
                            model.addContributor( parseContributor( "contributor", xmlStreamReader, strict, encoding ) );
                        }
                        else
                        {
                            throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                        }
                    }
                }
                else if ( xmlStreamReader.getLocalName().equals( "licenses" )  )
                {
                    if ( parsed.contains( "licenses" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "licenses" );
                    java.util.List licenses = new java.util.ArrayList();
                    model.setLicenses( licenses );
                    while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
                    {
                        if ( xmlStreamReader.getLocalName().equals( "license" ) )
                        {
                            model.addLicense( parseLicense( "license", xmlStreamReader, strict, encoding ) );
                        }
                        else
                        {
                            throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                        }
                    }
                }
                else if ( xmlStreamReader.getLocalName().equals( "versions" )  )
                {
                    if ( parsed.contains( "versions" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "versions" );
                    java.util.List versions = new java.util.ArrayList();
                    model.setVersions( versions );
                    while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
                    {
                        if ( xmlStreamReader.getLocalName().equals( "version" ) )
                        {
                            model.addVersion( parseVersion( "version", xmlStreamReader, strict, encoding ) );
                        }
                        else
                        {
                            throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                        }
                    }
                }
                else if ( xmlStreamReader.getLocalName().equals( "branches" )  )
                {
                    if ( parsed.contains( "branches" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "branches" );
                    java.util.List branches = new java.util.ArrayList();
                    model.setBranches( branches );
                    while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
                    {
                        if ( xmlStreamReader.getLocalName().equals( "branch" ) )
                        {
                            model.addBranch( parseBranch( "branch", xmlStreamReader, strict, encoding ) );
                        }
                        else
                        {
                            throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                        }
                    }
                }
                else if ( xmlStreamReader.getLocalName().equals( "packageGroups" )  )
                {
                    if ( parsed.contains( "packageGroups" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "packageGroups" );
                    java.util.List packageGroups = new java.util.ArrayList();
                    model.setPackageGroups( packageGroups );
                    while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
                    {
                        if ( xmlStreamReader.getLocalName().equals( "packageGroup" ) )
                        {
                            model.addPackageGroup( parsePackageGroup( "packageGroup", xmlStreamReader, strict, encoding ) );
                        }
                        else
                        {
                            throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                        }
                    }
                }
                else if ( xmlStreamReader.getLocalName().equals( "reports" )  )
                {
                    if ( parsed.contains( "reports" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "reports" );
                    java.util.List reports = new java.util.ArrayList();
                    model.setReports( reports );
                    while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
                    {
                        if ( xmlStreamReader.getLocalName().equals( "report" ) )
                        {
                            reports.add( getTrimmedValue( xmlStreamReader.getElementText()) );
                        }
                        else
                        {
                            throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                        }
                    }
                }
                else if ( xmlStreamReader.getLocalName().equals( "repository" )  )
                {
                    if ( parsed.contains( "repository" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "repository" );
                    model.setRepository( parseRepository( "repository", xmlStreamReader, strict, encoding ) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "organization" ) || xmlStreamReader.getLocalName().equals( "organisation" )  )
                {
                    if ( parsed.contains( "organization" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "organization" );
                    model.setOrganization( parseOrganization( "organization", xmlStreamReader, strict, encoding ) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "properties" )  )
                {
                    if ( parsed.contains( "properties" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "properties" );
                    while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
                    {
                        String key = xmlStreamReader.getLocalName();
                        String value = xmlStreamReader.getElementText()
                        .trim()
                        ;
                        model.addProperty( key, value );
                    }
                }
                else if ( xmlStreamReader.getLocalName().equals( "package" )  )
                {
                    if ( parsed.contains( "package" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "package" );
                    model.setPackageName( getTrimmedValue( xmlStreamReader.getElementText()) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "build" )  )
                {
                    if ( parsed.contains( "build" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "build" );
                    model.setBuild( parseBuild( "build", xmlStreamReader, strict, encoding ) );
                }
                else if ( xmlStreamReader.getLocalName().equals( "dependencies" )  )
                {
                    if ( parsed.contains( "dependencies" ) )
                    {
                        throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                    parsed.add( "dependencies" );
                    java.util.List dependencies = new java.util.ArrayList();
                    model.setDependencies( dependencies );
                    while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
                    {
                        if ( xmlStreamReader.getLocalName().equals( "dependency" ) )
                        {
                            model.addDependency( parseDependency( "dependency", xmlStreamReader, strict, encoding ) );
                        }
                        else
                        {
                            throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                        }
View Full Code Here

        throws IOException, XMLStreamException
    {
        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader( reader );
       
        String encoding = xmlStreamReader.getCharacterEncodingScheme();
        Model value = parseModel( "project", xmlStreamReader, strict, encoding );
        resolveReferences( value );
        return value;
    } //-- Model read(Reader, boolean)
View Full Code Here

    {
        File file = new File(filePath);
        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader( file.toURL().toExternalForm(), new FileInputStream(file) );
       
        String encoding = xmlStreamReader.getCharacterEncodingScheme();
        Model value = parseModel( "project", xmlStreamReader, strict, encoding );
        resolveReferences( value );
        return value;
    } //-- Model read(String, boolean)
View Full Code Here

     * @param element
     */
    private Model parseModel(String tagName, Element element, boolean strict, String encoding)
        throws IOException, DocumentException
    {
        Model model = new Model();
        model.setModelEncoding( encoding );
        if ( strict )
        {
            if ( !element.getName().equals( tagName ) )
            {
                throw new DocumentException( "Error parsing model: root element tag is '" + element.getName() + "' instead of '" + tagName + "'" );
            }
        }
        java.util.Set parsed = new java.util.HashSet();
        for ( Iterator i = element.nodeIterator(); i.hasNext(); )
        {
            Node node = (Node) i.next();
            if ( node.getNodeType() != Node.ELEMENT_NODE )
            {
            }
            else
            {
                Element childElement = (Element) node;
                if ( childElement.getName().equals( "extend" )  )
                {
                    if ( parsed.contains( "extend" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "extend" );
                    model.setExtend( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "pomVersion" )  )
                {
                    if ( parsed.contains( "pomVersion" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "pomVersion" );
                    model.setPomVersion( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "groupId" )  )
                {
                    if ( parsed.contains( "groupId" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "groupId" );
                    model.setGroupId( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "artifactId" )  )
                {
                    if ( parsed.contains( "artifactId" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "artifactId" );
                    model.setArtifactId( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "id" )  )
                {
                    if ( parsed.contains( "id" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "id" );
                    model.setId( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "name" )  )
                {
                    if ( parsed.contains( "name" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "name" );
                    model.setName( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "currentVersion" )  )
                {
                    if ( parsed.contains( "currentVersion" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "currentVersion" );
                    model.setCurrentVersion( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "shortDescription" )  )
                {
                    if ( parsed.contains( "shortDescription" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "shortDescription" );
                    model.setShortDescription( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "description" )  )
                {
                    if ( parsed.contains( "description" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "description" );
                    model.setDescription( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "url" )  )
                {
                    if ( parsed.contains( "url" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "url" );
                    model.setUrl( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "logo" )  )
                {
                    if ( parsed.contains( "logo" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "logo" );
                    model.setLogo( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "issueTrackingUrl" )  )
                {
                    if ( parsed.contains( "issueTrackingUrl" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "issueTrackingUrl" );
                    model.setIssueTrackingUrl( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "inceptionYear" )  )
                {
                    if ( parsed.contains( "inceptionYear" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "inceptionYear" );
                    model.setInceptionYear( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "gumpRepositoryId" )  )
                {
                    if ( parsed.contains( "gumpRepositoryId" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "gumpRepositoryId" );
                    model.setGumpRepositoryId( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "siteAddress" )  )
                {
                    if ( parsed.contains( "siteAddress" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "siteAddress" );
                    model.setSiteAddress( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "siteDirectory" )  )
                {
                    if ( parsed.contains( "siteDirectory" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "siteDirectory" );
                    model.setSiteDirectory( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "distributionSite" )  )
                {
                    if ( parsed.contains( "distributionSite" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "distributionSite" );
                    model.setDistributionSite( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "distributionDirectory" )  )
                {
                    if ( parsed.contains( "distributionDirectory" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "distributionDirectory" );
                    model.setDistributionDirectory( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "mailingLists" )  )
                {
                    if ( parsed.contains( "mailingLists" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "mailingLists" );
                    java.util.List mailingLists = new java.util.ArrayList();
                    model.setMailingLists( mailingLists );
                    for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
                    {
                        Node n = (Node) j.next();
                        if ( n.getNodeType() != Node.ELEMENT_NODE )
                        {
                        }
                        else
                        {
                            Element listElement = (Element) n;
                            if ( listElement.getName().equals( "mailingList" ) )
                            {
                                mailingLists.add( parseMailingList( "mailingList", listElement, strict, encoding ) );
                            }
                            else
                            {
                            }
                        }
                    }
                }
                else if ( childElement.getName().equals( "developers" )  )
                {
                    if ( parsed.contains( "developers" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "developers" );
                    java.util.List developers = new java.util.ArrayList();
                    model.setDevelopers( developers );
                    for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
                    {
                        Node n = (Node) j.next();
                        if ( n.getNodeType() != Node.ELEMENT_NODE )
                        {
                        }
                        else
                        {
                            Element listElement = (Element) n;
                            if ( listElement.getName().equals( "developer" ) )
                            {
                                developers.add( parseDeveloper( "developer", listElement, strict, encoding ) );
                            }
                            else
                            {
                            }
                        }
                    }
                }
                else if ( childElement.getName().equals( "contributors" )  )
                {
                    if ( parsed.contains( "contributors" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "contributors" );
                    java.util.List contributors = new java.util.ArrayList();
                    model.setContributors( contributors );
                    for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
                    {
                        Node n = (Node) j.next();
                        if ( n.getNodeType() != Node.ELEMENT_NODE )
                        {
                        }
                        else
                        {
                            Element listElement = (Element) n;
                            if ( listElement.getName().equals( "contributor" ) )
                            {
                                contributors.add( parseContributor( "contributor", listElement, strict, encoding ) );
                            }
                            else
                            {
                            }
                        }
                    }
                }
                else if ( childElement.getName().equals( "licenses" )  )
                {
                    if ( parsed.contains( "licenses" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "licenses" );
                    java.util.List licenses = new java.util.ArrayList();
                    model.setLicenses( licenses );
                    for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
                    {
                        Node n = (Node) j.next();
                        if ( n.getNodeType() != Node.ELEMENT_NODE )
                        {
                        }
                        else
                        {
                            Element listElement = (Element) n;
                            if ( listElement.getName().equals( "license" ) )
                            {
                                licenses.add( parseLicense( "license", listElement, strict, encoding ) );
                            }
                            else
                            {
                            }
                        }
                    }
                }
                else if ( childElement.getName().equals( "versions" )  )
                {
                    if ( parsed.contains( "versions" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "versions" );
                    java.util.List versions = new java.util.ArrayList();
                    model.setVersions( versions );
                    for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
                    {
                        Node n = (Node) j.next();
                        if ( n.getNodeType() != Node.ELEMENT_NODE )
                        {
                        }
                        else
                        {
                            Element listElement = (Element) n;
                            if ( listElement.getName().equals( "version" ) )
                            {
                                versions.add( parseVersion( "version", listElement, strict, encoding ) );
                            }
                            else
                            {
                            }
                        }
                    }
                }
                else if ( childElement.getName().equals( "branches" )  )
                {
                    if ( parsed.contains( "branches" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "branches" );
                    java.util.List branches = new java.util.ArrayList();
                    model.setBranches( branches );
                    for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
                    {
                        Node n = (Node) j.next();
                        if ( n.getNodeType() != Node.ELEMENT_NODE )
                        {
                        }
                        else
                        {
                            Element listElement = (Element) n;
                            if ( listElement.getName().equals( "branch" ) )
                            {
                                branches.add( parseBranch( "branch", listElement, strict, encoding ) );
                            }
                            else
                            {
                            }
                        }
                    }
                }
                else if ( childElement.getName().equals( "packageGroups" )  )
                {
                    if ( parsed.contains( "packageGroups" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "packageGroups" );
                    java.util.List packageGroups = new java.util.ArrayList();
                    model.setPackageGroups( packageGroups );
                    for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
                    {
                        Node n = (Node) j.next();
                        if ( n.getNodeType() != Node.ELEMENT_NODE )
                        {
                        }
                        else
                        {
                            Element listElement = (Element) n;
                            if ( listElement.getName().equals( "packageGroup" ) )
                            {
                                packageGroups.add( parsePackageGroup( "packageGroup", listElement, strict, encoding ) );
                            }
                            else
                            {
                            }
                        }
                    }
                }
                else if ( childElement.getName().equals( "reports" )  )
                {
                    if ( parsed.contains( "reports" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "reports" );
                    java.util.List reports = new java.util.ArrayList();
                    model.setReports( reports );
                    for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
                    {
                        Node n = (Node) j.next();
                        if ( n.getNodeType() != Node.ELEMENT_NODE )
                        {
                        }
                        else
                        {
                            Element listElement = (Element) n;
                            if ( listElement.getName().equals( "report" ) )
                            {
                                reports.add( getTrimmedValue( listElement.getText() ) );
                            }
                            else
                            {
                            }
                        }
                    }
                }
                else if ( childElement.getName().equals( "repository" )  )
                {
                    if ( parsed.contains( "repository" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "repository" );
                    model.setRepository( parseRepository( "repository", childElement, strict, encoding ) );
                }
                else if ( childElement.getName().equals( "organization" ) || childElement.getName().equals( "organisation" )  )
                {
                    if ( parsed.contains( "organization" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "organization" );
                    model.setOrganization( parseOrganization( "organization", childElement, strict, encoding ) );
                }
                else if ( childElement.getName().equals( "properties" )  )
                {
                    if ( parsed.contains( "properties" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "properties" );
                    for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
                    {
                        Node n = (Node) j.next();
                        if ( n.getNodeType() != Node.ELEMENT_NODE )
                        {
                        }
                        else
                        {
                            Element listElement = (Element) n;
                            String key = listElement.getName();
                            String value = listElement.getText()
                            .trim()
                            ;
                            model.addProperty( key, value );
                        }
                    }
                }
                else if ( childElement.getName().equals( "package" )  )
                {
                    if ( parsed.contains( "package" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "package" );
                    model.setPackageName( getTrimmedValue( childElement.getText() ) );
                }
                else if ( childElement.getName().equals( "build" )  )
                {
                    if ( parsed.contains( "build" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "build" );
                    model.setBuild( parseBuild( "build", childElement, strict, encoding ) );
                }
                else if ( childElement.getName().equals( "dependencies" )  )
                {
                    if ( parsed.contains( "dependencies" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "dependencies" );
                    java.util.List dependencies = new java.util.ArrayList();
                    model.setDependencies( dependencies );
                    for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
                    {
                        Node n = (Node) j.next();
                        if ( n.getNodeType() != Node.ELEMENT_NODE )
                        {
View Full Code Here

TOP

Related Classes of org.apache.maven.project.Model

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.