Java Code Examples for com.datatorrent.netlet.util.DTThrowable#wrapIfChecked()
The following examples show how to use
com.datatorrent.netlet.util.DTThrowable#wrapIfChecked() .
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: FilterTuples.java From streaming-benchmarks with Apache License 2.0 | 5 votes |
@Override public void process(JSONObject jsonObject) { try { if ( jsonObject.getString("event_type").equals("view") ) { output.emit(jsonObject); } } catch (JSONException e) { DTThrowable.wrapIfChecked(e); } }
Example 2
Source File: JsonParser.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
@Override public void setup(OperatorContext context) { try { if (jsonSchema != null) { JsonSchemaFactory factory = JsonSchemaFactory.byDefault(); JsonNode schemaNode = JsonLoader.fromString(jsonSchema); schema = factory.getJsonSchema(schemaNode); } objMapper = new ObjectMapper(); objMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); } catch (ProcessingException | IOException e) { DTThrowable.wrapIfChecked(e); } }
Example 3
Source File: XmlParser.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
@Override public void activate(Context context) { try { JAXBContext ctx = JAXBContext.newInstance(getClazz()); unmarshaller = ctx.createUnmarshaller(); if (schemaXSDFile != null) { unmarshaller.setSchema(schema); } } catch (JAXBException e) { DTThrowable.wrapIfChecked(e); } }
Example 4
Source File: XmlFormatter.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
@Override public void setup(OperatorContext context) { JAXBContext ctx; try { ctx = JAXBContext.newInstance(getClazz()); marshaller = ctx.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, prettyPrint); } catch (JAXBException e) { DTThrowable.wrapIfChecked(e); } }
Example 5
Source File: WindowBoundedService.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
public void endWindow() { try { mutex.acquire(); } catch (InterruptedException ex) { DTThrowable.wrapIfChecked(ex); } }
Example 6
Source File: RedisPOJOInputOperator.java From attic-apex-malhar with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") private Object convertMapToObject(Map<String, String> tuple) { try { Object mappedObject = objectClass.newInstance(); for (int i = 0; i < dataColumns.size(); i++) { final SupportType type = dataColumns.get(i).getType(); final String columnName = dataColumns.get(i).getColumnName(); if (i < setters.size()) { String value = tuple.get(columnName); switch (type) { case STRING: ((Setter<Object, String>)setters.get(i)).set(mappedObject, value); break; case BOOLEAN: ((SetterBoolean)setters.get(i)).set(mappedObject, Boolean.parseBoolean(value)); break; case SHORT: ((SetterShort)setters.get(i)).set(mappedObject, Short.parseShort(value)); break; case INTEGER: ((SetterInt)setters.get(i)).set(mappedObject, Integer.parseInt(value)); break; case LONG: ((SetterLong)setters.get(i)).set(mappedObject, Long.parseLong(value)); break; case FLOAT: ((SetterFloat)setters.get(i)).set(mappedObject, Float.parseFloat(value)); break; case DOUBLE: ((SetterDouble)setters.get(i)).set(mappedObject, Double.parseDouble(value)); break; default: break; } } } return mappedObject; } catch (Exception e) { DTThrowable.wrapIfChecked(e); } return null; }