@Override public Object clone() { return new DocumentURIWithSourceInfo(this); } }
@Override protected void setValue(long length) { if (value == null || value.getPath() == null) { value = new StreamLocator(file, codec); } } }
public ZipEntryInputStream(ZipInputStream zipIn, String fileName) { this.zipIn = zipIn; this.fileName = fileName; // advance the stream to the first zip entry position. hasNext(); }
@Override protected boolean nextResult(ResultItem result) { String uri = result.getDocumentURI(); String path = result.getNodePath(); if (currentKey != null) { currentKey.set(uri, path); } else { currentKey = new NodePath(uri, path); } if (currentValue != null) { currentValue.set(result); } else { currentValue = new MarkLogicNode(result); } return true; }
@Override public Content createContent(String uri, ContentCreateOptions options, boolean copyCollections, boolean copyMetadata, boolean copyQuality) throws IOException { if (copyCollections || copyMetadata || copyQuality) { setContentOptions(options, copyCollections, copyMetadata, copyQuality); } return ContentFactory.newContent(uri, getContentAsMarkLogicNode().get(), options); } }
@Override public RecordWriter<NodePath, MarkLogicNode> getRecordWriter( TaskAttemptContext context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); TextArrayWritable hosts = getHosts(conf); String host = InternalUtilities.getHost(hosts); return new NodeWriter(conf, host); }
@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); }
public MarkLogicNode getContentAsMarkLogicNode() { if (contentType == ContentType.XML || contentType == ContentType.TEXT) { return new MarkLogicNode(getContentAsText().toString(), contentType); } throw new UnsupportedOperationException( "Cannot convert JSON or binary data to MarkLogicNode."); }
@Override public MarkLogicNode getContentAsMarkLogicNode() { return new MarkLogicNode(doc); }
@Override public Object clone() { return new DocumentURI(uri); }
@Override public RecordReader<DocumentURIWithSourceInfo, VALUE> createRecordReader( InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { return new ForestReader<VALUE>(); }
public MarkLogicRecordWriter(Configuration conf, String hostName) { this.hostName = hostName; this.conf = conf; this.txnSize = getTransactionSize(conf); }
@Override public long getContentSize() { byte[] buf = getContentAsByteArray(); return buf.length; }
protected TextArrayWritable queryHosts(ContentSource cs) throws IOException { return queryHosts(cs, null, null); }
@Override public void readFields(DataInput in) throws IOException { uri.readFields(in); }
@Override public String getContentAsString() throws UnsupportedEncodingException { return toString(); }
@Override public void write(DataOutput out) throws IOException { uri.write(out); }
protected Session getSession(int fId, boolean nextReplica) { TransactionMode mode = TransactionMode.AUTO; if (needCommit) { mode = TransactionMode.UPDATE; } return getSession(fId, nextReplica, mode); }
public MarkLogicNode(ResultItem item) { set(item); }
@Override public String getContentAsString() throws UnsupportedEncodingException { return toString(); }