Package org.apache.maven.settings

Examples of org.apache.maven.settings.Server


     * @return Server
     */
    private Server parseServer( String tagName, XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        Server server = new Server();
        java.util.Set parsed = new java.util.HashSet();
        while ( parser.nextTag() == XmlPullParser.START_TAG )
        {
            if ( checkFieldWithDuplicate( parser, "username", null, parsed ) )
            {
                server.setUsername( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "password", null, parsed ) )
            {
                server.setPassword( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "privateKey", null, parsed ) )
            {
                server.setPrivateKey( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "passphrase", null, parsed ) )
            {
                server.setPassphrase( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "filePermissions", null, parsed ) )
            {
                server.setFilePermissions( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "directoryPermissions", null, parsed ) )
            {
                server.setDirectoryPermissions( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "configuration", null, parsed ) )
            {
                server.setConfiguration( Xpp3DomBuilder.build( parser ) );
            }
            else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
            {
                server.setId( getTrimmedValue( parser.nextText() ) );
            }
            else
            {
                if ( strict )
                {
View Full Code Here


            modifiedServerMap.put( server.getId().trim(), server );
        }

        for ( Map.Entry<String, Server> entry : modifiedServerMap.entrySet() )
        {
            Server server1 = entry.getValue();
            Server server2 = originalServerMap.get( entry.getKey() );

            if ( server2 == null || !isStringEqual( server1.getUsername(), server2.getUsername() )
                || !isStringEqual( server1.getPassword(), server2.getPassword() )
                || !isStringEqual( server1.getPrivateKey(), server2.getPrivateKey() )
                || !isStringEqual( server1.getPassphrase(), server2.getPassphrase() )
                || !isStringEqual( server1.getFilePermissions(), server2.getFilePermissions() )
                || !isStringEqual( server1.getDirectoryPermissions(), server2.getDirectoryPermissions() ) )
            {
                list.add( server1 );
            }
        }
View Full Code Here

        String username = null;
        String password = null;
       
        // use settings to get authentication info for the given server
        if (!StringUtils.isEmpty(dbSettings.getServerId())) {
            Server server = settings.getServer(dbSettings.getServerId());
            username = server.getUsername();
            password = server.getPassword();
           
        // use settings in pom.xml
        } else {
            username = dbSettings.getUserName();
            password = dbSettings.getPassword();
View Full Code Here

        throws MojoExecutionException,
        MojoFailureException {
       
        // check server
        if (!StringUtils.isEmpty(dbSettings.getServerId())) {
            Server server = settings.getServer(dbSettings.getServerId());
            if (server==null) {
                throw new MojoFailureException(
                    "["+name+"] Server ID: "
                    +dbSettings.getServerId()+" not found!");
            } else if (StringUtils.isEmpty(server.getUsername())) {
                throw new MojoFailureException(
                    "["+name+"] Server ID: "+dbSettings.getServerId()+" found, "
                    +"but username is empty!");
            }
           
View Full Code Here

            if ( ( settings.getServers() != null ) && ( settings.getServers().size() > 0 ) )
            {
                serializer.startTag( NAMESPACE, "servers" );
                for ( Iterator iter = settings.getServers().iterator(); iter.hasNext(); )
                {
                    Server o = (Server) iter.next();
                    writeServer( o, "server", serializer );
                }
                serializer.endTag( NAMESPACE, "servers" );
            }
            if ( ( settings.getMirrors() != null ) && ( settings.getMirrors().size() > 0 ) )
View Full Code Here

            modifiedServerMap.put( server.getId().trim(), server );
        }

        for ( Map.Entry<String, Server> entry : modifiedServerMap.entrySet() )
        {
            Server server1 = entry.getValue();
            Server server2 = originalServerMap.get( entry.getKey() );

            if ( server2 == null || !isStringEqual( server1.getUsername(), server2.getUsername() )
                || !isStringEqual( server1.getPassword(), server2.getPassword() )
                || !isStringEqual( server1.getPrivateKey(), server2.getPrivateKey() )
                || !isStringEqual( server1.getPassphrase(), server2.getPassphrase() )
                || !isStringEqual( server1.getFilePermissions(), server2.getFilePermissions() )
                || !isStringEqual( server1.getDirectoryPermissions(), server2.getDirectoryPermissions() ) )
            {
                list.add( server1 );
            }
        }
View Full Code Here

            if ( port > 0 )
            {
                host += ":" + port;
            }

            Server server = this.settings.getServer( host );

            if ( server != null )
            {
                if ( username == null )
                {
                    username = server.getUsername();
                }

                if ( password == null )
                {
                    password = decrypt( server.getPassword(), host );
                }

                if ( privateKey == null )
                {
                    privateKey = server.getPrivateKey();
                }

                if ( passphrase == null )
                {
                    passphrase = decrypt( server.getPassphrase(), host );
                }
            }
        }
    }
View Full Code Here

                                       proxy.getPassword(), proxy.getNonProxyHosts() );
            }

            for ( Iterator i = settings.getServers().iterator(); i.hasNext(); )
            {
                Server server = (Server) i.next();

                wagonManager.addAuthenticationInfo( server.getId(), server.getUsername(), server.getPassword(),
                                                    server.getPrivateKey(), server.getPassphrase() );

                wagonManager.addPermissionInfo( server.getId(), server.getFilePermissions(),
                                                server.getDirectoryPermissions() );

                if ( server.getConfiguration() != null )
                {
                    wagonManager.addConfiguration( server.getId(), (Xpp3Dom) server.getConfiguration() );
                }
            }

            RepositoryPermissions defaultPermissions = new RepositoryPermissions();
View Full Code Here

                    getLogger().info( "checking for settings auth setup" );
                    if ( settings != null && settings.getServer( url.getHost() ) != null )
                    {
                        getLogger().info( "found setting based auth setup, using" );
                        Server server = settings.getServer( url.getHost() );

                        username = server.getUsername();
                        password = server.getPassword();
                    }
                }
                catch ( SettingsConfigurationException se )
                {
                    getLogger().warn( "problem with settings file, disabling scm resolution of username and password" );
View Full Code Here

    }

    private AuthenticationInfo getAuthenticationInfo( String repositoryId )
    {
        Settings settings = getSettings();
        Server server = settings.getServer( repositoryId );

        if ( server == null )
        {
            return null;
        }

        wagonManager.addAuthenticationInfo( repositoryId, server.getUsername(), server.getPassword(),
                                            server.getPrivateKey(), server.getPassphrase() );
        return wagonManager.getAuthenticationInfo( repositoryId );
    }
View Full Code Here

TOP

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

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.