Added coreName in nodeParameters Added coreName in propertyBag (shardState)

This commit is contained in:
eliaporciani
2019-05-23 11:27:22 +02:00
committed by Tom Page
parent 3ccaca0e3a
commit f78b0ecfd7
3 changed files with 24 additions and 2 deletions

View File

@@ -20,9 +20,11 @@ package org.alfresco.solr.tracker;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -198,6 +200,9 @@ public class MetadataTracker extends AbstractTracker implements Tracker
{
TrackerState state = super.getTrackerState();
HashMap<String, String> propertyBag = new HashMap<>();
propertyBag.put("coreName", coreName);
ShardState shardstate = ShardStateBuilder.shardState()
.withMaster(isMaster)
.withLastUpdated(System.currentTimeMillis())
@@ -217,6 +222,7 @@ public class MetadataTracker extends AbstractTracker implements Tracker
.withTemplate(shardTemplate)
.withHasContent(transformContent)
.withShardMethod(ShardMethodEnum.getShardMethod(shardMethod))
.withPropertyBag(propertyBag)
.endFloc()
.endShard()
.endShardInstance()
@@ -337,6 +343,7 @@ public class MetadataTracker extends AbstractTracker implements Tracker
gnp.setStoreProtocol(storeRef.getProtocol());
gnp.setStoreIdentifier(storeRef.getIdentifier());
gnp.setShardProperty(shardProperty);
gnp.setCoreName(coreName);
List<Node> nodes = client.getNodes(gnp, (int) info.getUpdates());
for (Node node : nodes)
@@ -855,6 +862,7 @@ public class MetadataTracker extends AbstractTracker implements Tracker
gnp.setStoreProtocol(storeRef.getProtocol());
gnp.setStoreIdentifier(storeRef.getIdentifier());
gnp.setShardProperty(shardProperty);
gnp.setCoreName(coreName);
List<Node> nodes = client.getNodes(gnp, Integer.MAX_VALUE);
ArrayList<Node> nodeBatch = new ArrayList<>();

View File

@@ -51,6 +51,7 @@ public class GetNodesParameters
private Set<QName> excludeAspects;
private QName shardProperty;
private String coreName;
public boolean getStoreFilter()
{
@@ -157,5 +158,13 @@ public class GetNodesParameters
this.shardProperty = shardProperty;
}
public String getCoreName() {
return this.coreName;
}
public void setCoreName(String coreName){
this.coreName = coreName;
}
}

View File

@@ -611,6 +611,11 @@ public class SOLRAPIClient
body.put("shardProperty", parameters.getShardProperty().toString());
}
if (parameters.getCoreName() != null){
body.put("coreName", parameters.getCoreName());
}
PostRequest req = new PostRequest(url.toString(), body.toString(), "application/json");
Response response = null;