當前位置: 首頁>>代碼示例>>Java>>正文


Java ConfigKeys類代碼示例

本文整理匯總了Java中org.spotter.shared.configuration.ConfigKeys的典型用法代碼示例。如果您正苦於以下問題:Java ConfigKeys類的具體用法?Java ConfigKeys怎麽用?Java ConfigKeys使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ConfigKeys類屬於org.spotter.shared.configuration包,在下文中一共展示了ConfigKeys類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
@Override
public void init(Properties problemDetectionConfiguration, EDCDetectionController controller) {
	this.controller = controller;

	perfReqThreshold = GlobalConfiguration.getInstance().getPropertyAsDouble(
			ConfigKeys.PERFORMANCE_REQUIREMENT_THRESHOLD, ConfigKeys.DEFAULT_PERFORMANCE_REQUIREMENT_THRESHOLD);
	perfReqConfidence = GlobalConfiguration.getInstance().getPropertyAsDouble(
			ConfigKeys.PERFORMANCE_REQUIREMENT_CONFIDENCE, ConfigKeys.DEFAULT_PERFORMANCE_REQUIREMENT_CONFIDENCE);

	String sRelativeQRT = controller.getProblemDetectionConfiguration().getProperty(
			EDCExtension.PERF_REQ_RELATIVE_QUERY_RT_KEY,
			String.valueOf(EDCExtension.PERF_REQ_RELATIVE_QUERY_RT_DEFAULT));
	perfReqRelativeQueryRT = Double.valueOf(sRelativeQRT);
	String sRelativeQRTDiff = controller.getProblemDetectionConfiguration().getProperty(
			EDCExtension.PERF_REQ_RELATIVE_QUERY_RT_DIFF_KEY,
			String.valueOf(EDCExtension.PERF_REQ_RELATIVE_QUERY_RT_DIFF_DEFAULT));
	perfReqRelativeQueryRTDiff = Double.valueOf(sRelativeQRTDiff);

	numUsers = GlobalConfiguration.getInstance().getPropertyAsLong(ConfigKeys.WORKLOAD_MAXUSERS);

}
 
開發者ID:sopeco,項目名稱:DynamicSpotter-Extensions,代碼行數:22,代碼來源:RelativeQueryRTStrategy.java

示例2: setProblemDetectionConfiguration

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
@Override
public void setProblemDetectionConfiguration(Properties problemDetectionConfiguration) {
	String warmupPhaseStr = problemDetectionConfiguration
			.getProperty(RampExtension.KEY_STIMULATION_PHASE_DURATION_FACTOR);
	stimulationPhaseDuration = (int) ((warmupPhaseStr != null ? Double.parseDouble(warmupPhaseStr)
			: RampExtension.STIMULATION_PHASE_DURATION_DEFAULT) * GlobalConfiguration.getInstance()
			.getPropertyAsDouble(ConfigKeys.EXPERIMENT_DURATION));

	String experimentStepsStr = problemDetectionConfiguration.getProperty(RampExtension.KEY_EXPERIMENT_STEPS);
	experimentSteps = experimentStepsStr != null ? Integer.parseInt(experimentStepsStr)
			: RampExtension.EXPERIMENT_STEPS_DEFAULT;

	String significanceStepsStr = problemDetectionConfiguration
			.getProperty(RampExtension.KEY_REQUIRED_SIGNIFICANT_STEPS);
	reuiqredSignificanceSteps = significanceStepsStr != null ? Integer.parseInt(significanceStepsStr)
			: RampExtension.REQUIRED_SIGNIFICANT_STEPS_DEFAULT;

	String significanceLevelStr = problemDetectionConfiguration
			.getProperty(RampExtension.KEY_REQUIRED_SIGNIFICANCE_LEVEL);
	requiredSignificanceLevel = significanceLevelStr != null ? Double.parseDouble(significanceLevelStr)
			: RampExtension.REQUIRED_SIGNIFICANCE_LEVEL_DEFAULT;
}
 
開發者ID:sopeco,項目名稱:DynamicSpotter-Extensions,代碼行數:23,代碼來源:TimeWindowsStrategy.java

