diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java index 4ae7fe81f36..e3446f73705 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java @@ -45,7 +45,6 @@ import java.util.Properties; public abstract class CollectionAdminRequest > extends SolrRequest { protected CollectionAction action = null; - protected String asyncId; private static String PROPERTY_PREFIX = "property."; @@ -64,24 +63,12 @@ public abstract class CollectionAdminRequest > iter = props.entrySet().iterator(); while(iter.hasNext()) { @@ -106,6 +93,28 @@ public abstract class CollectionAdminRequest > extends CollectionAdminRequest { + protected String asyncId = null; + + public final T setAsyncId(String asyncId) { + this.asyncId = asyncId; + return getThis(); + } + + public String getAsyncId() { + return asyncId; + } + + @Override + public SolrParams getParams() { + ModifiableSolrParams params = new ModifiableSolrParams(super.getParams()); + if (asyncId != null) { + params.set(CommonAdminParams.ASYNC, asyncId); + } + return params; + } + } + //--------------------------------------------------------------------------------------- // //--------------------------------------------------------------------------------------- @@ -130,6 +139,28 @@ public abstract class CollectionAdminRequest > extends CollectionSpecificAdminRequest { + protected String asyncId = null; + + public final T setAsyncId(String asyncId) { + this.asyncId = asyncId; + return getThis(); + } + + public String getAsyncId() { + return asyncId; + } + + @Override + public SolrParams getParams() { + ModifiableSolrParams params = new ModifiableSolrParams(super.getParams()); + if (asyncId != null) { + params.set(CommonAdminParams.ASYNC, asyncId); + } + return params; + } + } + protected abstract static class CollectionShardAdminRequest > extends CollectionAdminRequest { protected String shardName = null; protected String collection = null; @@ -147,7 +178,7 @@ public abstract class CollectionAdminRequest > extends CollectionAdminRequest { + + protected abstract static class CollectionShardAsyncAdminRequest> extends CollectionShardAdminRequest { + protected String asyncId = null; + + public final T setAsyncId(String asyncId) { + this.asyncId = asyncId; + return getThis(); + } + + public String getAsyncId() { + return asyncId; + } + + @Override + public SolrParams getParams() { + ModifiableSolrParams params = new ModifiableSolrParams(super.getParams()); + if (asyncId != null) { + params.set(CommonAdminParams.ASYNC, asyncId); + } + return params; + } + } + + protected abstract static class CollectionAdminRoleRequest > extends AsyncCollectionAdminRequest { protected String node; protected String role; - public T setNode(String node) { this.node = node; return getThis(); @@ -204,10 +253,10 @@ public abstract class CollectionAdminRequest { + public static class Create extends CollectionSpecificAsyncAdminRequest { protected String configName = null; protected String createNodeSet = null; protected String routerName; @@ -298,7 +347,7 @@ public abstract class CollectionAdminRequest { + public static class Reload extends CollectionSpecificAsyncAdminRequest { public Reload() { action = CollectionAction.RELOAD; } @@ -316,7 +365,7 @@ public abstract class CollectionAdminRequest { + public static class Delete extends CollectionSpecificAsyncAdminRequest { public Delete() { action = CollectionAction.DELETE; @@ -335,7 +384,7 @@ public abstract class CollectionAdminRequest { + public static class CreateShard extends CollectionShardAsyncAdminRequest { protected String nodeSet; protected Properties properties; @@ -380,10 +429,10 @@ public abstract class CollectionAdminRequest { + public static class SplitShard extends CollectionShardAsyncAdminRequest { protected String ranges; protected String splitKey; - + private Properties properties; public SplitShard() { @@ -397,11 +446,11 @@ public abstract class CollectionAdminRequest { + public static class DeleteShard extends CollectionShardAsyncAdminRequest { public DeleteShard() { action = CollectionAction.DELETESHARD; } @@ -442,7 +491,7 @@ public abstract class CollectionAdminRequest { @@ -531,7 +580,7 @@ public abstract class CollectionAdminRequest { + public static class CreateAlias extends AsyncCollectionAdminRequest { protected String aliasName; protected String aliasedCollections; @@ -547,12 +596,12 @@ public abstract class CollectionAdminRequest { + public static class DeleteAlias extends AsyncCollectionAdminRequest { protected String aliasName; - + public DeleteAlias() { action = CollectionAction.DELETEALIAS; } - + public DeleteAlias setAliasName(String aliasName) { this.aliasName = aliasName; return this; } - + @Override public SolrParams getParams() { ModifiableSolrParams params = new ModifiableSolrParams(super.getParams()); @@ -607,7 +656,7 @@ public abstract class CollectionAdminRequest { + public static class AddReplica extends CollectionShardAsyncAdminRequest { protected String node; protected String routeKey; protected String instanceDir; @@ -695,10 +744,10 @@ public abstract class CollectionAdminRequest { + public static class DeleteReplica extends CollectionShardAsyncAdminRequest { protected String replica; protected Boolean onlyIfDown; - + public DeleteReplica() { action = CollectionAction.DELETEREPLICA; } @@ -711,21 +760,21 @@ public abstract class CollectionAdminRequest { private String propertyName; private String propertyValue; - + public ClusterProp() { this.action = CollectionAction.CLUSTERPROP; } - + public ClusterProp setPropertyName(String propertyName) { this.propertyName = propertyName; return this; @@ -760,17 +809,17 @@ public abstract class CollectionAdminRequest { + public static class Migrate extends AsyncCollectionAdminRequest { private String collection; private String targetCollection; private String splitKey; private Integer forwardTimeout; private Properties properties; - + public Migrate() { action = CollectionAction.MIGRATE; } - + public Migrate setCollectionName(String collection) { this.collection = collection; return this; @@ -800,43 +849,43 @@ public abstract class CollectionAdminRequest { public AddRole() { @@ -882,9 +931,10 @@ public abstract class CollectionAdminRequest { + public static class OverseerStatus extends AsyncCollectionAdminRequest { + public OverseerStatus () { action = CollectionAction.OVERSEERSTATUS; } @@ -897,29 +947,29 @@ public abstract class CollectionAdminRequest { - + protected String shardName = null; protected String collection = null; protected String routeKey = null; - + public ClusterStatus () { action = CollectionAction.CLUSTERSTATUS; } - + public ClusterStatus setCollectionName(String collectionName) { this.collection = collectionName; return this; } - + public String getCollectionName() { return collection; } - + public ClusterStatus setShardName(String shard) { this.shardName = shard; return this; } - + public String getShardName() { return this.shardName; } @@ -965,14 +1015,14 @@ public abstract class CollectionAdminRequest { + public static class AddReplicaProp extends CollectionShardAsyncAdminRequest { private String replica; private String propertyName; private String propertyValue; private Boolean shardUnique; - + public AddReplicaProp() { action = CollectionAction.ADDREPLICAPROP; } @@ -1012,18 +1062,18 @@ public abstract class CollectionAdminRequest { + public static class DeleteReplicaProp extends CollectionShardAsyncAdminRequest { private String replica; private String propertyName; public DeleteReplicaProp() { this.action = CollectionAction.DELETEREPLICAPROP; } - + public String getReplica() { return replica; } @@ -1059,7 +1109,7 @@ public abstract class CollectionAdminRequest { + public static class MigrateClusterState extends CollectionShardAsyncAdminRequest { public MigrateClusterState() { this.action = CollectionAction.MIGRATESTATEFORMAT; @@ -1096,18 +1146,18 @@ public abstract class CollectionAdminRequest { - private String collection; - private String propertyName; - private Boolean onlyActiveNodes; - private Boolean shardUnique; - + public static class BalanceShardUnique extends AsyncCollectionAdminRequest { + protected String collection; + protected String propertyName; + protected Boolean onlyActiveNodes; + protected Boolean shardUnique; + public BalanceShardUnique() { this.action = CollectionAction.BALANCESHARDUNIQUE; } - + public String getPropertyName() { return propertyName; } @@ -1139,11 +1189,11 @@ public abstract class CollectionAdminRequest