fixed ASIE shard model parsing
This commit is contained in:
@@ -19,7 +19,7 @@ public class Shard implements Serializable {
|
||||
private final String spec;
|
||||
|
||||
protected Shard(ShardSet shardSet, int shardId) {
|
||||
this.spec = shardSet.getCore() + "~" + shardId;
|
||||
this.spec = shardSet.getCore() + "-" + shardId;
|
||||
}
|
||||
|
||||
protected Shard(String spec) {
|
||||
@@ -34,16 +34,20 @@ public class Shard implements Serializable {
|
||||
}
|
||||
|
||||
public String getSpec() {
|
||||
return spec;
|
||||
return this.spec;
|
||||
}
|
||||
|
||||
public String getCoreName() {
|
||||
return this.spec;
|
||||
}
|
||||
|
||||
public String extractShardSetCore() {
|
||||
int pos = this.spec.indexOf('~');
|
||||
int pos = this.spec.lastIndexOf('-');
|
||||
return this.spec.substring(0, pos);
|
||||
}
|
||||
|
||||
public int extractShardId() {
|
||||
int pos = this.spec.indexOf('~');
|
||||
int pos = this.spec.lastIndexOf('-');
|
||||
return Integer.parseInt(this.spec.substring(pos+1));
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,7 @@ public class ShardInstance implements Serializable {
|
||||
private final String spec;
|
||||
|
||||
protected ShardInstance(Shard shard, SolrHost node) {
|
||||
this.spec = shard.getSpec() + "~" + node.getSpec();
|
||||
this.spec = node.getSpec() + "~" + shard.getSpec();
|
||||
}
|
||||
|
||||
public org.alfresco.repo.index.shard.ShardInstance toAlfrescoModel(org.alfresco.repo.index.shard.Shard shard) {
|
||||
@@ -33,14 +33,14 @@ public class ShardInstance implements Serializable {
|
||||
return spec;
|
||||
}
|
||||
|
||||
public Shard extractShard() {
|
||||
int pos = this.spec.indexOf('~');
|
||||
return Shard.from(this.spec.substring(0, pos));
|
||||
}
|
||||
|
||||
public SolrHost extractNode() {
|
||||
int pos = this.spec.indexOf('~');
|
||||
return SolrHost.from(this.spec.substring(pos+1));
|
||||
return SolrHost.from(this.spec.substring(0, pos));
|
||||
}
|
||||
|
||||
public Shard extractShard() {
|
||||
int pos = this.spec.indexOf('~');
|
||||
return Shard.from(this.spec.substring(pos+1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -41,6 +41,8 @@ public class SolrHost implements Serializable {
|
||||
this.spec = spec;
|
||||
|
||||
Matcher matcher = PATTERN.matcher(spec);
|
||||
if (!matcher.find())
|
||||
throw new IllegalArgumentException();
|
||||
this.hostname = matcher.group(1);
|
||||
this.port = Integer.parseInt(matcher.group(2));
|
||||
this.path = matcher.group(3);
|
||||
|
Reference in New Issue
Block a user