示例3: stimulateSystem

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
private void stimulateSystem(int duration) throws WorkloadException {
	LoadConfig lConfig = new LoadConfig();
	lConfig.setNumUsers(GlobalConfiguration.getInstance().getPropertyAsInteger(ConfigKeys.WORKLOAD_MAXUSERS));
	lConfig.setRampUpIntervalLength(GlobalConfiguration.getInstance().getPropertyAsInteger(
			ConfigKeys.EXPERIMENT_RAMP_UP_INTERVAL_LENGTH));
	lConfig.setRampUpUsersPerInterval(GlobalConfiguration.getInstance().getPropertyAsInteger(
			ConfigKeys.EXPERIMENT_RAMP_UP_NUM_USERS_PER_INTERVAL));
	lConfig.setCoolDownIntervalLength(GlobalConfiguration.getInstance().getPropertyAsInteger(
			ConfigKeys.EXPERIMENT_COOL_DOWN_INTERVAL_LENGTH));
	lConfig.setCoolDownUsersPerInterval(GlobalConfiguration.getInstance().getPropertyAsInteger(
			ConfigKeys.EXPERIMENT_COOL_DOWN_NUM_USERS_PER_INTERVAL));
	lConfig.setExperimentDuration(duration);
	mainDetectionController.workloadAdapter().startLoad(lConfig);

	mainDetectionController.workloadAdapter().waitForFinishedLoad();
}
 
開發者ID:sopeco,項目名稱:DynamicSpotter-Extensions,代碼行數:17,代碼來源:TimeWindowsStrategy.java

示例4: startDiagnosis

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
/**
 * Starts Dynamic Spotter diagnosis.
 * 
 * @param jobDescription
 *            job description object containing the whole DS setup such as
 *            config values, environment and hierarchy configuration
 * @throws IOException
 *             thrown if experiment fails
 * @return job id, 0 if already running
 */
@POST
@Path(ConfigKeys.SPOTTER_REST_START_DIAG)
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public SpotterServiceResponse<Long> startDiagnosis(JobDescription jobDescription) throws IOException {
	try {
		long jobId = SpotterServiceWrapper.getInstance().startDiagnosis(jobDescription);
		if (jobId == 0) {
			return new SpotterServiceResponse<Long>(jobId, ResponseStatus.INVALID_STATE);
		} else {
			return new SpotterServiceResponse<Long>(jobId, ResponseStatus.OK);
		}
	} catch (Exception e) {
		return createErrorResponse(e);
	}
}
 
開發者ID:sopeco,項目名稱:DynamicSpotter,代碼行數:27,代碼來源:SpotterService.java

示例5: requestResults

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
/**
 * Retrieves results from a Dynamic Spotter diagnosis that matches the given
 * job id.
 * 
 * @param jobId
 *            the job id matching to the diagnosis run to fetch the results
 *            of
 * @return the results container for the given id or <code>null</code> if
 *         for the id no results exist
 */
@POST
@Path(ConfigKeys.SPOTTER_REST_REQU_RESULTS)
@Consumes(MediaType.APPLICATION_JSON)
@Produces("application/zip")
public StreamingOutput requestResults(String jobId) {
	if (jobId == null) {
		return null;
	}
	try {
		return SpotterServiceWrapper.getInstance().requestResults(jobId);
	} catch (Exception e) {
		LOGGER.error("Server error: " + e);
	}
	return null;
}
 
開發者ID:sopeco,項目名稱:DynamicSpotter,代碼行數:26,代碼來源:SpotterService.java

示例6: getDataPath

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
/**
 * Returns the directory where raw experiment data is store in.
 * 
 * @return directory where raw experiment data is store in.
 */
public String getDataPath() {
	StringBuilder pathBuilder = new StringBuilder();
	if (dataPath == null) {
		pathBuilder.append(GlobalConfiguration.getInstance().getProperty(ConfigKeys.RESULT_DIR));
		pathBuilder.append(getControllerIdentifier());
		pathBuilder.append(System.getProperty("file.separator"));

		pathBuilder.append(ResultsLocationConstants.CSV_SUB_DIR);
		pathBuilder.append(System.getProperty("file.separator"));

		dataPath = pathBuilder.toString();
	} else {
		pathBuilder.append(dataPath);
	}
	return pathBuilder.toString();
}
 
