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


Java ObjectNode.at方法代碼示例

本文整理匯總了Java中com.fasterxml.jackson.databind.node.ObjectNode.at方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectNode.at方法的具體用法?Java ObjectNode.at怎麽用?Java ObjectNode.at使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.fasterxml.jackson.databind.node.ObjectNode的用法示例。


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

示例1: getLifeEnvironmentVariables

import com.fasterxml.jackson.databind.node.ObjectNode; //導入方法依賴的package包/類
public ObjectNode getLifeEnvironmentVariables () {

		ObjectNode vars = getAttributeAsObject( ServiceAttributes.environmentVariables );

		if ( vars != null ) {
			JsonNode lifeJson = vars.at( "/lifecycle/" + Application.getCurrentLifeCycle() );
			if ( !lifeJson.isMissingNode() && lifeJson.isObject() ) {
				return (ObjectNode) lifeJson;
			}
		}
		return jacksonMapper.createObjectNode();
	}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:13,代碼來源:ServiceBaseParser.java

示例2: getClusterDefinition

import com.fasterxml.jackson.databind.node.ObjectNode; //導入方法依賴的package包/類
@RequestMapping ( value = "/cluster" , produces = MediaType.APPLICATION_JSON_VALUE , method = RequestMethod.GET )
public ObjectNode getClusterDefinition (
											@RequestParam ( "clusterName" ) String clusterName,
											@RequestParam ( value = "lifeToEdit" , required = false ) String lifeToEdit,
											@RequestParam ( value = "releasePackage" , required = false ) String releasePackage ) {

	if ( lifeToEdit == null ) {
		lifeToEdit = Application.getCurrentLifeCycle();
	}

	if ( releasePackage == null ) {
		releasePackage = csapApp.getActiveModelName();
	}

	logger.info( "lifeToEdit: {}, clusterPath: {}, releasePackage: {}",
		lifeToEdit, clusterName, releasePackage );

	// ReleasePackage package = csapApp.getModel( releasePackage );
	ReleasePackage currentPackage = csapApp.getModel( releasePackage );

	csapApp.updateCache( true );

	ObjectNode modelObject = (ObjectNode) currentPackage.getJsonModelDefinition();
	// //ReleasePackage serviceModel = csapApp.getModel( hostName,
	// serviceName ) ;
	// //logger.info( "Found model: {}",
	// serviceModel.getReleasePackageName() );
	ObjectNode clusterNode = (ObjectNode) modelObject.at(
		DefinitionParser.buildLifePtr( lifeToEdit ) + "/" + clusterName );

	return clusterNode;
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:33,代碼來源:DefinitionRequests.java

示例3: settings

import com.fasterxml.jackson.databind.node.ObjectNode; //導入方法依賴的package包/類
@RequestMapping ( value = "/settings" , produces = MediaType.APPLICATION_JSON_VALUE , method = RequestMethod.GET )
public ObjectNode settings (
								@RequestParam ( value = "lifeToEdit" , required = false ) String lifeToEdit ) {

	logger.info( "lifeToEdit: {}", lifeToEdit );

	if ( lifeToEdit == null ) {
		lifeToEdit = Application.getCurrentLifeCycle();
	}

	csapApp.updateCache( true );

	// ReleasePackage serviceModel = csapApp.getModel( hostName, serviceName
	// ) ;
	// logger.info( "Found model: {}", serviceModel.getReleasePackageName()
	// );
	JsonNode rootNode = csapApp.getRootModel().getJsonModelDefinition();
	ObjectNode settingsNode = (ObjectNode) rootNode.at(
		DefinitionParser.buildLifePtr( lifeToEdit ) + "/"
				+ DefinitionParser.PARSER_SETTINGS );

	JsonNode realtime = settingsNode.at( "/metricsCollectionInSeconds/realTimeMeters" );

	if ( !realtime.isMissingNode() && realtime.isArray() ) {
		((ArrayNode) realtime).elements().forEachRemaining( realTimeDef -> {
			MetricCategory performanceCategory = MetricCategory.parse( realTimeDef );
			if ( performanceCategory != MetricCategory.notDefined ) {
				if ( performanceCategory == MetricCategory.java ) {
					String id = realTimeDef.get( "id" ).asText();
					String[] ids = id.split( "\\." );
					String[] attributes = ids[1].split( "_" );
					if ( attributes.length == 3 ) {
						logger.info( "Stripping off port from {}, no longer needed", attributes );
						((ObjectNode) realTimeDef).put( "id", id.substring( 0, id.lastIndexOf( "_" ) ) );
					}
				}
			}

		} );
	}

	return settingsNode;
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:44,代碼來源:DefinitionRequests.java

示例4: updateOrValidateSettings

import com.fasterxml.jackson.databind.node.ObjectNode; //導入方法依賴的package包/類
@RequestMapping ( value = "/settings" , produces = MediaType.APPLICATION_JSON_VALUE , method = RequestMethod.POST )
public ObjectNode updateOrValidateSettings (
												@RequestParam ( "lifeToEdit" ) String lifeToEdit,
												@RequestParam ( "definition" ) String definitionText,
												@RequestParam ( value = "isUpdate" , required = false ) String isUpdate ) {

	if ( lifeToEdit == null ) {
		lifeToEdit = Application.getCurrentLifeCycle();
	}

	logger.info( "lifeToEdit: {} , isUpdate: {}", lifeToEdit, isUpdate );
	logger.debug( "definitionText: \n{}", definitionText );

	ObjectNode updateResultNode = jacksonMapper.createObjectNode();

	try {
		ObjectNode updatedSettingsDefinition = (ObjectNode) jacksonMapper.readTree( definitionText );
		updatedSettingsDefinition.put( "lastModifiedBy", CsapUser.currentUsersID() );

		ObjectNode modelNode = (ObjectNode) csapApp.getRootModel().getJsonModelDefinition();

		ObjectNode testPackageModel = modelNode.deepCopy();

		JsonNode currentLifeNode = testPackageModel.at( DefinitionParser.buildLifePtr( lifeToEdit ) );

		((ObjectNode) currentLifeNode).set( DefinitionParser.PARSER_SETTINGS, updatedSettingsDefinition );

		updateResultNode.put( "lifeToEdit", lifeToEdit );
		logger.debug( "updateNode: \n{}", updatedSettingsDefinition.toString() );

		ObjectNode validationResults = csapApp.checkDefinitionForParsingIssues(
			testPackageModel.toString(),
			csapApp.getRootModel().getReleasePackageName(),
			"settingsUpdate" );

		updateResultNode.set( "validationResults", validationResults );

		boolean validatePassed = ((ArrayNode) validationResults.get( Application.VALIDATION_ERRORS )).size() == 0;

		if ( validatePassed ) {
			validateTrendingAndRealTimeDefinition( lifeToEdit, updatedSettingsDefinition, validationResults );
		}

		if ( isUpdate != null && validatePassed ) {
			updateResultNode.put( "updatedHost", Application.getHOST_NAME() );
			csapApp.getRootModel().setJsonModelDefinition( testPackageModel );
		}

	} catch (Throwable ex) {
		logger.error( "Failed to parse", ex );
		return buildEditingErrorResponse( ex, updateResultNode );
	}

	return updateResultNode;
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:56,代碼來源:DefinitionRequests.java


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