當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。