開發者ID:sopeco,項目名稱:DynamicSpotter,代碼行數:22,代碼來源:DetectionResultManager.java

示例7: getAdditionalResourcesPath

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
/**
 * Returns the path for additional resources.
 * 
 * @return directory where additional resources shall be stored
 */
public String getAdditionalResourcesPath() {
	StringBuilder pathBuilder = new StringBuilder();
	if (resourcePath == null) {
		pathBuilder.append(GlobalConfiguration.getInstance().getProperty(ConfigKeys.RESULT_DIR));
		pathBuilder.append(getControllerIdentifier());
		pathBuilder.append(System.getProperty("file.separator"));

		pathBuilder.append(ResultsLocationConstants.RESULT_RESOURCES_SUB_DIR);
		pathBuilder.append(System.getProperty("file.separator"));

		resourcePath = pathBuilder.toString();
		File file = new File(resourcePath);
		if (!file.exists()) {
			LpeFileUtils.createDir(resourcePath);
		}
	} else {
		pathBuilder.append(resourcePath);
	}

	return pathBuilder.toString();
}
 
開發者ID:sopeco,項目名稱:DynamicSpotter,代碼行數:27,代碼來源:DetectionResultManager.java

示例8: instrumentApplication

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
/**
 * Instruments the target application according to the passed
 * {@link instDescription}.
 * 
 * @param instDescription
 *            instrumentation description describing the desired
 *            instrumentation state of the target application
 * @throws InstrumentationException
 *             if instrumentation fails
 * @throws MeasurementException
 *             if instrumentation fails
 */
protected void instrumentApplication(InstrumentationDescription instDescription) throws InstrumentationException,
		MeasurementException {
	ProgressManager.getInstance().updateProgressStatus(getProblemId(), DiagnosisStatus.INSTRUMENTING);
	long instrumentationStart = System.currentTimeMillis();

	InstrumentationDescriptionBuilder descriptionBuilder = new InstrumentationDescriptionBuilder();
	String excludes = GlobalConfiguration.getInstance().getProperty(ConfigKeys.INSTRUMENTATION_EXCLUDES, "");
	for (String exc : excludes.split(ConfigParameterDescription.LIST_VALUE_SEPARATOR)) {
		descriptionBuilder.newGlobalRestriction().excludePackage(exc);
	}

	descriptionBuilder.appendOtherDescription(instDescription);

	for (IExperimentReuser reuser : experimentReuser) {
		descriptionBuilder.appendOtherDescription(reuser.getInstrumentationDescription());
	}
	InstrumentationDescription aggregatedDescription = descriptionBuilder.build();
	getInstrumentationController().instrument(aggregatedDescription);
	measurementController.prepareMonitoring(aggregatedDescription);
	instrumented = true;
	ProgressManager.getInstance().addAdditionalDuration(
			(System.currentTimeMillis() - instrumentationStart) / SECOND);

}
 
開發者ID:sopeco,項目名稱:DynamicSpotter,代碼行數:37,代碼來源:AbstractDetectionController.java

示例9: retrieveRootPerformanceProblem

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
/**
 * Reads the performance problem hierarchy file and returns the root
 * performance problem of that hierarchy.
 * 
 * @param resultsContainer
 *            container in which to store the original root problem
 * @return the root problem
 */
private PerformanceProblem retrieveRootPerformanceProblem(ResultsContainer resultsContainer) {
	String hierarchyFileName = GlobalConfiguration.getInstance()
			.getProperty(ConfigKeys.CONF_PROBLEM_HIERARCHY_FILE);
	if (hierarchyFileName == null || !new File(hierarchyFileName).exists()) {
		throw new IllegalArgumentException(
				"Please provide a proper configuration for the performance problem hierarchy file!");
	}

	PerformanceProblem problem = HierarchyFactory.getInstance().createPerformanceProblemHierarchy(
			hierarchyFileName, resultsContainer);
	if (problem.getChildren().isEmpty()) {
		throw new IllegalArgumentException(
				"The performance problem hierarchy file does not contain at least one problem!");
	}
	return problem;
}
 
