Package org.apache.maven.model

Examples of org.apache.maven.model.PatternSet


     * @return PatternSet
     */
    private PatternSet parsePatternSet( String tagName, XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        PatternSet patternSet = new PatternSet();
        java.util.Set parsed = new java.util.HashSet();
        while ( parser.nextTag() == XmlPullParser.START_TAG )
        {
            if ( checkFieldWithDuplicate( parser, "includes", null, parsed ) )
            {
                java.util.List includes = new java.util.ArrayList/*<String>*/();
                patternSet.setIncludes( includes );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "include" ) )
                    {
                        includes.add( getTrimmedValue( parser.nextText() ) );
                    }
                    else if ( strict )
                    {
                        throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
                    }
                    else
                    {
                        // swallow up to end tag since this is not valid
                        while ( parser.next() != XmlPullParser.END_TAG ) {}
                    }
                }
            }
            else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
            {
                java.util.List excludes = new java.util.ArrayList/*<String>*/();
                patternSet.setExcludes( excludes );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "exclude" ) )
                    {
                        excludes.add( getTrimmedValue( parser.nextText() ) );
View Full Code Here


        return includedRules;
    }

    public Set<Rule> selectRules(PatternSet rulePatterns, String... onlyRunRules) {

        PatternSet rulePatternsCopy = new PatternSet();

        if (rulePatterns == null) {
            rulePatternsCopy.setExcludes(new ArrayList<String>());
            rulePatternsCopy.setIncludes(Lists.newArrayList("*"));
        } else {
            if (rulePatterns.getIncludes().isEmpty()) {
                rulePatternsCopy.setIncludes(Lists.newArrayList("*"));
            } else {
                rulePatternsCopy.setIncludes(rulePatterns.getIncludes());
            }

            if (rulePatterns.getExcludes().isEmpty()) {
                rulePatternsCopy.setExcludes(new ArrayList<String>());
            } else {
                rulePatternsCopy.setExcludes(rulePatterns.getExcludes());
            }
        }

        Set<Rule> rulesByList = selectRules(onlyRunRules);

View Full Code Here

     * @param parser
     */
    private PatternSet parsePatternSet(String tagName, XmlPullParser parser, boolean strict, String encoding)
        throws IOException, XmlPullParserException
    {
        PatternSet patternSet = new PatternSet();
        patternSet.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        while ( parser.nextTag() == XmlPullParser.START_TAG )
        {
            if ( parser.getName().equals( "includes" )  )
            {
                if ( parsed.contains( "includes" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "includes" );
                java.util.List includes = new java.util.ArrayList();
                patternSet.setIncludes( includes );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "include" ) )
                    {
                        includes.add( getTrimmedValue( parser.nextText()) );
                    }
                    else
                    {
                        parser.nextText();
                    }
                }
            }
            else if ( parser.getName().equals( "excludes" )  )
            {
                if ( parsed.contains( "excludes" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "excludes" );
                java.util.List excludes = new java.util.ArrayList();
                patternSet.setExcludes( excludes );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "exclude" ) )
                    {
                        excludes.add( getTrimmedValue( parser.nextText()) );
View Full Code Here

     * @param parser
     */
    private PatternSet parsePatternSet(String tagName, XmlPullParser parser, boolean strict, String encoding)
        throws IOException, XmlPullParserException
    {
        PatternSet patternSet = new PatternSet();
        patternSet.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        while ( parser.nextTag() == XmlPullParser.START_TAG )
        {
            if ( parser.getName().equals( "includes" )  )
            {
                if ( parsed.contains( "includes" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "includes" );
                java.util.List includes = new java.util.ArrayList();
                patternSet.setIncludes( includes );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "include" ) )
                    {
                        includes.add( getTrimmedValue( parser.nextText()) );
                    }
                    else
                    {
                        parser.nextText();
                    }
                }
            }
            else if ( parser.getName().equals( "excludes" )  )
            {
                if ( parsed.contains( "excludes" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "excludes" );
                java.util.List excludes = new java.util.ArrayList();
                patternSet.setExcludes( excludes );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "exclude" ) )
                    {
                        excludes.add( getTrimmedValue( parser.nextText()) );
View Full Code Here

     * @param xmlStreamReader
     */
    private PatternSet parsePatternSet(String tagName, XMLStreamReader xmlStreamReader, boolean strict, String encoding)
        throws IOException, XMLStreamException
    {
        PatternSet patternSet = new PatternSet();
        patternSet.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
        {
            if ( xmlStreamReader.getLocalName().equals( "includes" )  )
            {
                if ( parsed.contains( "includes" ) )
                {
                    throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                }
                parsed.add( "includes" );
                java.util.List includes = new java.util.ArrayList();
                patternSet.setIncludes( includes );
                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
                {
                    if ( xmlStreamReader.getLocalName().equals( "include" ) )
                    {
                        includes.add( getTrimmedValue( xmlStreamReader.getElementText()) );
                    }
                    else
                    {
                        throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                    }
                }
            }
            else if ( xmlStreamReader.getLocalName().equals( "excludes" )  )
            {
                if ( parsed.contains( "excludes" ) )
                {
                    throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
                }
                parsed.add( "excludes" );
                java.util.List excludes = new java.util.ArrayList();
                patternSet.setExcludes( excludes );
                while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
                {
                    if ( xmlStreamReader.getLocalName().equals( "exclude" ) )
                    {
                        excludes.add( getTrimmedValue( xmlStreamReader.getElementText()) );
View Full Code Here

     * @param element
     */
    private PatternSet parsePatternSet(String tagName, Element element, boolean strict, String encoding)
        throws IOException, DocumentException
    {
        PatternSet patternSet = new PatternSet();
        patternSet.setModelEncoding( encoding );
        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( "includes" )  )
                {
                    if ( parsed.contains( "includes" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "includes" );
                    java.util.List includes = new java.util.ArrayList();
                    patternSet.setIncludes( includes );
                    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( "include" ) )
                            {
                                includes.add( getTrimmedValue( listElement.getText() ) );
                            }
                            else
                            {
                            }
                        }
                    }
                }
                else if ( childElement.getName().equals( "excludes" )  )
                {
                    if ( parsed.contains( "excludes" ) )
                    {
                        throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
                    }
                    parsed.add( "excludes" );
                    java.util.List excludes = new java.util.ArrayList();
                    patternSet.setExcludes( excludes );
                    for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
                    {
                        Node n = (Node) j.next();
                        if ( n.getNodeType() != Node.ELEMENT_NODE )
                        {
View Full Code Here

     */
    private PatternSet parsePatternSet( XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        String tagName = parser.getName();
        PatternSet patternSet = new PatternSet();
        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, "includes", null, parsed ) )
            {
                java.util.List includes = new java.util.ArrayList/*<String>*/();
                patternSet.setIncludes( includes );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( "include".equals( parser.getName() ) )
                    {
                        includes.add( getTrimmedValue( parser.nextText() ) );
                    }
                    else
                    {
                        checkUnknownElement( parser, strict );
                    }
                }
            }
            else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
            {
                java.util.List excludes = new java.util.ArrayList/*<String>*/();
                patternSet.setExcludes( excludes );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( "exclude".equals( parser.getName() ) )
                    {
                        excludes.add( getTrimmedValue( parser.nextText() ) );
View Full Code Here

     */
    private PatternSet parsePatternSet( XmlPullParser parser, boolean strict, InputSource source )
        throws IOException, XmlPullParserException
    {
        String tagName = parser.getName();
        PatternSet patternSet = new PatternSet();
        InputLocation _location;
        _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
        patternSet.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, "includes", null, parsed ) )
            {
                java.util.List includes = new java.util.ArrayList/*<String>*/();
                patternSet.setIncludes( includes );
                InputLocation _locations;
                _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                patternSet.setLocation( "includes", _locations );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( "include".equals( parser.getName() ) )
                    {
                        _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                        _locations.setLocation( Integer.valueOf( includes.size() ), _location );
                        includes.add( getTrimmedValue( parser.nextText() ) );
                    }
                    else
                    {
                        checkUnknownElement( parser, strict );
                    }
                }
            }
            else if ( checkFieldWithDuplicate( parser, "excludes", null, parsed ) )
            {
                java.util.List excludes = new java.util.ArrayList/*<String>*/();
                patternSet.setExcludes( excludes );
                InputLocation _locations;
                _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                patternSet.setLocation( "excludes", _locations );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( "exclude".equals( parser.getName() ) )
                    {
                        _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
View Full Code Here

TOP

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

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.