org.apache.maven.settings.Server.getId()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(242)

本文整理了Java中org.apache.maven.settings.Server.getId()方法的一些代码示例,展示了Server.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getId()方法的具体详情如下:
包路径:org.apache.maven.settings.Server
类名称:Server
方法名:getId

Server.getId介绍

暂无

代码示例

代码示例来源:origin: apache/maven

@Override
public MavenExecutionRequest addServer( Server server )
{
  Objects.requireNonNull( server, "server cannot be null" );
  for ( Server p : getServers() )
  {
    if ( p.getId() != null && p.getId().equals( server.getId() ) )
    {
      return this;
    }
  }
  getServers().add( server );
  return this;
}

代码示例来源:origin: apache/maven

public Server getServer( String serverId )
{
  Server match = null;
  java.util.List<Server> servers = getServers();
  if ( servers != null && serverId != null )
  {
    for ( Server server : servers )
    {
      if ( serverId.equals( server.getId() ) )
      {
        match = server;
        break;
      }
    }
  }
  return match;
}

代码示例来源:origin: spotify/dockerfile-maven

@Override
public RegistryConfigs authForBuild() throws DockerException {
 final Map<String, RegistryAuth> allConfigs = new HashMap<>();
 for (Server server : settings.getServers()) {
  allConfigs.put(server.getId(), createRegistryAuth(server));
 }
 return RegistryConfigs.create(allConfigs);
}

代码示例来源:origin: apache/maven

problems.add( new DefaultSettingsProblem( "Failed to decrypt password for server " + server.getId()
  + ": " + e.getMessage(), Severity.ERROR, "server: " + server.getId(), -1, -1, e ) );
problems.add( new DefaultSettingsProblem( "Failed to decrypt passphrase for server " + server.getId()
  + ": " + e.getMessage(), Severity.ERROR, "server: " + server.getId(), -1, -1, e ) );

代码示例来源:origin: fabric8io/docker-maven-plugin

private AuthConfig getAuthConfigFromSettings(Settings settings, String user, String registry) throws MojoExecutionException {
  Server defaultServer = null;
  Server found;
  for (Server server : settings.getServers()) {
    String id = server.getId();
    // Remember a default server without user as fallback for later
    if (defaultServer == null) {
      defaultServer = checkForServer(server, id, registry, null);
    }
    // Check for specific server with user part
    found = checkForServer(server, id, registry, user);
    if (found != null) {
      return createAuthConfigFromServer(found);
    }
  }
  return defaultServer != null ? createAuthConfigFromServer(defaultServer) : null;
}

代码示例来源:origin: spotify/dockerfile-maven

private RegistryAuth createRegistryAuth(Server server) throws DockerException {
  SettingsDecryptionRequest decryptionRequest = new DefaultSettingsDecryptionRequest(server);
  SettingsDecryptionResult decryptionResult = settingsDecrypter.decrypt(decryptionRequest);

  if (decryptionResult.getProblems().isEmpty()) {
   log.debug("Successfully decrypted Maven server password");
  } else {
   for (SettingsProblem problem : decryptionResult.getProblems()) {
    log.error("Settings problem for server {}: {}", server.getId(), problem);
   }

   throw new DockerException("Failed to decrypt Maven server password");
  }

  return RegistryAuth.builder()
      .username(server.getUsername())
      .password(decryptionResult.getServer().getPassword())
      .build();
 }
}

代码示例来源:origin: apache/maven

if ( !serversById.containsKey( server.getId() ) )
  serversById.put( server.getId(), server );

代码示例来源:origin: apache/maven

validateStringNotEmpty( problems, "servers.server[" + i + "].id", server.getId(), null );
if ( !serverIds.add( server.getId() ) )
         "must be unique but found duplicate server with id " + server.getId() );

代码示例来源:origin: apache/maven

if ( id.equalsIgnoreCase( server.getId() ) )

代码示例来源:origin: apache/maven

if ( ( server.getId() != null ) && !server.getId().equals( "default" ) )
  serializer.startTag( NAMESPACE, "id" ).text( server.getId() ).endTag( NAMESPACE, "id" );

代码示例来源:origin: org.apache.maven/maven-settings

public Server getServer( String serverId )
{
  Server match = null;
  java.util.List<Server> servers = getServers();
  if ( servers != null && serverId != null )
  {
    for ( Server server : servers )
    {
      if ( serverId.equals( server.getId() ) )
      {
        match = server;
        break;
      }
    }
  }
  return match;
}

代码示例来源:origin: apache/maven

