Class RestManager


  • public class RestManager
    extends Object
    Supports runtime mapping of REST API endpoints to ManagedResource implementations; endpoints can be registered at either the /schema or /config base paths, depending on which base path is more appropriate for the type of managed resource.
    • Constructor Detail

      • RestManager

        public RestManager()
    • Method Detail

      • getRestManager

        public static RestManager getRestManager​(SolrRequestInfo solrRequestInfo)
        Locates the RestManager using ThreadLocal SolrRequestInfo.
      • addManagedResource

        public ManagedResource addManagedResource​(String resourceId,
                                                  Class<? extends ManagedResource> clazz)
        If not already registered, registers the given ManagedResource subclass at the given resourceId, creates an instance, and attaches it to the appropriate Restlet router. Returns the corresponding instance.
      • createManagedResource

        protected ManagedResource createManagedResource​(org.apache.solr.rest.RestManager.ManagedResourceRegistration reg)
                                                 throws SolrException
        Creates a ManagedResource using registration information.
        Throws:
        SolrException
      • getManagedResource

        public ManagedResource getManagedResource​(String resourceId)
        Returns the ManagedResource subclass instance corresponding to the given resourceId from the registry.
        Throws:
        org.restlet.resource.ResourceException - if no managed resource is registered with the given resourceId.
      • getManagedResourceOrNull

        public ManagedResource getManagedResourceOrNull​(String resourceId)
        Returns the ManagedResource subclass instance corresponding to the given resourceId from the registry, or null if no resource has been registered with the given resourceId.
      • deleteManagedResource

        public void deleteManagedResource​(ManagedResource res)
        Deletes a managed resource if it is not being used by any Solr components.
      • attachManagedResources

        public void attachManagedResources​(String routerPath,
                                           org.restlet.routing.Router router)
        Attach managed resource paths to the given Restlet Router.
        Parameters:
        router - - Restlet Router
      • attachManagedResource

        protected void attachManagedResource​(ManagedResource res,
                                             String path,
                                             org.restlet.routing.Router router)
        Attaches a ManagedResource and optionally a path for child resources to the given Restlet Router.