javadoc
diff --git a/solr/solrj/src/java/org/apache/solr/cluster/api/Resource.java b/solr/solrj/src/java/org/apache/solr/cluster/api/Resource.java
index ef2a987..470590e 100644
--- a/solr/solrj/src/java/org/apache/solr/cluster/api/Resource.java
+++ b/solr/solrj/src/java/org/apache/solr/cluster/api/Resource.java
@@ -24,6 +24,10 @@
/**A binary resource. The impl is agnostic of the content type */
public interface Resource {
+ /**
+ * This is a full path. e.g schema.xml , solrconfig.xml , lang/stopwords.txt etc
+ */
+ String name();
/** read a file/resource.
* The caller should consume the stream completely and should not hold a reference to this stream.
* This method closes the stream soon after the method returns
diff --git a/solr/solrj/src/java/org/apache/solr/common/SimpleZkMap.java b/solr/solrj/src/java/org/apache/solr/common/SimpleZkMap.java
index 9124870..644125f 100644
--- a/solr/solrj/src/java/org/apache/solr/common/SimpleZkMap.java
+++ b/solr/solrj/src/java/org/apache/solr/common/SimpleZkMap.java
@@ -79,20 +79,28 @@
}
private Resource readZkNode(String path) {
- return consumer -> {
- try {
- byte[] data = zkStateReader.getZkClient().getData(basePath+"/"+ path, null, null, true);
- if (data != null && data.length > 0) {
- consumer.read(new ByteArrayInputStream(data));
- } else {
- consumer.read(new ByteArrayInputStream(EMPTY_BYTES));
- }
- } catch (KeeperException | InterruptedException e) {
- throwZkExp(e);
- } catch (IOException e) {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Can;t read stream" , e);
+ return new Resource() {
+ @Override
+ public String name() {
+ return path;
}
+ @Override
+ public void get(Consumer consumer) throws SolrException {
+ try {
+ byte[] data = zkStateReader.getZkClient().getData(basePath+"/"+ path, null, null, true);
+ if (data != null && data.length > 0) {
+ consumer.read(new ByteArrayInputStream(data));
+ } else {
+ consumer.read(new ByteArrayInputStream(EMPTY_BYTES));
+ }
+ } catch (KeeperException | InterruptedException e) {
+ throwZkExp(e);
+ } catch (IOException e) {
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Can;t read stream" , e);
+ }
+
+ }
};
}