当前位置: 首页>>代码示例>>Java>>正文


Java Settings.getString方法代码示例

本文整理汇总了Java中org.sonar.api.config.Settings.getString方法的典型用法代码示例。如果您正苦于以下问题:Java Settings.getString方法的具体用法?Java Settings.getString怎么用?Java Settings.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.sonar.api.config.Settings的用法示例。


在下文中一共展示了Settings.getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GitLabPluginConfiguration

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
public GitLabPluginConfiguration(Settings settings, System2 system2) {
    super();

    this.settings = settings;
    this.system2 = system2;

    String tempBaseUrl = settings.hasKey(CoreProperties.SERVER_BASE_URL) ? settings.getString(CoreProperties.SERVER_BASE_URL) : settings.getString("sonar.host.url");
    if (tempBaseUrl == null) {
        tempBaseUrl = "http://localhost:9090";
    }
    if (!tempBaseUrl.endsWith("/")) {
        tempBaseUrl += "/";
    }
    this.baseUrl = tempBaseUrl;

    LOG.info("GlobalWorkingDir {}", settings.getString(CoreProperties.GLOBAL_WORKING_DIRECTORY));
}
 
开发者ID:gabrie-allaigre,项目名称:sonar-gitlab-plugin,代码行数:18,代码来源:GitLabPluginConfiguration.java

示例2: readProjectConfigurations

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
private static Map<String, ProjectConfiguration> readProjectConfigurations(Settings settings) {
	Map<String, ProjectConfiguration> projectConfigs = new HashMap<>();
	String[] projectIndexes = settings.getStringArray(SlackNotifierPlugin.SLACK_PROJECTS);
	LOG.info(MessageFormat.format("Project configurations: [{0}]", Arrays.toString(projectIndexes)));
	
	for (String projectIndex : projectIndexes) {
		String projectKey = settings.getString(getPropertyProjectKey(projectIndex));
		String projectChannel = settings.getString(getPropertyProjectChannel(projectIndex));
		if (projectKey == null || projectChannel == null) {
			LOG.info(MessageFormat.format("Invalid project configuration. Project key or channel name missing.Project Key = {0}, Channel name = {1}", projectKey, projectChannel));
			continue;
		}
		
		ProjectConfiguration projectConfig = new ProjectConfiguration(projectKey, projectChannel);
		LOG.info(MessageFormat.format("Found project configuration [key = {0}, channel={1}]", projectConfig.getKey(), projectConfig.getChannel()));
		projectConfigs.put(projectConfig.getKey(), projectConfig);
	}
	return projectConfigs;
}
 
开发者ID:astrebel,项目名称:sonar-slack-notifier-plugin,代码行数:20,代码来源:SlackNotificationChannel.java

示例3: FileParserSensor

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
public FileParserSensor(Settings settings) {
    String pathFromSettings = settings.getString(FileParserPlugin.FOLDER_PATH);
    String nameFromSettings = settings.getString(FileParserPlugin.FILE_NAME);

    if(pathFromSettings.equals(FileParserPlugin.DEFAULT_PATH)) {
        pathFromSettings = settings.getString("sonar.projectBaseDir");
    }

    if(nameFromSettings.equals(FileParserPlugin.DEFAULT_FILE)) {
        nameFromSettings = settings.getString("sonar.projectKey") + ".fileParser";
    }
    this.path = pathFromSettings;
    this.name = nameFromSettings;
    this.numberFiles  = settings.getInt(FileParserPlugin.FILE_NUMBER);
    this.separator  = settings.getString(FileParserPlugin.FILE_SEPARATOR);
}
 
开发者ID:mxmo0rhuhn,项目名称:sonarQubeFileParser,代码行数:17,代码来源:FileParserSensor.java

示例4: doCreateIssue

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
protected RemoteIssue doCreateIssue(Issue sonarIssue, JiraSoapSession soapSession, Settings settings, String commentText) {
  // Connect to JIRA
  String jiraUrl = settings.getString(JiraConstants.SERVER_URL_PROPERTY);
  String userName = settings.getString(JiraConstants.USERNAME_PROPERTY);
  String password = settings.getString(JiraConstants.PASSWORD_PROPERTY);
  try {
    soapSession.connect(userName, password);
  } catch (RemoteException e) {
    throw new IllegalStateException("Impossible to connect to the JIRA server (" + jiraUrl + ").", e);
  }

  // The JIRA SOAP Service and authentication token are used to make authentication calls
  JiraSoapService jiraSoapService = soapSession.getJiraSoapService();
  String authToken = soapSession.getAuthenticationToken();

  // And create the issue
  RemoteIssue issue = initRemoteIssue(sonarIssue, settings, commentText);
  RemoteIssue returnedIssue = sendRequest(jiraSoapService, authToken, issue, jiraUrl, userName);

  String issueKey = returnedIssue.getKey();
  LOG.debug("Successfully created issue {}", issueKey);

  return returnedIssue;
}
 
