Class CoreAdminAPIBase
- java.lang.Object
-
- org.apache.solr.api.JerseyResource
-
- org.apache.solr.handler.admin.api.CoreAdminAPIBase
-
- Direct Known Subclasses:
CoreSnapshot,CreateCoreBackup,GetNodeCommandStatus,InstallCoreData,MergeIndexes,ReloadCore,RenameCore,RestoreCore,SwapCores,UnloadCore
public abstract class CoreAdminAPIBase extends JerseyResource
A common parent for admin Core Jersey-based APIs.This base class is used when creating Core APIs to allow extra bookkeeping tasks such as async requests handling.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classCoreAdminAPIBase.CoreAdminAPIBaseExceptionHelper RuntimeException to allow passing checked exceptions to the caller of the handle method.
-
Field Summary
Fields Modifier and Type Field Description protected CoreAdminHandler.CoreAdminAsyncTrackercoreAdminAsyncTrackerprotected CoreContainercoreContainerprotected SolrQueryRequestreqprotected SolrQueryResponsersp-
Fields inherited from class org.apache.solr.api.JerseyResource
containerRequestContext
-
-
Constructor Summary
Constructors Constructor Description CoreAdminAPIBase(CoreContainer coreContainer, CoreAdminHandler.CoreAdminAsyncTracker coreAdminAsyncTracker, SolrQueryRequest req, SolrQueryResponse rsp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends SolrJerseyResponse>
ThandlePotentiallyAsynchronousTask(T solrJerseyResponse, String coreName, String taskId, String actionName, Supplier<T> supplier)Wraps the subclasses logic with extra bookkeeping logic.-
Methods inherited from class org.apache.solr.api.JerseyResource
ensureRequiredParameterProvided, ensureRequiredRequestBodyProvided, instantiateJerseyResponse, instantiateJerseyResponse
-
-
-
-
Field Detail
-
coreContainer
protected final CoreContainer coreContainer
-
coreAdminAsyncTracker
protected final CoreAdminHandler.CoreAdminAsyncTracker coreAdminAsyncTracker
-
req
protected final SolrQueryRequest req
-
rsp
protected final SolrQueryResponse rsp
-
-
Constructor Detail
-
CoreAdminAPIBase
public CoreAdminAPIBase(CoreContainer coreContainer, CoreAdminHandler.CoreAdminAsyncTracker coreAdminAsyncTracker, SolrQueryRequest req, SolrQueryResponse rsp)
-
-
Method Detail
-
handlePotentiallyAsynchronousTask
public <T extends SolrJerseyResponse> T handlePotentiallyAsynchronousTask(T solrJerseyResponse, String coreName, String taskId, String actionName, Supplier<T> supplier) throws Exception
Wraps the subclasses logic with extra bookkeeping logic.This method currently exists to enable async handling behavior for V2 Core APIs.
Since the logic for a given API lives inside the Supplier functional interface, checked exceptions can't be thrown directly to the calling method. To throw a checked exception out of the Supplier, wrap the exception using
CoreAdminAPIBase.CoreAdminAPIBaseExceptionand throw it instead. This handle method will retrieve the checked exception fromCoreAdminAPIBase.CoreAdminAPIBaseExceptionand throw it to the original calling method.- Parameters:
solrJerseyResponse- the response that the calling methods expects to return.coreName- the name of the core that work is being done against.taskId- an id provided for registering async work (if null, the task is executed synchronously)actionName- a name for the action being done.supplier- the work that the calling method wants done.- Returns:
- the supplied T solrJerseyResponse
- Throws:
Exception
-
-