Package org.apache.maven.usability.plugin

Examples of org.apache.maven.usability.plugin.Expression


        }

        for ( Map.Entry<String, Expression> entry : m.entrySet() )
        {
            String key = entry.getKey();
            Expression expression = entry.getValue();

            sb.append( "${" ).append( key ).append( "}: " );
            sb.append( trimCDATA( expression.getDescription() ) );
            sb.append( "\n\n" );
        }

        if ( output != null )
        {
View Full Code Here


                expressionMessageBuffer.append( "\n\nException:\n\n" ).append( sWriter.toString() );
            }

            if ( expressions != null )
            {
                Expression expr = (Expression) expressions.get( subExpression );

                if ( expr != null )
                {
                    if ( !expr.isEditable() )
                    {
                        unmodifiableElementsFound = true;
                    }
                    else
                    {
View Full Code Here

    }

    private static void addParameterConfigDocumentation( String firstPart, String wholeExpression, String subExpression,
                                                         StringBuffer expressionMessageBuffer, Map expressionDoco )
    {
        Expression expr = (Expression) expressionDoco.get( subExpression );

        if ( expr != null )
        {
            expressionMessageBuffer.append( "check that the following section of " );
            if ( "project".equals( firstPart ) )
            {
                expressionMessageBuffer.append( "the pom.xml " );
            }
            else if ( "settings".equals( firstPart ) )
            {
                expressionMessageBuffer.append( "your ~/.m2/settings.xml file " );
            }

            expressionMessageBuffer.append( "is present and correct:\n\n" );

            String message = expr.getConfiguration();

            if ( message == null )
            {
                message = expr.getDescription();
            }

            expressionMessageBuffer.append( message );

            Properties cliConfig = expr.getCliOptions();

            if ( cliConfig != null && !cliConfig.isEmpty() )
            {
                expressionMessageBuffer.append( "\n\n-OR-\n\nUse the following command-line switches:\n" );
View Full Code Here

            if ( ( expressionDocumentation.getExpressions() != null ) && ( expressionDocumentation.getExpressions().size() > 0 ) )
            {
                serializer.startTag( NAMESPACE, "expressions" );
                for ( Iterator iter = expressionDocumentation.getExpressions().iterator(); iter.hasNext(); )
                {
                    Expression o = (Expression) iter.next();
                    writeExpression( o, "expression", serializer );
                }
                serializer.endTag( NAMESPACE, "expressions" );
            }
            serializer.endTag( NAMESPACE, tagName );
View Full Code Here

     * @return Expression
     */
    private Expression parseExpression( String tagName, XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        Expression expression = new Expression();
        java.util.Set parsed = new java.util.HashSet();
        while ( parser.nextTag() == XmlPullParser.START_TAG )
        {
            if ( checkFieldWithDuplicate( parser, "syntax", null, parsed ) )
            {
                expression.setSyntax( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "description", null, parsed ) )
            {
                expression.setDescription( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
            {
                expression.setConfiguration( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "cliOptions", null, parsed ) )
            {
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "cliOption" ) )
                    {
                        String key = null;
                        String value = null;
                        // explode mode.
                        while ( parser.nextTag() == XmlPullParser.START_TAG )
                        {
                            if ( parser.getName().equals( "key" ) )
                            {
                                key = parser.nextText();
                            }
                            else if ( parser.getName().equals( "value" ) )
                            {
                                value = parser.nextText().trim();
                            }
                            else
                            {
                                parser.nextText();
                            }
                        }
                        expression.addCliOption( key, value );
                    }
                    parser.next();
                }
            }
            else if ( checkFieldWithDuplicate( parser, "apiMethods", null, parsed ) )
            {
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "apiMethod" ) )
                    {
                        String key = null;
                        String value = null;
                        // explode mode.
                        while ( parser.nextTag() == XmlPullParser.START_TAG )
                        {
                            if ( parser.getName().equals( "key" ) )
                            {
                                key = parser.nextText();
                            }
                            else if ( parser.getName().equals( "value" ) )
                            {
                                value = parser.nextText().trim();
                            }
                            else
                            {
                                parser.nextText();
                            }
                        }
                        expression.addApiMethod( key, value );
                    }
                    parser.next();
                }
            }
            else if ( checkFieldWithDuplicate( parser, "deprecation", null, parsed ) )
            {
                expression.setDeprecation( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "ban", null, parsed ) )
            {
                expression.setBan( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "editable", null, parsed ) )
            {
                expression.setEditable( getBooleanValue( getTrimmedValue( parser.nextText() ), "editable", parser, "true" ) );
            }
            else
            {
                if ( strict )
                {
View Full Code Here

                expressionMessageBuffer.append( "\n\nException:\n\n" ).append( sWriter.toString() );
            }

            if ( expressions != null )
            {
                Expression expr = (Expression) expressions.get( subExpression );

                if ( expr != null )
                {
                    if ( !expr.isEditable() )
                    {
                        unmodifiableElementsFound = true;
                    }
                    else
                    {
View Full Code Here

    }

    private static void addParameterConfigDocumentation( String firstPart, String wholeExpression, String subExpression,
                                                         StringBuffer expressionMessageBuffer, Map expressionDoco )
    {
        Expression expr = (Expression) expressionDoco.get( subExpression );

        if ( expr != null )
        {
            expressionMessageBuffer.append( "check that the following section of " );
            if ( "project".equals( firstPart ) )
            {
                expressionMessageBuffer.append( "the pom.xml " );
            }
            else if ( "settings".equals( firstPart ) )
            {
                expressionMessageBuffer.append( "your ~/.m2/settings.xml file " );
            }

            expressionMessageBuffer.append( "is present and correct:\n\n" );

            String message = expr.getConfiguration();

            if ( message == null )
            {
                message = expr.getDescription();
            }

            expressionMessageBuffer.append( message );

            Properties cliConfig = expr.getCliOptions();

            if ( cliConfig != null && !cliConfig.isEmpty() )
            {
                expressionMessageBuffer.append( "\n\n-OR-\n\nUse the following command-line switches:\n" );
View Full Code Here

            if ( expressionDocumentation.getExpressions() != null && expressionDocumentation.getExpressions().size() > 0 )
            {
                serializer.startTag( NAMESPACE, "expressions" );
                for ( Iterator iter = expressionDocumentation.getExpressions().iterator(); iter.hasNext(); )
                {
                    Expression o = (Expression) iter.next();
                    writeExpression( o, "expression", serializer );
                }
                serializer.endTag( NAMESPACE, "expressions" );
            }
            serializer.endTag( NAMESPACE, tagName );
View Full Code Here

     * @param parser
     */
    private Expression parseExpression(String tagName, XmlPullParser parser, boolean strict, String encoding)
        throws IOException, XmlPullParserException
    {
        Expression expression = new Expression();
        expression.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        while ( parser.nextTag() == XmlPullParser.START_TAG )
        {
            if ( parser.getName().equals( "syntax" )  )
            {
                if ( parsed.contains( "syntax" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "syntax" );
                expression.setSyntax( 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" );
                expression.setDescription( getTrimmedValue( parser.nextText()) );
            }
            else if ( parser.getName().equals( "configuration" )  )
            {
                if ( parsed.contains( "configuration" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "configuration" );
                expression.setConfiguration( getTrimmedValue( parser.nextText()) );
            }
            else if ( parser.getName().equals( "cliOptions" )  )
            {
                if ( parsed.contains( "cliOptions" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "cliOptions" );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "cliOption" ) )
                    {
                        String key = null;
                        String value = null;
                        //explode mode.
                        while ( parser.nextTag() == XmlPullParser.START_TAG )
                        {
                            if ( parser.getName().equals( "key" ) )
                            {
                                key = parser.nextText();
                            }
                            else if ( parser.getName().equals( "value" ) )
                            {
                                value = parser.nextText()
                                .trim()
                                ;
                            }
                            else
                            {
                                parser.nextText();
                            }
                        }
                        expression.addCliOption( key, value );
                    }
                    parser.next();
                }
            }
            else if ( parser.getName().equals( "apiMethods" )  )
            {
                if ( parsed.contains( "apiMethods" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "apiMethods" );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( parser.getName().equals( "apiMethod" ) )
                    {
                        String key = null;
                        String value = null;
                        //explode mode.
                        while ( parser.nextTag() == XmlPullParser.START_TAG )
                        {
                            if ( parser.getName().equals( "key" ) )
                            {
                                key = parser.nextText();
                            }
                            else if ( parser.getName().equals( "value" ) )
                            {
                                value = parser.nextText()
                                .trim()
                                ;
                            }
                            else
                            {
                                parser.nextText();
                            }
                        }
                        expression.addApiMethod( key, value );
                    }
                    parser.next();
                }
            }
            else if ( parser.getName().equals( "deprecation" )  )
            {
                if ( parsed.contains( "deprecation" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "deprecation" );
                expression.setDeprecation( getTrimmedValue( parser.nextText()) );
            }
            else if ( parser.getName().equals( "ban" )  )
            {
                if ( parsed.contains( "ban" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "ban" );
                expression.setBan( getTrimmedValue( parser.nextText()) );
            }
            else if ( parser.getName().equals( "editable" )  )
            {
                if ( parsed.contains( "editable" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "editable" );
                expression.setEditable( getBooleanValue( getTrimmedValue( parser.nextText()), "editable", parser ) );
            }
            else
            {
                if ( strict )
                {
View Full Code Here

        }

        for ( Map.Entry<String, Expression> entry : m.entrySet() )
        {
            String key = entry.getKey();
            Expression expression = entry.getValue();

            sb.append( "${" ).append( key ).append( "}: " );
            sb.append( trimCDATA( expression.getDescription() ) );
            sb.append( "\n\n" );
        }

        if ( output != null )
        {
View Full Code Here

TOP

Related Classes of org.apache.maven.usability.plugin.Expression

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.