开发者ID:aifraenkel,项目名称:caltec-tools,代码行数:25,代码来源:JiraIssueCreator.java

示例5: sonarSeverityToJiraPriorityId

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
protected String sonarSeverityToJiraPriorityId(RulePriority reviewSeverity, Settings settings) {
  final String priorityId;
  switch (reviewSeverity) {
    case INFO:
      priorityId = settings.getString(JiraConstants.JIRA_INFO_PRIORITY_ID);
      break;
    case MINOR:
      priorityId = settings.getString(JiraConstants.JIRA_MINOR_PRIORITY_ID);
      break;
    case MAJOR:
      priorityId = settings.getString(JiraConstants.JIRA_MAJOR_PRIORITY_ID);
      break;
    case CRITICAL:
      priorityId = settings.getString(JiraConstants.JIRA_CRITICAL_PRIORITY_ID);
      break;
    case BLOCKER:
      priorityId = settings.getString(JiraConstants.JIRA_BLOCKER_PRIORITY_ID);
      break;
    default:
      throw new SonarException("Unable to convert review severity to JIRA priority: " + reviewSeverity);
  }
  return priorityId;
}
 
开发者ID:aifraenkel,项目名称:caltec-tools,代码行数:24,代码来源:JiraIssueCreator.java

示例6: MarkDownUtils

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
public MarkDownUtils(Settings settings) {
  // If server base URL was not configured in SQ server then is is better to take URL configured on batch side
  String baseUrl = settings.hasKey(CoreProperties.SERVER_BASE_URL) ? settings.getString(CoreProperties.SERVER_BASE_URL) : settings.getString("sonar.host.url");
  if (!baseUrl.endsWith("/")) {
    baseUrl += "/";
  }
  this.ruleUrlPrefix = baseUrl;
}
 
开发者ID:SonarSource,项目名称:sonar-github,代码行数:9,代码来源:MarkDownUtils.java

示例7: OAuth2Client

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
/**
 * Default constructor. Accepts Sonar {@link Settings} in order to bootstrap
 * the class.
 * @param settings The {@link Settings} from the currently running Sonar instance.
 * @throws OAuthSystemException If there is insufficient or conflicting configurations.
 */
public OAuth2Client(Settings settings) throws OAuthSystemException {
  this.settings = settings;
  final String provider = settings.getString(PROPERTY_PROVIDER);
  if (provider!=null) {
    providerType = OAuthProviderType.valueOf(provider.toUpperCase());
  }
  if (providerType==null) {
    authLocation = settings.getString(PROPERTY_AUTH_LOCATION);
    tokenLocation = settings.getString(PROPERTY_TOKEN_LOCATION);
    if (authLocation==null) {
      throw new OAuthSystemException("You must specify either an OAuth2 "
            + "provider or an authentication location.");
    }
  } else {
    authLocation = providerType.getAuthzEndpoint();
    tokenLocation = providerType.getTokenEndpoint();
  }
  redirReqBuilder = OAuthClientRequest.authorizationLocation(authLocation);
  final String baseUrl = settings.getString(PROPERTY_SONAR_URL);
  final String clientId = settings.getString(PROPERTY_CLIENT_ID);
  clientSecret = settings.getString(PROPERTY_SECRET);
  if (baseUrl==null || clientId==null || clientSecret==null) {
    throw new OAuthSystemException("'"+PROPERTY_SONAR_URL+"', '"+PROPERTY_CLIENT_ID+"', AND '"+PROPERTY_SECRET
          +"' MUST be set to configure OAuthClientRequest.");
  }
  final String callback = baseUrl+(baseUrl.endsWith("/")?"":"/")+"oauth2/callback";
  redirReqBuilder
            .setClientId(clientId)
            .setScope(OAUTH2_SCOPE_EMAIL);
  redirReqBuilder.setRedirectURI(callback);
}
 
开发者ID:InfoSec812,项目名称:sonar-oauth2,代码行数:38,代码来源:OAuth2Client.java

示例8: ADSettings

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
/**
 * Constructor
 * @param settings
 */
@Properties(
    @Property(key=Constants.CONFIG_OVERRIDE_AD_DOMAIN, name="AD domain to search for", defaultValue="")
)
public ADSettings(Settings settings) {
    dnsDomain = settings.getString(Constants.CONFIG_OVERRIDE_AD_DOMAIN);
}
 
开发者ID:programmingforliving,项目名称:sonar-ad-plugin,代码行数:11,代码来源:ADSettings.java

