From 9e11b2c21deeb43ecab8857667e1ad6ae0c08a83 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Thu, 14 Aug 2008 18:44:56 +0000 Subject: [PATCH] SOLR-695 -- renaming MultiCore* to CoreAdmin* git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@685989 13f79535-47bb-0310-9956-ffa450edef68 --- .../solrj/embedded/EmbeddedSolrServer.java | 4 +- ...CoreRequest.java => CoreAdminRequest.java} | 58 +++++++++---------- ...reResponse.java => CoreAdminResponse.java} | 2 +- .../solrj/MultiCoreExampleTestBase.java | 12 ++-- .../solrj/embedded/MultiCoreEmbeddedTest.java | 8 +-- example/multicore/solr.xml | 6 +- ...tiCoreParams.java => CoreAdminParams.java} | 10 ++-- .../org/apache/solr/core/CoreContainer.java | 10 ++-- .../solr/handler/admin/CoreAdminHandler.java | 26 ++++----- .../solr/servlet/SolrDispatchFilter.java | 2 +- 10 files changed, 69 insertions(+), 69 deletions(-) rename client/java/solrj/src/org/apache/solr/client/solrj/request/{MultiCoreRequest.java => CoreAdminRequest.java} (72%) rename client/java/solrj/src/org/apache/solr/client/solrj/response/{MultiCoreResponse.java => CoreAdminResponse.java} (96%) rename src/java/org/apache/solr/common/params/{MultiCoreParams.java => CoreAdminParams.java} (88%) diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java b/client/java/solrj/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java index e62b629269f..1d3320475ff 100644 --- a/client/java/solrj/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java +++ b/client/java/solrj/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java @@ -55,7 +55,7 @@ import org.apache.solr.servlet.SolrRequestParsers; public class EmbeddedSolrServer extends SolrServer { - protected final CoreContainer multicore; // either multicore + protected final CoreContainer multicore; // either cores protected final SolrCore core; // or single core protected final String coreName; // use CoreContainer registry @@ -97,7 +97,7 @@ public class EmbeddedSolrServer extends SolrServer path = "/select"; } - // Check for multicore action + // Check for cores action SolrCore core = this.core; if( core == null ) core = multicore.getCore( coreName ); diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/request/MultiCoreRequest.java b/client/java/solrj/src/org/apache/solr/client/solrj/request/CoreAdminRequest.java similarity index 72% rename from client/java/solrj/src/org/apache/solr/client/solrj/request/MultiCoreRequest.java rename to client/java/solrj/src/org/apache/solr/client/solrj/request/CoreAdminRequest.java index 5ad97aa55a3..e2a92bc7bc8 100644 --- a/client/java/solrj/src/org/apache/solr/client/solrj/request/MultiCoreRequest.java +++ b/client/java/solrj/src/org/apache/solr/client/solrj/request/CoreAdminRequest.java @@ -23,31 +23,31 @@ import java.util.Collection; import org.apache.solr.client.solrj.SolrRequest; import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServerException; -import org.apache.solr.client.solrj.response.MultiCoreResponse; +import org.apache.solr.client.solrj.response.CoreAdminResponse; import org.apache.solr.common.params.ModifiableSolrParams; -import org.apache.solr.common.params.MultiCoreParams; +import org.apache.solr.common.params.CoreAdminParams; import org.apache.solr.common.params.SolrParams; -import org.apache.solr.common.params.MultiCoreParams.MultiCoreAction; +import org.apache.solr.common.params.CoreAdminParams.CoreAdminAction; import org.apache.solr.common.util.ContentStream; /** * - * @version $Id: MultiCoreRequest.java 606335 2007-12-21 22:23:39Z ryan $ + * @version $Id: CoreAdminRequest.java 606335 2007-12-21 22:23:39Z ryan $ * @since solr 1.3 */ -public class MultiCoreRequest extends SolrRequest +public class CoreAdminRequest extends SolrRequest { protected String core = null; - protected MultiCoreParams.MultiCoreAction action = null; + protected CoreAdminParams.CoreAdminAction action = null; //a create core request - public static class Create extends MultiCoreRequest { + public static class Create extends CoreAdminRequest { protected String instanceDir; protected String configName = null; protected String schemaName = null; public Create() { - action = MultiCoreAction.CREATE; + action = CoreAdminAction.CREATE; } public void setInstanceDir(String instanceDir) { this.instanceDir = instanceDir; } @@ -64,25 +64,25 @@ public class MultiCoreRequest extends SolrRequest throw new RuntimeException( "no action specified!" ); } ModifiableSolrParams params = new ModifiableSolrParams(); - params.set( MultiCoreParams.ACTION, action.toString() ); - params.set( MultiCoreParams.CORE, core ); - params.set( MultiCoreParams.INSTANCE_DIR, instanceDir); + params.set( CoreAdminParams.ACTION, action.toString() ); + params.set( CoreAdminParams.CORE, core ); + params.set( CoreAdminParams.INSTANCE_DIR, instanceDir); if (configName != null) { - params.set( MultiCoreParams.CONFIG, configName); + params.set( CoreAdminParams.CONFIG, configName); } if (schemaName != null) { - params.set( MultiCoreParams.SCHEMA, schemaName); + params.set( CoreAdminParams.SCHEMA, schemaName); } return params; } } - public MultiCoreRequest() + public CoreAdminRequest() { - super( METHOD.GET, "/admin/multicore" ); + super( METHOD.GET, "/admin/cores" ); } - public MultiCoreRequest( String path ) + public CoreAdminRequest( String path ) { super( METHOD.GET, path ); } @@ -96,7 +96,7 @@ public class MultiCoreRequest extends SolrRequest // //--------------------------------------------------------------------------------------- - public void setAction( MultiCoreAction action ) + public void setAction( CoreAdminAction action ) { this.action = action; } @@ -112,8 +112,8 @@ public class MultiCoreRequest extends SolrRequest throw new RuntimeException( "no action specified!" ); } ModifiableSolrParams params = new ModifiableSolrParams(); - params.set( MultiCoreParams.ACTION, action.toString() ); - params.set( MultiCoreParams.CORE, core ); + params.set( CoreAdminParams.ACTION, action.toString() ); + params.set( CoreAdminParams.CORE, core ); return params; } @@ -127,10 +127,10 @@ public class MultiCoreRequest extends SolrRequest } @Override - public MultiCoreResponse process(SolrServer server) throws SolrServerException, IOException + public CoreAdminResponse process(SolrServer server) throws SolrServerException, IOException { long startTime = System.currentTimeMillis(); - MultiCoreResponse res = new MultiCoreResponse(); + CoreAdminResponse res = new CoreAdminResponse(); res.setResponse( server.request( this ) ); res.setElapsedTime( System.currentTimeMillis()-startTime ); return res; @@ -140,25 +140,25 @@ public class MultiCoreRequest extends SolrRequest // //--------------------------------------------------------------------------------------- - public static MultiCoreResponse reloadCore( String name, SolrServer server ) throws SolrServerException, IOException + public static CoreAdminResponse reloadCore( String name, SolrServer server ) throws SolrServerException, IOException { - MultiCoreRequest req = new MultiCoreRequest(); + CoreAdminRequest req = new CoreAdminRequest(); req.setCoreParam( name ); - req.setAction( MultiCoreAction.RELOAD ); + req.setAction( CoreAdminAction.RELOAD ); return req.process( server ); } - public static MultiCoreResponse getStatus( String name, SolrServer server ) throws SolrServerException, IOException + public static CoreAdminResponse getStatus( String name, SolrServer server ) throws SolrServerException, IOException { - MultiCoreRequest req = new MultiCoreRequest(); + CoreAdminRequest req = new CoreAdminRequest(); req.setCoreParam( name ); - req.setAction( MultiCoreAction.STATUS ); + req.setAction( CoreAdminAction.STATUS ); return req.process( server ); } - public static MultiCoreResponse createCore( String name, String instanceDir, SolrServer server ) throws SolrServerException, IOException + public static CoreAdminResponse createCore( String name, String instanceDir, SolrServer server ) throws SolrServerException, IOException { - MultiCoreRequest.Create req = new MultiCoreRequest.Create(); + CoreAdminRequest.Create req = new CoreAdminRequest.Create(); req.setCoreParam( name ); req.setInstanceDir(instanceDir); return req.process( server ); diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/response/MultiCoreResponse.java b/client/java/solrj/src/org/apache/solr/client/solrj/response/CoreAdminResponse.java similarity index 96% rename from client/java/solrj/src/org/apache/solr/client/solrj/response/MultiCoreResponse.java rename to client/java/solrj/src/org/apache/solr/client/solrj/response/CoreAdminResponse.java index 87d811a9320..7034402c43d 100644 --- a/client/java/solrj/src/org/apache/solr/client/solrj/response/MultiCoreResponse.java +++ b/client/java/solrj/src/org/apache/solr/client/solrj/response/CoreAdminResponse.java @@ -25,7 +25,7 @@ import org.apache.solr.common.util.NamedList; * @version $Id$ * @since solr 1.3 */ -public class MultiCoreResponse extends SolrResponseBase +public class CoreAdminResponse extends SolrResponseBase { @SuppressWarnings("unchecked") public NamedList> getCoreStatus() diff --git a/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java b/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java index 85005ac47cd..a852cfcbb37 100644 --- a/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java +++ b/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java @@ -19,11 +19,11 @@ package org.apache.solr.client.solrj; import java.io.File; -import org.apache.solr.client.solrj.request.MultiCoreRequest; +import org.apache.solr.client.solrj.request.CoreAdminRequest; import org.apache.solr.client.solrj.request.QueryRequest; import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.client.solrj.request.UpdateRequest.ACTION; -import org.apache.solr.client.solrj.response.MultiCoreResponse; +import org.apache.solr.client.solrj.response.CoreAdminResponse; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.core.CoreContainer; @@ -34,7 +34,7 @@ import org.apache.solr.core.CoreContainer; */ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase { - protected static final CoreContainer multicore = new CoreContainer(); + protected static final CoreContainer cores = new CoreContainer(); @Override public String getSolrHome() { return "../../../example/multicore/"; } @@ -118,11 +118,11 @@ public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase // Now test reloading it should have a newer open time String name = "core0"; SolrServer coreadmin = getSolrAdmin(); - MultiCoreResponse mcr = MultiCoreRequest.getStatus( name, coreadmin ); + CoreAdminResponse mcr = CoreAdminRequest.getStatus( name, coreadmin ); long before = mcr.getStartTime( name ).getTime(); - MultiCoreRequest.reloadCore( name, coreadmin ); + CoreAdminRequest.reloadCore( name, coreadmin ); - mcr = MultiCoreRequest.getStatus( name, coreadmin ); + mcr = CoreAdminRequest.getStatus( name, coreadmin ); long after = mcr.getStartTime( name ).getTime(); assertTrue( "should have more recent time: "+after+","+before, after > before ); } diff --git a/client/java/solrj/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java b/client/java/solrj/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java index 57316bc55df..447a40db88a 100644 --- a/client/java/solrj/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java +++ b/client/java/solrj/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java @@ -36,24 +36,24 @@ public class MultiCoreEmbeddedTest extends MultiCoreExampleTestBase { File home = new File( getSolrHome() ); File f = new File( home, "solr.xml" ); - multicore.load( getSolrHome(), f ); + cores.load( getSolrHome(), f ); } @Override protected SolrServer getSolrCore0() { - return new EmbeddedSolrServer( multicore, "core0" ); + return new EmbeddedSolrServer( cores, "core0" ); } @Override protected SolrServer getSolrCore1() { - return new EmbeddedSolrServer( multicore, "core1" ); + return new EmbeddedSolrServer( cores, "core1" ); } @Override protected SolrServer getSolrAdmin() { - return new EmbeddedSolrServer( multicore, "core0" ); + return new EmbeddedSolrServer( cores, "core0" ); } } diff --git a/example/multicore/solr.xml b/example/multicore/solr.xml index fed101ebcb4..921d929180b 100644 --- a/example/multicore/solr.xml +++ b/example/multicore/solr.xml @@ -25,10 +25,10 @@ - + diff --git a/src/java/org/apache/solr/common/params/MultiCoreParams.java b/src/java/org/apache/solr/common/params/CoreAdminParams.java similarity index 88% rename from src/java/org/apache/solr/common/params/MultiCoreParams.java rename to src/java/org/apache/solr/common/params/CoreAdminParams.java index 0909d87b5e4..9ce3b27ccc9 100644 --- a/src/java/org/apache/solr/common/params/MultiCoreParams.java +++ b/src/java/org/apache/solr/common/params/CoreAdminParams.java @@ -21,12 +21,12 @@ package org.apache.solr.common.params; /** * @since solr 1.3 */ -public interface MultiCoreParams +public interface CoreAdminParams { /** What Core are we talking about **/ public final static String CORE = "core"; - /** Persistent -- should it save the multicore state? **/ + /** Persistent -- should it save the cores state? **/ public final static String PERSISTENT = "persistent"; /** The name of the the core to swap names with **/ @@ -47,7 +47,7 @@ public interface MultiCoreParams /** Specifies a core instance dir. */ public final static String INSTANCE_DIR = "instanceDir"; - public enum MultiCoreAction { + public enum CoreAdminAction { STATUS, LOAD, UNLOAD, @@ -57,11 +57,11 @@ public interface MultiCoreParams PERSIST, SWAP; - public static MultiCoreAction get( String p ) + public static CoreAdminAction get( String p ) { if( p != null ) { try { - return MultiCoreAction.valueOf( p.toUpperCase() ); + return CoreAdminAction.valueOf( p.toUpperCase() ); } catch( Exception ex ) {} } diff --git a/src/java/org/apache/solr/core/CoreContainer.java b/src/java/org/apache/solr/core/CoreContainer.java index 2eb334c60de..a27bd1af6b5 100644 --- a/src/java/org/apache/solr/core/CoreContainer.java +++ b/src/java/org/apache/solr/core/CoreContainer.java @@ -290,7 +290,7 @@ public class CoreContainer * @throws org.xml.sax.SAXException */ public SolrCore create(CoreDescriptor dcore) throws ParserConfigurationException, IOException, SAXException { - // Make the instanceDir relative to the multicore instanceDir if not absolute + // Make the instanceDir relative to the cores instanceDir if not absolute File idir = new File(dcore.getInstanceDir()); if (!idir.isAbsolute()) { idir = new File(loader.getInstanceDir(), dcore.getInstanceDir()); @@ -522,12 +522,12 @@ public class CoreContainer return configFile; } -/** Persists the multicore config file in multicore.xml. */ +/** Persists the cores config file in cores.xml. */ public void persist() { persistFile(null); } - /** Persists the multicore config file in a user provided file. */ + /** Persists the cores config file in a user provided file. */ public void persistFile(File file) { File tmpFile = null; try { @@ -565,7 +565,7 @@ public class CoreContainer } } - /** Write the multicore configuration through a writer.*/ + /** Write the cores configuration through a writer.*/ void persist(Writer writer) throws IOException { writer.write(""); writer.write("\n"); } - /** Writes the multicore configuration node for a given core. */ + /** Writes the cores configuration node for a given core. */ void persist(Writer writer, CoreDescriptor dcore) throws IOException { writer.write("