authBuilder.addUsername( server.getUsername() ).addPassword( server.getPassword() );
authBuilder.addPrivateKey( server.getPrivateKey(), server.getPassphrase() );
authSelector.add( server.getId(), authBuilder.build() );
  configProps.put( "aether.connector.wagon.config." + server.getId(), config );
configProps.put( "aether.connector.perms.fileMode." + server.getId(), server.getFilePermissions() );
configProps.put( "aether.connector.perms.dirMode." + server.getId(), server.getDirectoryPermissions() );

代码示例来源:origin: net.oneandone.maven/embedded

private Server lookup(String id) {
  for (Server server : servers) {
    if (id.equals(server.getId())) {
      return server;
    }
  }
  return null;
}

代码示例来源:origin: org.apache.npanday.plugins/maven-wsdl-plugin

private Server getServerFor( String id )
{
  for ( Server server : servers )
  {
    if ( server.getId().trim().equals( id.trim() ) )
    {
      return server;
    }
  }
  return null;
}

代码示例来源:origin: org.apache.maven/maven-settings

if ( ( server.getId() != null ) && !server.getId().equals( "default" ) )
  serializer.startTag( NAMESPACE, "id" ).text( server.getId() ).endTag( NAMESPACE, "id" );

代码示例来源:origin: io.fabric8/fabric-maven

private void addServerConfig( DefaultRepositorySystemSession session, Server server )
{
  Map<String,String> headers = new HashMap<String, String>();
  Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration();
  Xpp3Dom httpHeaders = configuration.getChild( "httpHeaders" );
  for (Xpp3Dom httpHeader : httpHeaders.getChildren( "httpHeader" )) {
    Xpp3Dom name = httpHeader.getChild( "name" );
    String headerName = name.getValue();
    Xpp3Dom value = httpHeader.getChild( "value" );
    String headerValue = value.getValue();
    headers.put( headerName, headerValue );
  }
  session.setConfigProperty( String.format("%s.%s", ConfigurationProperties.HTTP_HEADERS, server.getId()), headers );
}

代码示例来源:origin: spring-cloud/spring-cloud-function

private AuthenticationSelector createAuthenticationSelector(
    SettingsDecryptionResult decryptedSettings) {
  DefaultAuthenticationSelector selector = new DefaultAuthenticationSelector();
  for (Server server : decryptedSettings.getServers()) {
    AuthenticationBuilder auth = new AuthenticationBuilder();
    auth.addUsername(server.getUsername()).addPassword(server.getPassword());
    auth.addPrivateKey(server.getPrivateKey(), server.getPassphrase());
    selector.add(server.getId(), auth.build());
  }
  return new ConservativeAuthenticationSelector(selector);
}

代码示例来源:origin: org.jboss.forge.furnace/furnace-manager-resolver-maven

private LazyAuthenticationSelector createAuthSelector(final Settings settings,
    final DefaultMirrorSelector mirrorSelector)
{
 LazyAuthenticationSelector authSelector = new LazyAuthenticationSelector(mirrorSelector);
 for (Server server : settings.getServers())
 {
   authSelector.add(
       server.getId(),
       new AuthenticationBuilder().addUsername(server.getUsername()).addPassword(server.getPassword())
            .addPrivateKey(server.getPrivateKey(), server.getPassphrase()).build());
 }
 return authSelector;
}

代码示例来源:origin: org.springframework.boot.experimental/spring-boot-thin-launcher

private AuthenticationSelector createAuthenticationSelector(
    SettingsDecryptionResult decryptedSettings) {
  DefaultAuthenticationSelector selector = new DefaultAuthenticationSelector();
  for (Server server : decryptedSettings.getServers()) {
    AuthenticationBuilder auth = new AuthenticationBuilder();
    auth.addUsername(server.getUsername()).addPassword(server.getPassword());
    auth.addPrivateKey(server.getPrivateKey(), server.getPassphrase());
    selector.add(server.getId(), auth.build());
  }
  return new ConservativeAuthenticationSelector(selector);
}

代码示例来源:origin: org.springframework.boot/spring-boot-cli

private AuthenticationSelector createAuthenticationSelector(
    SettingsDecryptionResult decryptedSettings) {
  DefaultAuthenticationSelector selector = new DefaultAuthenticationSelector();
  for (Server server : decryptedSettings.getServers()) {
    AuthenticationBuilder auth = new AuthenticationBuilder();
    auth.addUsername(server.getUsername()).addPassword(server.getPassword());
    auth.addPrivateKey(server.getPrivateKey(), server.getPassphrase());
    selector.add(server.getId(), auth.build());
  }
  return new ConservativeAuthenticationSelector(selector);
}

相关文章