@Override public RecordWriter<DocumentURI, MarkLogicNode> getRecordWriter( TaskAttemptContext context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); TextArrayWritable hosts = getHosts(conf); String host = InternalUtilities.getHost(hosts); return new PropertyWriter(conf, host); }
@Override public void write(DocumentURI uri, MarkLogicNode record) throws IOException, InterruptedException { // initialize recordString String recordString = record == null ? "()" : record.toString(); // execute query Session session = getSession(); try { AdhocQuery request = session.newAdhocQuery(query); request.setNewStringVariable(DOCURI_VARIABLE_NAME, InternalUtilities.unparse(uri.getUri())); request.setNewVariable(NODE_VARIABLE_NAME, ValueType.ELEMENT, recordString); session.submitRequest(request); commitIfNecessary(); } catch (RequestException e) { LOG.error(e); LOG.error(query); throw new IOException(e); } }