示例9: getFile

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
private static File getFile(Settings settings, String property) {
  String path = settings.getString(property);
  if (path == null) {
    throw MessageException.of("Missing property '" + property + "'");
  }
  File file = new File(path);
  if (!file.isAbsolute()) {
    throw MessageException.of("Path must be absolute - check property '" + property + "'" );
  }
  return file;
}
 
开发者ID:SonarSource,项目名称:sonar-lits,代码行数:12,代码来源:IssuesChecker.java

示例10: createSoapSession

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
protected JiraSoapSession createSoapSession(Settings settings) {
  String jiraUrl = settings.getString(JiraConstants.SERVER_URL_PROPERTY);
  String baseUrl = settings.getString(JiraConstants.SOAP_BASE_URL_PROPERTY);
  String completeUrl = jiraUrl + baseUrl;

  // get handle to the JIRA SOAP Service from a client point of view
  JiraSoapSession soapSession = null;
  try {
    soapSession = new JiraSoapSession(new URL(completeUrl));
  } catch (MalformedURLException e) {
    LOG.error("The JIRA server URL is not a valid one: " + completeUrl, e);
    throw new IllegalStateException("The JIRA server URL is not a valid one: " + completeUrl, e);
  }
  return soapSession;
}
 
开发者ID:aifraenkel,项目名称:caltec-tools,代码行数:16,代码来源:JiraIssueCreator.java

示例11: initRemoteIssue

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
protected RemoteIssue initRemoteIssue(Issue sonarIssue, Settings settings, String commentText) {
  RemoteIssue issue = new RemoteIssue();
  issue.setProject(settings.getString(JiraConstants.JIRA_PROJECT_KEY_PROPERTY));
  issue.setType(settings.getString(JiraConstants.JIRA_ISSUE_TYPE_ID));
  issue.setPriority(sonarSeverityToJiraPriorityId(RulePriority.valueOf(sonarIssue.severity()), settings));
  issue.setSummary(generateIssueSummary(sonarIssue));
  issue.setDescription(generateIssueDescription(sonarIssue, settings, commentText));
  String componentId = settings.getString(JiraConstants.JIRA_ISSUE_COMPONENT_ID);
  if (!JiraConstants.JIRA_ISSUE_COMPONENT_ID_BLANK.equals(componentId)) {
    RemoteComponent rc = new RemoteComponent();
    rc.setId(componentId);
    issue.setComponents(new RemoteComponent[]{rc});
  }
  return issue;
}
 
开发者ID:aifraenkel,项目名称:caltec-tools,代码行数:16,代码来源:JiraIssueCreator.java

示例12: fileSuffixes

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
public static String[] fileSuffixes(Settings settings) {
  String[] result;

  String oldFileExtensions = settings.getString(WebConstants.OLD_FILE_EXTENSIONS_PROP_KEY);
  if (oldFileExtensions != null) {
    logDeprecatedPropertyUsage(WebConstants.FILE_EXTENSIONS_PROP_KEY, WebConstants.OLD_FILE_EXTENSIONS_PROP_KEY);
    result = settings.getStringArray(WebConstants.OLD_FILE_EXTENSIONS_PROP_KEY);
  } else {
    result = settings.getStringArray(WebConstants.FILE_EXTENSIONS_PROP_KEY);
  }
  return result;
}
 
开发者ID:SonarSource,项目名称:sonar-web,代码行数:13,代码来源:WebConfiguration.java

示例13: CodeGuardIssuesFilesProvider

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
public CodeGuardIssuesFilesProvider(final Settings settings) {

		final String reportEnd = settings.getString(Constants.CG_REPORT_FILE);
		this.reportsProvider = new BaseReportsProvider(reportEnd);
	}
 
开发者ID:gretard,项目名称:sonar-tsql-plugin,代码行数:6,代码来源:CodeGuardIssuesFilesProvider.java

示例14: MsIssuesFilesProvider

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
public MsIssuesFilesProvider(final Settings settings) {
	final String reportEnd = settings.getString(Constants.MS_REPORT_FILE);
	this.reportsProvider = new BaseReportsProvider(reportEnd);
}
 
开发者ID:gretard,项目名称:sonar-tsql-plugin,代码行数:5,代码来源:MsIssuesFilesProvider.java

示例15: CodeReviewInitialize

import org.sonar.api.config.Settings; //导入方法依赖的package包/类
public CodeReviewInitialize(Settings settings, FileSystem fs) {
	super();

	this.relativePath = settings.getString(BWCodeReviewPlugin.FC_CODE_REVIEW_RESULTS_RELATIVE_PATH);
	this.fs = fs;
}
 
开发者ID:fastconnect,项目名称:tibco-codereview,代码行数:7,代码来源:CodeReviewInitialize.java


注:本文中的org.sonar.api.config.Settings.getString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。