開發者ID:sopeco,項目名稱:DynamicSpotter,代碼行數:25,代碼來源:Spotter.java

示例10: createConfigFile

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
private static void createConfigFile(String baseDir, String hierarchyFile, String envFile) throws IOException {
	String dir = System.getProperty("user.dir");
	Properties properties = new Properties();
	properties.setProperty("org.lpe.common.extension.appRootDir", cleanPath(dir));
	properties.setProperty("org.spotter.conf.pluginDirNames", "plugins");

	properties.setProperty(ConfigKeys.CONF_PROBLEM_HIERARCHY_FILE, cleanPath(hierarchyFile));
	properties.setProperty(ConfigKeys.MEASUREMENT_ENVIRONMENT_FILE, cleanPath(envFile));
	properties.setProperty(ConfigKeys.RESULT_DIR, cleanPath(baseDir));

	properties.setProperty(ConfigKeys.EXPERIMENT_DURATION, "1");
	properties.setProperty(ConfigKeys.EXPERIMENT_COOL_DOWN_INTERVAL_LENGTH, "1");
	properties.setProperty(ConfigKeys.EXPERIMENT_COOL_DOWN_NUM_USERS_PER_INTERVAL, "1");
	properties.setProperty(ConfigKeys.EXPERIMENT_RAMP_UP_INTERVAL_LENGTH, "1");
	properties.setProperty(ConfigKeys.EXPERIMENT_RAMP_UP_NUM_USERS_PER_INTERVAL, "1");
	properties.setProperty(ConfigKeys.WORKLOAD_MAXUSERS, "10");
	FileWriter fWriter = new FileWriter(configFile);
	properties.store(fWriter, null);
	fWriter.close();
}
 
開發者ID:sopeco,項目名稱:DynamicSpotter,代碼行數:21,代碼來源:SpotterTest.java

示例11: testDataPaths

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
@Test
public void testDataPaths() {
	GlobalConfiguration.getInstance().putProperty(ConfigKeys.RESULT_DIR,
			baseDir + System.getProperty("file.separator"));
	DetectionResultManager drManager = new DetectionResultManager(CONTROLLER_NAME);
	drManager.setProblemId(CONTROLLER_NAME);
	drManager.setParentIdentifier(PARENT_DIR);
	Assert.assertEquals(baseDir + DATA_DIR, drManager.getDataPath());
	Assert.assertEquals(baseDir + DATA_DIR, drManager.getDataPath());
	Assert.assertEquals(baseDir + RESOURCES_DIR, drManager.getAdditionalResourcesPath());
	Assert.assertEquals(baseDir + RESOURCES_DIR, drManager.getAdditionalResourcesPath());

	drManager.overwriteDataPath("anotherPath");
	String newPath = "anotherPath" + System.getProperty("file.separator") + CONTROLLER_NAME + "-"
			+ CONTROLLER_NAME.hashCode() + System.getProperty("file.separator") + "csv"
			+ System.getProperty("file.separator");
	Assert.assertEquals(newPath, drManager.getDataPath());
	Assert.assertEquals(baseDir + RESOURCES_DIR, drManager.getAdditionalResourcesPath());

	drManager.useParentDataDir();
	Assert.assertEquals(
			baseDir + System.getProperty("file.separator") + PARENT_DIR + System.getProperty("file.separator")
					+ "csv" + System.getProperty("file.separator"), drManager.getDataPath());
	Assert.assertEquals(baseDir + RESOURCES_DIR, drManager.getAdditionalResourcesPath());
}
 
開發者ID:sopeco,項目名稱:DynamicSpotter,代碼行數:26,代碼來源:DetectionResultManagerTest.java

