com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature Java Examples
The following examples show how to use
com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JsonYamlDictionaryStructureLoader.java From sailfish-core with Apache License 2.0 | 5 votes |
public JsonYamlDictionaryStructureLoader(boolean aggregateAttributes) { super(aggregateAttributes); objectMapper = new ObjectMapper( new YAMLFactory() .disable(Feature.USE_NATIVE_OBJECT_ID) .disable(Feature.USE_NATIVE_TYPE_ID) ) .enable(JsonParser.Feature.STRICT_DUPLICATE_DETECTION) .enableDefaultTyping(); //For embedded messages SimpleModule module = new SimpleModule(); module.addDeserializer(JsonField.class, new FieldMessageDeserializer()); objectMapper.registerModule(module); }
Example #2
Source File: Braindump.java From pegasus with Apache License 2.0 | 5 votes |
/** * Writes out the braindump.txt file for a workflow in the submit directory. The braindump.txt * file is used for passing to the tailstatd daemon that monitors the state of execution of the * workflow. * * @param entries the Map containing the entries going into the braindump file. * @return the absolute path to the braindump file.txt written in the directory. * @throws IOException in case of error while writing out file. */ protected File writeOutBraindumpFile(Map<String, String> entries) throws IOException { File f = new File(mSubmitFileDir, BRAINDUMP_FILE); YAMLMapper mapper = new YAMLMapper(); mapper.configure(Feature.WRITE_DOC_START_MARKER, false); // SPLIT_LINES feature needs to be disabled until Perl code is deprecated. mapper.configure(Feature.SPLIT_LINES, false); SequenceWriter writer = mapper.writerWithDefaultPrettyPrinter().writeValues(f); writer.write(entries); return f; }
Example #3
Source File: YamlObjectMapper.java From kogito-runtimes with Apache License 2.0 | 4 votes |
public YamlObjectMapper(WorkflowPropertySource context) { super((new YAMLFactory()).enable(Feature.MINIMIZE_QUOTES), context); }
Example #4
Source File: ConnectWatsonIoTQRadar.java From qradar-monitor-device-events with Apache License 2.0 | 4 votes |
/** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { response.setContentType("application/json"); setAccessControlHeaders(response); StringBuilder sb = new StringBuilder(); String s; while ((s = request.getReader().readLine()) != null) { sb.append(s); } Logger.getLogger(getServletName()).log(Level.INFO,"Connecting Watson IoT to QRadar with - " + sb.toString()); JSONObject req = new JSONObject(sb.toString()); //{"deviceId":"","deviceType":""} String deviceId = req.getString("deviceId"); String deviceType = req.getString("deviceType"); ObjectMapper mapper = new ObjectMapper(new YAMLFactory().disable(Feature.WRITE_DOC_START_MARKER)); mapper.findAndRegisterModules(); String fileUrl = URLDecoder.decode(getClass().getResource("/appconfig.yaml").getFile(), StandardCharsets.UTF_8.toString()); Config config = mapper.readValue(new File(fileUrl), Config.class); config.getAuth().setKey(IoTConfig.apikey); config.getAuth().setToken(IoTConfig.token); mapper.writeValue(new File(fileUrl), config); ApplicationClient client = new ApplicationClient(fileUrl); client.connect(); AppEventCallbackJson evtCallback = new AppEventCallbackJson(); AppStatusCallback statusCallback = new AppStatusCallback(); client.registerCodec(new JsonCodec()); client.registerEventCallback(evtCallback); client.setStatusCallback(statusCallback); client.subscribeToDeviceEvents(deviceType, deviceId, "security", "json", 1); client.subscribeToDeviceStatus(deviceType, deviceId); Logger.getLogger(getServletName()).log(Level.INFO,"Subscribing to device events! " + sb.toString()); JSONObject res = new JSONObject(); res.put("response", "Successfully connected Watson IoT to QRadar!" + sb.toString()); response.getWriter().append(res.toString()); } catch (Exception e) { e.printStackTrace(); } }
Example #5
Source File: YamlUnitTest.java From tutorials with MIT License | 4 votes |
@Before public void setup() { mapper = new ObjectMapper(new YAMLFactory().disable(Feature.WRITE_DOC_START_MARKER)); mapper.findAndRegisterModules(); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); }