Package org.apache.maven.model

Examples of org.apache.maven.model.Notifier


     * @param parser
     */
    private Notifier parseNotifier(String tagName, XmlPullParser parser, boolean strict, String encoding)
        throws IOException, XmlPullParserException
    {
        Notifier notifier = new Notifier();
        notifier.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        while ( parser.nextTag() == XmlPullParser.START_TAG )
        {
            if ( parser.getName().equals( "type" )  )
            {
                if ( parsed.contains( "type" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "type" );
                notifier.setType( getTrimmedValue( parser.nextText()) );
            }
            else if ( parser.getName().equals( "sendOnError" )  )
            {
                if ( parsed.contains( "sendOnError" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "sendOnError" );
                notifier.setSendOnError( getBooleanValue( getTrimmedValue( parser.nextText()), "sendOnError", parser ) );
            }
            else if ( parser.getName().equals( "sendOnFailure" )  )
            {
                if ( parsed.contains( "sendOnFailure" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "sendOnFailure" );
                notifier.setSendOnFailure( getBooleanValue( getTrimmedValue( parser.nextText()), "sendOnFailure", parser ) );
            }
            else if ( parser.getName().equals( "sendOnSuccess" )  )
            {
                if ( parsed.contains( "sendOnSuccess" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "sendOnSuccess" );
                notifier.setSendOnSuccess( getBooleanValue( getTrimmedValue( parser.nextText()), "sendOnSuccess", parser ) );
            }
            else if ( parser.getName().equals( "sendOnWarning" )  )
            {
                if ( parsed.contains( "sendOnWarning" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "sendOnWarning" );
                notifier.setSendOnWarning( getBooleanValue( getTrimmedValue( parser.nextText()), "sendOnWarning", parser ) );
            }
            else if ( parser.getName().equals( "address" )  )
            {
                if ( parsed.contains( "address" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "address" );
                notifier.setAddress( 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" );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    String key = parser.getName();
                    String value = parser.nextText()
                    .trim()
                    ;
                    notifier.addConfiguration( key, value );
                }
            }
            else
            {
                if ( strict )
View Full Code Here


            if ( ciManagement.getNotifiers() != null && ciManagement.getNotifiers().size() > 0 )
            {
                serializer.startTag( NAMESPACE, "notifiers" );
                for ( Iterator iter = ciManagement.getNotifiers().iterator(); iter.hasNext(); )
                {
                    Notifier o = (Notifier) iter.next();
                    writeNotifier( o, "notifier", serializer );
                }
                serializer.endTag( NAMESPACE, "notifiers" );
            }
            serializer.endTag( NAMESPACE, tagName );
View Full Code Here

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

        {
            String nagEmailAddress = v3Build.getNagEmailAddress();

            if ( StringUtils.isNotEmpty( nagEmailAddress ) )
            {
                Notifier notifier = new Notifier();

                notifier.setType( "mail" );
                notifier.addConfiguration( "address", nagEmailAddress );

                ciMgmt = new CiManagement();
                ciMgmt.addNotifier( notifier );
            }
        }
View Full Code Here

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

        if ( mavenProject.getCiManagement() != null && mavenProject.getCiManagement().getNotifiers() != null )
        {
            for ( Iterator i = mavenProject.getCiManagement().getNotifiers().iterator(); i.hasNext(); )
            {
                Notifier projectNotifier = (Notifier) i.next();

                ProjectNotifier notifier = new ProjectNotifier();

                if ( StringUtils.isEmpty( projectNotifier.getType() ) )
                {
                    result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_NOTIFIER_TYPE );
                    return null;
                }

                notifier.setType( projectNotifier.getType() );

                if ( projectNotifier.getConfiguration() == null )
                {
                    result.addError( ContinuumProjectBuildingResult.ERROR_MISSING_NOTIFIER_CONFIGURATION );
                    return null;
                }

                notifier.setConfiguration( projectNotifier.getConfiguration() );

                notifier.setFrom( ProjectNotifier.FROM_PROJECT );

                notifier.setSendOnSuccess( projectNotifier.isSendOnSuccess() );

                notifier.setSendOnFailure( projectNotifier.isSendOnFailure() );

                notifier.setSendOnError( projectNotifier.isSendOnError() );

                notifier.setSendOnWarning( projectNotifier.isSendOnWarning() );

                notifiers.add( notifier );
            }
        }
View Full Code Here

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

     */
    private Notifier parseNotifier( XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        String tagName = parser.getName();
        Notifier notifier = new Notifier();
        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, "type", null, parsed ) )
            {
                notifier.setType( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "sendOnError", null, parsed ) )
            {
                notifier.setSendOnError( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnError", parser, "true" ) );
            }
            else if ( checkFieldWithDuplicate( parser, "sendOnFailure", null, parsed ) )
            {
                notifier.setSendOnFailure( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnFailure", parser, "true" ) );
            }
            else if ( checkFieldWithDuplicate( parser, "sendOnSuccess", null, parsed ) )
            {
                notifier.setSendOnSuccess( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnSuccess", parser, "true" ) );
            }
            else if ( checkFieldWithDuplicate( parser, "sendOnWarning", null, parsed ) )
            {
                notifier.setSendOnWarning( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnWarning", parser, "true" ) );
            }
            else if ( checkFieldWithDuplicate( parser, "address", null, parsed ) )
            {
                notifier.setAddress( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
            {
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    String key = parser.getName();
                    String value = parser.nextText().trim();
                    notifier.addConfiguration( key, value );
                }
            }
            else
            {
                checkUnknownElement( parser, strict );
View Full Code Here

        if ( ( ciManagement.getNotifiers() != null ) && ( ciManagement.getNotifiers().size() > 0 ) )
        {
            serializer.startTag( NAMESPACE, "notifiers" );
            for ( Iterator iter = ciManagement.getNotifiers().iterator(); iter.hasNext(); )
            {
                Notifier o = (Notifier) iter.next();
                writeNotifier( o, "notifier", serializer );
            }
            serializer.endTag( NAMESPACE, "notifiers" );
        }
        serializer.endTag( NAMESPACE, tagName );
View Full Code Here

     */
    private Notifier parseNotifier( XmlPullParser parser, boolean strict, InputSource source )
        throws IOException, XmlPullParserException
    {
        String tagName = parser.getName();
        Notifier notifier = new Notifier();
        InputLocation _location;
        _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
        notifier.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, "type", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                notifier.setLocation( "type", _location );
                notifier.setType( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "sendOnError", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                notifier.setLocation( "sendOnError", _location );
                notifier.setSendOnError( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnError", parser, "true" ) );
            }
            else if ( checkFieldWithDuplicate( parser, "sendOnFailure", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                notifier.setLocation( "sendOnFailure", _location );
                notifier.setSendOnFailure( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnFailure", parser, "true" ) );
            }
            else if ( checkFieldWithDuplicate( parser, "sendOnSuccess", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                notifier.setLocation( "sendOnSuccess", _location );
                notifier.setSendOnSuccess( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnSuccess", parser, "true" ) );
            }
            else if ( checkFieldWithDuplicate( parser, "sendOnWarning", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                notifier.setLocation( "sendOnWarning", _location );
                notifier.setSendOnWarning( getBooleanValue( getTrimmedValue( parser.nextText() ), "sendOnWarning", parser, "true" ) );
            }
            else if ( checkFieldWithDuplicate( parser, "address", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                notifier.setLocation( "address", _location );
                notifier.setAddress( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
            {
                InputLocation _locations;
                _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                notifier.setLocation( "configuration", _locations );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    String key = parser.getName();
                    _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                    _locations.setLocation( key, _location );
                    String value = parser.nextText().trim();
                    notifier.addConfiguration( key, value );
                }
            }
            else
            {
                checkUnknownElement( parser, strict );
View Full Code Here

TOP

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

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.