All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nepxion.discovery.plugin.configcenter.parser.json.JsonConfigParser Maven / Gradle / Ivy

There is a newer version: 6.22.0
Show newest version
package com.nepxion.discovery.plugin.configcenter.parser.json;

/**
 * 

Title: Nepxion Discovery

*

Description: Nepxion Discovery

*

Copyright: Copyright (c) 2017-2050

*

Company: Nepxion

* @author Haojun Ren * @version 1.0 */ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.nepxion.discovery.common.entity.RuleEntity; import com.nepxion.discovery.common.exception.DiscoveryException; import com.nepxion.discovery.common.util.JsonUtil; import com.nepxion.discovery.plugin.framework.config.PluginConfigParser; public class JsonConfigParser implements PluginConfigParser { private static final Logger LOG = LoggerFactory.getLogger(JsonConfigParser.class); @Override public RuleEntity parse(String config) { if (StringUtils.isEmpty(config)) { throw new DiscoveryException("Config is null or empty"); } try { RuleEntity ruleEntity = JsonUtil.fromJson(config, RuleEntity.class); ruleEntity.setContent(config); LOG.info("Rule content=\n{}", config); // Just for RuleEntity print // System.out.println(ruleEntity); return ruleEntity; } catch (Exception e) { throw new DiscoveryException(e.getMessage(), e); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy