Commit 0ed41a39 authored by Brian Long's avatar Brian Long
Browse files

fixed ASIE shard model parsing

parent 3cd8c91f
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -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));
	}
	
+5 −5
Original line number Diff line number Diff line
@@ -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() {
	public SolrHost extractNode() {
		int pos = this.spec.indexOf('~');
		return Shard.from(this.spec.substring(0, pos));
		return SolrHost.from(this.spec.substring(0, pos));
	}
	
	public SolrHost extractNode() {
	public Shard extractShard() {
		int pos = this.spec.indexOf('~');
		return SolrHost.from(this.spec.substring(pos+1));
		return Shard.from(this.spec.substring(pos+1));
	}
	
	@Override
+2 −0
Original line number Diff line number Diff line
@@ -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);