Commit 3cd8c91f authored by Brian Long's avatar Brian Long
Browse files

create ApiService and use it

parent 0cb566e1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -141,13 +141,13 @@ public abstract class AbstractUnregisterNodeWebScript<T extends NodeParameterSet
	
	protected StatusResponse getCoreStatus(String nodeHostname, int nodePort, String core) {
		this.logger.debug("Retrieving status for core {} on ASIE node: {}", core, nodeHostname);
		CoreAdminApi api = this.createApi(nodeHostname, nodePort);
		CoreAdminApi api = this.getApiService().createApi(nodeHostname, nodePort, CoreAdminApi.class);
		return api.getStatus(new StatusRequest().withCore(core));
	}
	
	protected void unloadCore(String nodeHostname, int nodePort, String core) {
		this.logger.info("Unloading core {} on ASIE node: {}", core, nodeHostname);
		CoreAdminApi api = this.createApi(nodeHostname, nodePort);
		CoreAdminApi api = this.getApiService().createApi(nodeHostname, nodePort, CoreAdminApi.class);
		api.unload(new UnloadRequest().withCore(core));
	}
    
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public class ReloadNodeShardWebScript extends AbstractAsieNodeWebScript {
			throw new WebScriptException(HttpStatus.NOT_FOUND.value(), "The specified node/shard could not be found or formulated");
			
		this.logger.info("Reloading core {} on ASIE node: {}", coreName, nodeHostname);
		CoreAdminApi api = this.createApi(nodeHostname, nodePort);
		CoreAdminApi api = this.getApiService().createApi(nodeHostname, nodePort, CoreAdminApi.class);
		try {
			api.create(new CreateRequest()
					.withCore(coreName)
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public class ReloadNodeWebScript extends AbstractAsieNodeWebScript {
			String coreInstancePath = core.getValue();
			
			this.logger.info("Reloading core {} on ASIE node: {}", coreName, nodeHostname);
			CoreAdminApi api = this.createApi(nodeHostname, nodePort);
			CoreAdminApi api = this.getApiService().createApi(nodeHostname, nodePort, CoreAdminApi.class);
			try {
				api.create(new CreateRequest()
						.withCore(coreName)
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ public abstract class AbstractAsieNodeShardWebScript extends AbstractAsieShardab
		String nodeEndpoint = this.getRequiredPathParameter(req, "nodeEndpoint");
		int colon = nodeEndpoint.lastIndexOf(':');
		String nodeHostname = colon < 0 ? nodeEndpoint : nodeEndpoint.substring(0, colon);
		int nodePort = colon < 0 ? this.getDefaultSolrPort() : Integer.parseInt(nodeEndpoint.substring(colon+1));
		int nodePort = colon < 0 ? this.getApiService().getDefaultSolrPort() : Integer.parseInt(nodeEndpoint.substring(colon+1));

		ShardSet shardSet = this.getRequiredPathParameter(req, "shardSet", ShardSet.class);
		int shardId = this.getRequiredPathParameter(req, "shardId", Integer.class);
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ public abstract class AbstractAsieNodeWebScript extends AbstractAsieShardableWeb
		int colon = nodeEndpoint.lastIndexOf(':');
		String nodeHostname = colon < 0 ? nodeEndpoint : nodeEndpoint.substring(0, colon);
		nodeHostname = nodeHostname.replace('_', '.');
		int nodePort = colon < 0 ? this.getDefaultSolrPort() : Integer.parseInt(nodeEndpoint.substring(colon+1));
		int nodePort = colon < 0 ? this.getApiService().getDefaultSolrPort() : Integer.parseInt(nodeEndpoint.substring(colon+1));
		
		this.execute(req, res, nodeHostname, nodePort);
    }
Loading