示例12: testWithoutExperiments

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
@Test
public void testWithoutExperiments() throws InstrumentationException, MeasurementException, WorkloadException,
		IOException {
	String dataDir = tempDir.getAbsolutePath() + System.getProperty("file.separator") + "data"
			+ System.getProperty("file.separator");

	final DummyMeasurement dMeasurement = new DummyMeasurement(null);

	

	GlobalConfiguration.getInstance().putProperty(ConfigKeys.OMIT_EXPERIMENTS, "true");
	GlobalConfiguration.getInstance().putProperty(ConfigKeys.DUMMY_EXPERIMENT_DATA, dataDir);
	Assert.assertEquals("MockDetection", detectionController.getProvider().getName());
	Assert.assertEquals("test.value", detectionController.getProblemDetectionConfiguration().get("test.key"));
	preGenerateData(dataDir, dMeasurement, "MockDetection-" + detectionController.getProblemId().hashCode());
	SpotterResult result = detectionController.analyzeProblem();
	Assert.assertTrue(result.isDetected());

	Assert.assertEquals(0, DummyWorkload.numExperiments);

	GlobalConfiguration.getInstance().putProperty(ConfigKeys.OMIT_EXPERIMENTS, "false");
}
 
開發者ID:sopeco,項目名稱:DynamicSpotter,代碼行數:23,代碼來源:AbstractDetectionControllerTest.java

示例13: startDiagnosis

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
/**
 * Executes diagnostics process.
 * 
 * @param jobDescription
 *            the job description to use
 * @return job id for the started diagnosis task
 */
public long startDiagnosis(JobDescription jobDescription) {
	SpotterServiceResponse<Long> response = webResource.path(ConfigKeys.SPOTTER_REST_BASE)
			.path(ConfigKeys.SPOTTER_REST_START_DIAG).type(MediaType.APPLICATION_JSON)
			.accept(MediaType.APPLICATION_JSON).post(new GenericType<SpotterServiceResponse<Long>>() {
			}, jobDescription);

	switch (response.getStatus()) {
	case INVALID_STATE:
		throw new IllegalStateException("Spotter is already running");
	case OK:
		return response.getPayload();
	case SERVER_ERROR:
		throw new RuntimeException("Server error: " + response.getErrorMessage());
	default:
		throw new IllegalStateException("Illegal response state!");
	}

}
 
開發者ID:sopeco,項目名稱:DynamicSpotter,代碼行數:26,代碼來源:SpotterServiceClient.java

示例14: isRunning

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
/**
 * Returns whether the Spotter Diagnostics is currently running. If the
 * method returns <code>false</code> either the last run has finished
 * successfully or the run had been canceled. For the second case the last
 * exception thrown during that run can be requested via
 * {@link #getLastRunException}.
 * 
 * @return <code>true</code> if Spotter Diagnostics is currently running,
 *         <code>false</code> otherwise
 */
public synchronized boolean isRunning() {
	SpotterServiceResponse<Boolean> response = webResource.path(ConfigKeys.SPOTTER_REST_BASE)
			.path(ConfigKeys.SPOTTER_REST_IS_RUNNING).accept(MediaType.APPLICATION_JSON)
			.get(new GenericType<SpotterServiceResponse<Boolean>>() {
			});
	switch (response.getStatus()) {
	case OK:
		return response.getPayload();
	case SERVER_ERROR:
		throw new RuntimeException("Server error: " + response.getErrorMessage());
	case INVALID_STATE:
	default:
		throw new IllegalStateException("Illegal response state!");
	}
}
 
開發者ID:sopeco,項目名稱:DynamicSpotter,代碼行數:26,代碼來源:SpotterServiceClient.java

示例15: getLastRunException

import org.spotter.shared.configuration.ConfigKeys; //導入依賴的package包/類
/**
 * 
 * @return the exception thrown during the last diagnosis run or
 *         <code>null</code> if none
 */
public synchronized Exception getLastRunException() {
	SpotterServiceResponse<Exception> response = webResource.path(ConfigKeys.SPOTTER_REST_BASE)
			.path(ConfigKeys.SPOTTER_REST_LAST_EXCEPTION).accept(MediaType.APPLICATION_JSON)
			.get(new GenericType<SpotterServiceResponse<Exception>>() {
			});
	switch (response.getStatus()) {
	case OK:
		return response.getPayload();
	case SERVER_ERROR:
		throw new RuntimeException("Server error: " + response.getErrorMessage());
	case INVALID_STATE:
	default:
		throw new IllegalStateException("Illegal response state!");
	}
}
 
開發者ID:sopeco,項目名稱:DynamicSpotter,代碼行數:21,代碼來源:SpotterServiceClient.java


注:本文中的org.spotter.shared.configuration.ConfigKeys類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。