Package org.apache.maven.settings

Examples of org.apache.maven.settings.RepositoryPolicy


     * @param parser
     */
    private RepositoryPolicy parseRepositoryPolicy(String tagName, XmlPullParser parser, boolean strict, String encoding)
        throws IOException, XmlPullParserException
    {
        RepositoryPolicy repositoryPolicy = new RepositoryPolicy();
        repositoryPolicy.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        while ( parser.nextTag() == XmlPullParser.START_TAG )
        {
            if ( parser.getName().equals( "enabled" )  )
            {
                if ( parsed.contains( "enabled" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "enabled" );
                repositoryPolicy.setEnabled( getBooleanValue( getTrimmedValue( parser.nextText()), "enabled", parser ) );
            }
            else if ( parser.getName().equals( "updatePolicy" )  )
            {
                if ( parsed.contains( "updatePolicy" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "updatePolicy" );
                repositoryPolicy.setUpdatePolicy( getTrimmedValue( parser.nextText()) );
            }
            else if ( parser.getName().equals( "checksumPolicy" )  )
            {
                if ( parsed.contains( "checksumPolicy" ) )
                {
                    throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                }
                parsed.add( "checksumPolicy" );
                repositoryPolicy.setChecksumPolicy( getTrimmedValue( parser.nextText()) );
            }
            else
            {
                if ( strict )
                {
View Full Code Here


      else if ("flat".equals(layout))
         result.setLayout(new FlatRepositoryLayout());
      else if ("p2".equals(layout))
         result.setLayout(new P2ArtifactRepositoryLayout());

      RepositoryPolicy releases = repository.getReleases();
      if (releases != null)
         result.setReleaseUpdatePolicy(new ArtifactRepositoryPolicy(releases.isEnabled(), releases.getUpdatePolicy(),
                  releases.getChecksumPolicy()));

      RepositoryPolicy snapshots = repository.getSnapshots();
      if (snapshots != null)
         result.setSnapshotUpdatePolicy(new ArtifactRepositoryPolicy(snapshots.isEnabled(),
                  snapshots.getUpdatePolicy(),
                  snapshots.getChecksumPolicy()));

      return result;
   }
View Full Code Here

     */
    private RepositoryPolicy parseRepositoryPolicy( XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        String tagName = parser.getName();
        RepositoryPolicy repositoryPolicy = new RepositoryPolicy();
        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, "enabled", null, parsed ) )
            {
                repositoryPolicy.setEnabled( getBooleanValue( getTrimmedValue( parser.nextText() ), "enabled", parser, "true" ) );
            }
            else if ( checkFieldWithDuplicate( parser, "updatePolicy", null, parsed ) )
            {
                repositoryPolicy.setUpdatePolicy( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "checksumPolicy", null, parsed ) )
            {
                repositoryPolicy.setChecksumPolicy( getTrimmedValue( parser.nextText() ) );
            }
            else
            {
                checkUnknownElement( parser, strict );
            }
View Full Code Here

      else if ("flat".equals(layout))
         result.setLayout(new FlatRepositoryLayout());
      else if ("p2".equals(layout))
         result.setLayout(new P2ArtifactRepositoryLayout());

      RepositoryPolicy releases = repository.getReleases();
      if (releases != null)
         result.setReleaseUpdatePolicy(new ArtifactRepositoryPolicy(releases.isEnabled(), releases.getUpdatePolicy(),
                  releases.getChecksumPolicy()));

      RepositoryPolicy snapshots = repository.getSnapshots();
      if (snapshots != null)
         result.setSnapshotUpdatePolicy(new ArtifactRepositoryPolicy(snapshots.isEnabled(),
                  snapshots.getUpdatePolicy(),
                  snapshots.getChecksumPolicy()));

      return result;
   }
View Full Code Here

      else if ("flat".equals(layout))
         result.setLayout(new FlatRepositoryLayout());
      else if ("p2".equals(layout))
         result.setLayout(new P2ArtifactRepositoryLayout());

      RepositoryPolicy releases = repository.getReleases();
      if (releases != null)
         result.setReleaseUpdatePolicy(new ArtifactRepositoryPolicy(releases.isEnabled(), releases.getUpdatePolicy(),
                  releases.getChecksumPolicy()));

      RepositoryPolicy snapshots = repository.getSnapshots();
      if (snapshots != null)
         result.setSnapshotUpdatePolicy(new ArtifactRepositoryPolicy(snapshots.isEnabled(),
                  snapshots.getUpdatePolicy(),
                  snapshots.getChecksumPolicy()));

      return result;
   }
View Full Code Here

      if ("default".equals(layout))
         result.setLayout(new DefaultRepositoryLayout());
      else if ("flat".equals(layout))
         result.setLayout(new FlatRepositoryLayout());

      RepositoryPolicy releases = repository.getReleases();
      if (releases != null)
         result.setReleaseUpdatePolicy(new ArtifactRepositoryPolicy(releases.isEnabled(), releases.getUpdatePolicy(),
                  releases.getChecksumPolicy()));

      RepositoryPolicy snapshots = repository.getSnapshots();
      if (snapshots != null)
         result.setSnapshotUpdatePolicy(new ArtifactRepositoryPolicy(snapshots.isEnabled(),
                  snapshots.getUpdatePolicy(),
                  snapshots.getChecksumPolicy()));

      return result;
   }
View Full Code Here

TOP

Related Classes of org.apache.maven.settings.RepositoryPolicy

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.