本文整理汇总了Java中com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder类的典型用法代码示例。如果您正苦于以下问题:Java HubServerConfigBuilder类的具体用法?Java HubServerConfigBuilder怎么用?Java HubServerConfigBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HubServerConfigBuilder类属于com.blackducksoftware.integration.hub.builder包,在下文中一共展示了HubServerConfigBuilder类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getHubServerConfig
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
/**
* Build the Hub Server information for connection
*
* @return
*/
private static HubServerConfig getHubServerConfig(PropertyConstants propertyConstants) {
HubServerConfigBuilder builder = new HubServerConfigBuilder();
builder.setHubUrl(propertyConstants.getHubServerUrl());
builder.setUsername(propertyConstants.getHubUserName());
builder.setPassword(propertyConstants.getHubPassword());
builder.setTimeout(propertyConstants.getHubTimeout());
if (propertyConstants.getHubProxyHost() != null && !"".equalsIgnoreCase(propertyConstants.getHubProxyHost())) {
logger.info("Inside Proxy settings::" + propertyConstants.getHubProxyHost() + "::");
builder.setProxyHost(propertyConstants.getHubProxyHost());
builder.setProxyPort(propertyConstants.getHubProxyPort());
builder.setProxyUsername(propertyConstants.getHubProxyUser());
builder.setProxyPassword(propertyConstants.getHubPassword());
builder.setIgnoredProxyHosts(propertyConstants.getHubProxyNoHost());
}
return builder.build();
}
开发者ID:blackducksoftware,项目名称:hub-fortify-ssc-integration-service,代码行数:24,代码来源:RestConnectionHelper.java
示例2: checkInput
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
public void checkInput(final HttpServletRequest request, final ActionErrors errors) throws IllegalArgumentException, EncryptionException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
final HubServerConfigBuilder builder = getHubServerConfigBuilderFromRequest(request);
final AbstractValidator validator = builder.createValidator();
final ValidationResults results = validator.assertValid();
if (results.isSuccess()) {
final HubServerConfig config = builder.buildObject();
configPersistenceManager.setHubServerConfig(config);
configPersistenceManager.setHubWorkspaceCheck(Boolean.valueOf(request.getParameter("hubWorkspaceCheck")));
} else {
checkForErrors(HubServerConfigFieldEnum.HUBURL, "errorUrl", results, errors);
checkForErrors(HubServerConfigFieldEnum.HUBTIMEOUT, "errorTimeout", results, errors);
checkForErrors(HubCredentialsFieldEnum.USERNAME, "errorUserName", results, errors);
checkForErrors(HubCredentialsFieldEnum.PASSWORD, "errorPassword", results, errors);
checkForErrors(HubProxyInfoFieldEnum.PROXYHOST, "errorHubProxyServer", results, errors);
checkForErrors(HubProxyInfoFieldEnum.PROXYPORT, "errorHubProxyPort", results, errors);
checkForErrors(HubProxyInfoFieldEnum.NOPROXYHOSTS, "errorHubNoProxyHost", results, errors);
checkForErrors(HubProxyInfoFieldEnum.PROXYUSERNAME, "errorHubProxyUser", results, errors);
checkForErrors(HubProxyInfoFieldEnum.PROXYPASSWORD, "errorHubProxyPass", results, errors);
}
}
开发者ID:blackducksoftware,项目名称:hub-teamcity,代码行数:25,代码来源:HubGlobalServerConfigController.java
示例3: getHubServerConfigBuilderFromRequest
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
private HubServerConfigBuilder getHubServerConfigBuilderFromRequest(final HttpServletRequest request) throws IllegalArgumentException, EncryptionException {
final HubServerConfigBuilder serverConfigBuilder = new HubServerConfigBuilder();
serverConfigBuilder.setHubUrl(request.getParameter("hubUrl"));
serverConfigBuilder.setTimeout(request.getParameter("hubTimeout"));
serverConfigBuilder.setUsername(request.getParameter("hubUser"));
String hubPass = getDecryptedWebPassword(request.getParameter("encryptedHubPass"));
if (isPasswordAstericks(hubPass) && configPersistenceManager.getHubServerConfig() != null && configPersistenceManager.getHubServerConfig().getGlobalCredentials() != null) {
hubPass = configPersistenceManager.getHubServerConfig().getGlobalCredentials().getDecryptedPassword();
}
serverConfigBuilder.setPassword(hubPass);
serverConfigBuilder.setAutoImportHttpsCertificates(Boolean.valueOf(request.getParameter("autoImportHttpsCertificates")));
serverConfigBuilder.setProxyHost(request.getParameter("hubProxyServer"));
serverConfigBuilder.setProxyPort(request.getParameter("hubProxyPort"));
serverConfigBuilder.setIgnoredProxyHosts(request.getParameter("hubNoProxyHost"));
serverConfigBuilder.setProxyUsername(request.getParameter("hubProxyUser"));
String proxyPass = getDecryptedWebPassword(request.getParameter("encryptedHubProxyPass"));
if (isPasswordAstericks(proxyPass) && configPersistenceManager.getHubServerConfig() != null && configPersistenceManager.getHubServerConfig().getProxyInfo() != null) {
proxyPass = configPersistenceManager.getHubServerConfig().getProxyInfo().getDecryptedPassword();
}
serverConfigBuilder.setProxyPassword(proxyPass);
return serverConfigBuilder;
}
开发者ID:blackducksoftware,项目名称:hub-teamcity,代码行数:25,代码来源:HubGlobalServerConfigController.java
示例4: createHubServerConfigBuilder
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
public HubServerConfigBuilder createHubServerConfigBuilder() {
final HubServerConfigBuilder hubConfigBuilder = new HubServerConfigBuilder();
hubConfigBuilder.setHubUrl(hubUrl);
hubConfigBuilder.setUsername(hubUsername);
hubConfigBuilder.setPassword(hubPasswordEncrypted);
hubConfigBuilder.setPasswordLength(NumberUtils.toInt(hubPasswordLength));
hubConfigBuilder.setTimeout(hubTimeoutString);
hubConfigBuilder.setProxyHost(hubProxyHost);
hubConfigBuilder.setProxyPort(hubProxyPort);
hubConfigBuilder.setIgnoredProxyHosts(hubProxyNoHost);
hubConfigBuilder.setProxyUsername(hubProxyUser);
hubConfigBuilder.setProxyPassword(hubProxyPassEncrypted);
hubConfigBuilder.setProxyPasswordLength(NumberUtils.toInt(hubProxyPassLength));
return hubConfigBuilder;
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:18,代码来源:PluginConfigurationDetails.java
示例5: createHubServerConfigBuilder
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
@Override
public HubServerConfigBuilder createHubServerConfigBuilder() {
final HubServerConfigBuilderMock configBuilder = new HubServerConfigBuilderMock();
configBuilder.setHubUrl(getHubUrl());
configBuilder.setUsername(getHubUsername());
configBuilder.setPassword(getHubPasswordEncrypted());
configBuilder.setPasswordLength(NumberUtils.toInt(getHubPasswordLength()));
configBuilder.setTimeout(getHubTimeoutString());
configBuilder.setProxyHost(getHubProxyHost());
configBuilder.setProxyPort(getHubProxyPort());
configBuilder.setIgnoredProxyHosts(getHubProxyNoHost());
configBuilder.setProxyUsername(getHubProxyUser());
configBuilder.setProxyPassword(getHubProxyPassEncrypted());
configBuilder.setProxyPasswordLength(NumberUtils.toInt(getHubProxyPassLength()));
return configBuilder;
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:20,代码来源:PluginConfigurationDetailsMock.java
示例6: createHubConfig
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
public HubServerConfig createHubConfig(final String hubUri) {
try {
final HubServerConfigBuilder configBuilder = new HubServerConfigBuilder();
configBuilder.setHubUrl(hubUri);
// using oauth the username and password aren't used but need to be set
// for the builder
configBuilder.setUsername("auser");
configBuilder.setPassword("apassword");
configBuilder.setTimeout(extensionProperties.getHubServerTimeout());
configBuilder.setProxyHost(extensionProperties.getHubProxyHost());
configBuilder.setProxyPort(extensionProperties.getHubProxyPort());
configBuilder.setIgnoredProxyHosts(extensionProperties.getHubProxyNoHost());
configBuilder.setProxyUsername(extensionProperties.getHubProxyUser());
configBuilder.setProxyPassword(extensionProperties.getHubProxyPassword());
configBuilder.setAlwaysTrustServerCertificate(alwaysTrustServerCertificate);
final HubServerConfig config = configBuilder.build();
// output the configuration details
logger.info("Hub Server URL = " + config.getHubUrl());
logger.info("Hub Timeout = " + config.getTimeout());
return config;
} catch (final IllegalStateException ex) {
logger.error("Error with the hub configuration", ex);
}
return null;
}
开发者ID:blackducksoftware,项目名称:hub-email-extension,代码行数:29,代码来源:EmailEngine.java
示例7: buildConfigFromStrings
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
public HubServerConfig buildConfigFromStrings(final String hubUrl,
final String hubUser, final String hubPass, final String hubPassLength,
final String hubImportSSLCerts, final String hubProxyUrl,
final String hubProxyPort, final String hubProxyNoHost, final String hubProxyUser,
final String hubProxyPass, final String hubProxyPassLength) {
final HubServerConfigBuilder configBuilder = new HubServerConfigBuilder();
configBuilder.setHubUrl(hubUrl);
configBuilder.setUsername(hubUser);
configBuilder.setPassword(hubPass);
configBuilder.setProxyHost(hubProxyUrl);
configBuilder.setProxyPort(hubProxyPort);
configBuilder.setProxyUsername(hubProxyUser);
configBuilder.setIgnoredProxyHosts(hubProxyNoHost);
int length = 0;
if (StringUtils.isNotBlank(hubPassLength)) {
length = Integer.valueOf(hubPassLength);
configBuilder.setPasswordLength(length);
}
if (StringUtils.isNotBlank(hubProxyUser)) {
configBuilder.setProxyPassword(hubProxyPass);
if (StringUtils.isNotBlank(hubProxyPassLength)) {
length = Integer.valueOf(hubProxyPassLength);
configBuilder.setProxyPasswordLength(length);
}
}
if (StringUtils.isNotBlank(hubImportSSLCerts)) {
configBuilder.setAutoImportHttpsCertificates(Boolean.valueOf(hubImportSSLCerts));
}
return configBuilder.build();
}
开发者ID:blackducksoftware,项目名称:hub-bamboo,代码行数:35,代码来源:HubBambooUtils.java
示例8: getHubServerConfigBuilder
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
public HubServerConfigBuilder getHubServerConfigBuilder() {
final HubServerConfigBuilder hubServerConfigBuilder = new HubServerConfigBuilder();
hubServerConfigBuilder.setHubUrl(getHubUrl());
hubServerConfigBuilder.setUsername(getHubUsername());
hubServerConfigBuilder.setPassword(getHubPassword());
hubServerConfigBuilder.setTimeout(getHubTimeout());
hubServerConfigBuilder.setProxyHost(getHubProxyHost());
hubServerConfigBuilder.setProxyPort(getHubProxyPort());
hubServerConfigBuilder.setIgnoredProxyHosts(getHubNoProxyHosts());
hubServerConfigBuilder.setProxyUsername(getHubProxyUsername());
hubServerConfigBuilder.setProxyPassword(getHubProxyPassword());
return hubServerConfigBuilder;
}
开发者ID:blackducksoftware,项目名称:hub-maven-plugin,代码行数:15,代码来源:BuildBOMGoal.java
示例9: setConfigBuilderFromSerializableConfig
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
private HubServerConfigBuilder setConfigBuilderFromSerializableConfig(final HubServerConfigSerializable config,
final PluginSettings settings) {
final HubServerConfigBuilder serverConfigBuilder = new HubServerConfigBuilder();
serverConfigBuilder.setHubUrl(config.getHubUrl());
serverConfigBuilder.setTimeout(config.getTimeout());
serverConfigBuilder.setUsername(config.getUsername());
if (StringUtils.isBlank(config.getPassword())) {
serverConfigBuilder.setPassword(null);
serverConfigBuilder.setPasswordLength(0);
} else if (StringUtils.isNotBlank(config.getPassword()) && !config.isPasswordMasked()) {
serverConfigBuilder.setPassword(config.getPassword());
serverConfigBuilder.setPasswordLength(0);
} else {
serverConfigBuilder.setPassword(getValue(settings, HubConfigKeys.CONFIG_HUB_PASS));
serverConfigBuilder
.setPasswordLength(NumberUtils.toInt(getValue(settings, HubConfigKeys.CONFIG_HUB_PASS_LENGTH)));
}
serverConfigBuilder.setProxyHost(config.getHubProxyHost());
serverConfigBuilder.setProxyPort(config.getHubProxyPort());
serverConfigBuilder.setIgnoredProxyHosts(config.getHubNoProxyHosts());
serverConfigBuilder.setProxyUsername(config.getHubProxyUser());
if (StringUtils.isBlank(config.getHubProxyPassword())) {
serverConfigBuilder.setProxyPassword(null);
serverConfigBuilder.setProxyPasswordLength(0);
} else if (StringUtils.isNotBlank(config.getHubProxyPassword()) && !config.isProxyPasswordMasked()) {
// only update the stored password if it is not the masked
// password used for display
serverConfigBuilder.setProxyPassword(config.getHubProxyPassword());
serverConfigBuilder.setProxyPasswordLength(0);
} else {
serverConfigBuilder.setProxyPassword(getValue(settings, HubConfigKeys.CONFIG_PROXY_PASS));
serverConfigBuilder.setProxyPasswordLength(
NumberUtils.toInt(getValue(settings, HubConfigKeys.CONFIG_PROXY_PASS_LENGTH)));
}
return serverConfigBuilder;
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:39,代码来源:HubConfigController.java
示例10: createHubServerConfig
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
public HubServerConfig createHubServerConfig(final PluginConfigurationDetails configDetails) {
final HubServerConfigBuilder hubConfigBuilder = configDetails.createHubServerConfigBuilder();
HubServerConfig hubServerConfig = null;
if (configDetails.getProjectMappingJson() == null) {
logger.debug("HubNotificationCheckTask: Project Mappings not configured, therefore there is nothing to do.");
return null;
}
if (configDetails.getPolicyRulesJson() == null) {
logger.debug("HubNotificationCheckTask: Policy Rules not configured, therefore there is nothing to do.");
return null;
}
try {
logger.debug("Building Hub configuration");
hubServerConfig = hubConfigBuilder.build();
logger.debug("Finished building Hub configuration");
} catch (final IllegalStateException e) {
logger.error(
"Unable to connect to the Hub. This could mean the Hub is currently unreachable, or that at least one of the Black Duck plugins (either the Hub Admin plugin or the Hub JIRA plugin) is not (yet) configured correctly: "
+ e.getMessage());
return null;
}
logger.debug("Last run date: " + configDetails.getLastRunDateString());
logger.debug("Hub url / username: " + hubServerConfig.getHubUrl().toString() + " / " + hubServerConfig.getGlobalCredentials().getUsername());
logger.debug("Interval: " + configDetails.getIntervalString());
return hubServerConfig;
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:31,代码来源:IssueTrackerTask.java
示例11: getHubServerConfig
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
private HubServerConfig getHubServerConfig(final IntLogger logger, final CIEnvironmentVariables commonVariables) {
final HubServerConfigBuilder configBuilder = new HubServerConfigBuilder();
// read the credentials and proxy info using the existing objects.
final String serverUrl = commonVariables.getValue(HubConstantValues.HUB_URL);
final String timeout = commonVariables.getValue(HubConstantValues.HUB_CONNECTION_TIMEOUT);
final String username = commonVariables.getValue(HubConstantValues.HUB_USERNAME);
final String password = commonVariables.getValue(HubConstantValues.HUB_PASSWORD);
final String passwordLength = commonVariables.getValue(HubConstantValues.HUB_PASSWORD_LENGTH);
final String autoImportHttpsCertificates = commonVariables.getValue(HubConstantValues.HUB_IMPORT_SSL_CERT);
final String proxyHost = commonVariables.getValue(HubConstantValues.HUB_PROXY_HOST);
final String proxyPort = commonVariables.getValue(HubConstantValues.HUB_PROXY_PORT);
final String ignoredProxyHosts = commonVariables.getValue(HubConstantValues.HUB_NO_PROXY_HOSTS);
final String proxyUsername = commonVariables.getValue(HubConstantValues.HUB_PROXY_USER);
final String proxyPassword = commonVariables.getValue(HubConstantValues.HUB_PROXY_PASS);
final String proxyPasswordLength = commonVariables.getValue(HubConstantValues.HUB_PROXY_PASS_LENGTH);
configBuilder.setHubUrl(serverUrl);
configBuilder.setUsername(username);
configBuilder.setPassword(password);
configBuilder.setPasswordLength(NumberUtils.toInt(passwordLength));
configBuilder.setTimeout(timeout);
configBuilder.setAutoImportHttpsCertificates(Boolean.valueOf(autoImportHttpsCertificates));
configBuilder.setProxyHost(proxyHost);
configBuilder.setProxyPort(proxyPort);
configBuilder.setIgnoredProxyHosts(ignoredProxyHosts);
configBuilder.setProxyUsername(proxyUsername);
configBuilder.setProxyPassword(proxyPassword);
configBuilder.setProxyPasswordLength(NumberUtils.toInt(proxyPasswordLength));
try {
return configBuilder.build();
} catch (final IllegalStateException e) {
logger.error(e.getMessage(), e);
}
return null;
}
开发者ID:blackducksoftware,项目名称:hub-teamcity,代码行数:42,代码来源:HubBuildProcess.java
示例12: setConfigBuilderFromSerializableConfig
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
private HubServerConfigBuilder setConfigBuilderFromSerializableConfig(final HubServerConfigSerializable config,
final PluginSettings settings) {
final HubServerConfigBuilder serverConfigBuilder = new HubServerConfigBuilder();
serverConfigBuilder.setHubUrl(config.getHubUrl());
serverConfigBuilder.setTimeout(config.getTimeout());
serverConfigBuilder.setUsername(config.getUsername());
if (StringUtils.isBlank(config.getPassword())) {
serverConfigBuilder.setPassword(null);
serverConfigBuilder.setPasswordLength(0);
} else if (StringUtils.isNotBlank(config.getPassword()) && !config.isPasswordMasked()) {
serverConfigBuilder.setPassword(config.getPassword());
serverConfigBuilder.setPasswordLength(0);
} else {
serverConfigBuilder.setPassword(getValue(settings, HubConfigKeys.CONFIG_HUB_PASS));
serverConfigBuilder
.setPasswordLength(NumberUtils.toInt(getValue(settings, HubConfigKeys.CONFIG_HUB_PASS_LENGTH)));
}
if (config.getImportSSLCerts() != null) {
serverConfigBuilder.setAutoImportHttpsCertificates(config.getImportSSLCerts());
}
serverConfigBuilder.setProxyHost(config.getHubProxyHost());
serverConfigBuilder.setProxyPort(config.getHubProxyPort());
serverConfigBuilder.setIgnoredProxyHosts(config.getHubNoProxyHosts());
serverConfigBuilder.setProxyUsername(config.getHubProxyUser());
if (StringUtils.isBlank(config.getHubProxyPassword())) {
serverConfigBuilder.setProxyPassword(null);
serverConfigBuilder.setProxyPasswordLength(0);
} else if (StringUtils.isNotBlank(config.getHubProxyPassword()) && !config.isProxyPasswordMasked()) {
// only update the stored password if it is not the masked
// password used for display
serverConfigBuilder.setProxyPassword(config.getHubProxyPassword());
serverConfigBuilder.setProxyPasswordLength(0);
} else {
serverConfigBuilder.setProxyPassword(getValue(settings, HubConfigKeys.CONFIG_PROXY_PASS));
serverConfigBuilder.setProxyPasswordLength(
NumberUtils.toInt(getValue(settings, HubConfigKeys.CONFIG_PROXY_PASS_LENGTH)));
}
return serverConfigBuilder;
}
开发者ID:blackducksoftware,项目名称:hub-bamboo,代码行数:44,代码来源:HubConfigController.java
示例13: get
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
@Path("/read")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response get(@Context final HttpServletRequest request) {
final PluginSettings settings = pluginSettingsFactory.createGlobalSettings();
final Response response = checkUserPermissions(request, settings);
if (response != null) {
return response;
}
final Object obj = transactionTemplate.execute(new TransactionCallback() {
@Override
public Object doInTransaction() {
final String hubUrl = getValue(settings, HubConfigKeys.CONFIG_HUB_URL);
logger.debug(String.format("Returning hub details for %s", hubUrl));
final String username = getValue(settings, HubConfigKeys.CONFIG_HUB_USER);
final String password = getValue(settings, HubConfigKeys.CONFIG_HUB_PASS);
final String passwordLength = getValue(settings, HubConfigKeys.CONFIG_HUB_PASS_LENGTH);
final String timeout = getValue(settings, HubConfigKeys.CONFIG_HUB_TIMEOUT);
final String proxyHost = getValue(settings, HubConfigKeys.CONFIG_PROXY_HOST);
final String proxyPort = getValue(settings, HubConfigKeys.CONFIG_PROXY_PORT);
final String noProxyHosts = getValue(settings, HubConfigKeys.CONFIG_PROXY_NO_HOST);
final String proxyUser = getValue(settings, HubConfigKeys.CONFIG_PROXY_USER);
final String proxyPassword = getValue(settings, HubConfigKeys.CONFIG_PROXY_PASS);
final String proxyPasswordLength = getValue(settings, HubConfigKeys.CONFIG_PROXY_PASS_LENGTH);
final HubServerConfigSerializable config = new HubServerConfigSerializable();
final HubServerConfigBuilder serverConfigBuilder = new HubServerConfigBuilder();
serverConfigBuilder.setHubUrl(hubUrl);
serverConfigBuilder.setTimeout(timeout);
serverConfigBuilder.setUsername(username);
serverConfigBuilder.setPassword(password);
serverConfigBuilder.setPasswordLength(NumberUtils.toInt(passwordLength));
serverConfigBuilder.setProxyHost(proxyHost);
serverConfigBuilder.setProxyPort(proxyPort);
serverConfigBuilder.setIgnoredProxyHosts(noProxyHosts);
serverConfigBuilder.setProxyUsername(proxyUser);
serverConfigBuilder.setProxyPassword(proxyPassword);
serverConfigBuilder.setProxyPasswordLength(NumberUtils.toInt(proxyPasswordLength));
setConfigFromResult(config, serverConfigBuilder.createValidator());
config.setHubUrl(hubUrl);
config.setUsername(username);
if (StringUtils.isNotBlank(password)) {
final int passwordLengthInt = getIntFromObject(passwordLength);
if (passwordLengthInt > 0) {
config.setPasswordLength(passwordLengthInt);
config.setPassword(config.getMaskedPassword());
}
}
config.setTimeout(timeout);
config.setHubProxyHost(proxyHost);
config.setHubProxyPort(proxyPort);
config.setHubNoProxyHosts(noProxyHosts);
config.setHubProxyUser(proxyUser);
if (StringUtils.isNotBlank(proxyPassword)) {
final int hubProxyPasswordLength = getIntFromObject(proxyPasswordLength);
if (hubProxyPasswordLength > 0) {
config.setHubProxyPasswordLength(hubProxyPasswordLength);
config.setHubProxyPassword(config.getMaskedProxyPassword());
}
}
return config;
}
});
return Response.ok(obj).build();
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:71,代码来源:HubConfigController.java
示例14: testConnection
import com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder; //导入依赖的package包/类
@Path("/testConnection")
@PUT
@Consumes(MediaType.APPLICATION_JSON)
public Response testConnection(final HubServerConfigSerializable config,
@Context final HttpServletRequest request) {
try {
final PluginSettings settings = pluginSettingsFactory.createGlobalSettings();
final Response response = checkUserPermissions(request, settings);
if (response != null) {
return response;
}
transactionTemplate.execute(new TransactionCallback() {
@Override
public Object doInTransaction() {
final HubServerConfigBuilder serverConfigBuilder = setConfigBuilderFromSerializableConfig(config,
settings);
setConfigFromResult(config, serverConfigBuilder.createValidator());
if (config.hasErrors()) {
return config;
} else {
final HubServerConfig serverConfig = serverConfigBuilder.build();
try {
final CredentialsRestConnection restConnection = new CredentialsRestConnection(logger, serverConfig.getHubUrl(),
serverConfig.getGlobalCredentials().getUsername(),
serverConfig.getGlobalCredentials().getDecryptedPassword(),
serverConfig.getTimeout());
restConnection.connect();
} catch (final IntegrationException e) {
if (e.getMessage().toLowerCase().contains("unauthorized")) {
config.setUsernameError(
"Username and Password are invalid for : " + serverConfig.getHubUrl());
} else {
config.setTestConnectionError(e.toString());
}
}
return config;
}
}
});
if (config.hasErrors()) {
return Response.ok(config).status(Status.BAD_REQUEST).build();
}
return Response.noContent().build();
} catch (final Throwable t) {
final StringBuilder sb = new StringBuilder();
sb.append("Unexpected exception caught in testConnection(): ");
sb.append(t.getMessage());
if (t.getCause() != null) {
sb.append("; Caused by: ");
sb.append(t.getCause().getMessage());
}
config.setHubUrlError(sb.toString());
return Response.ok(config).status(Status.BAD_REQUEST).build();
}
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:62,代码来源:HubConfigController.java
注:本文中的com.blackducksoftware.integration.hub.builder.HubServerConfigBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论