Class ManagedResource

    • Method Detail

      • notifyObserversDuringInit

        protected void notifyObserversDuringInit​(NamedList<?> args,
                                                 Collection<ManagedResourceObserver> observers)
                                          throws SolrException
        Notifies all registered observers that the ManagedResource is initialized. This event only occurs once when the core is loaded. Thus, you need to reload the core to get updates applied to the analysis components that depend on the ManagedResource data.
        Throws:
        SolrException
      • getResourceLoader

        public SolrResourceLoader getResourceLoader()
        Returns the resource loader used by this resource.
      • getResourceId

        public String getResourceId()
        Gets the resource ID for this managed resource.
      • getServerResourceClass

        public Class<? extends BaseSolrResource> getServerResourceClass()
        Gets the ServerResource class to register this endpoint with the Rest API router; in most cases, the default RestManager.ManagedEndpoint class is sufficient but ManagedResource implementations can override this method if a different ServerResource class is needed.
      • reloadFromStorage

        protected void reloadFromStorage()
                                  throws SolrException
        Invoked when this object determines it needs to reload the stored data.
        Throws:
        SolrException
      • onManagedDataLoadedFromStorage

        protected abstract void onManagedDataLoadedFromStorage​(NamedList<?> managedInitArgs,
                                                               Object managedData)
                                                        throws SolrException
        Method called after data has been loaded from storage to give the concrete implementation a chance to post-process the data.
        Throws:
        SolrException
      • storeManagedData

        public void storeManagedData​(Object managedData)
        Persists managed data to the configured storage IO as a JSON object.
      • getInitializedOn

        public String getInitializedOn()
        Returns this resource's initialization timestamp.
      • getUpdatedSinceInitialization

        public String getUpdatedSinceInitialization()
        Returns the timestamp of the most recent update, or null if this resource has not been updated since initialization.
      • hasChangesSinceInitialization

        public boolean hasChangesSinceInitialization()
        Returns true if this resource has been changed since initialization.
      • buildMapToStore

        protected Map<String,​Object> buildMapToStore​(Object managedData)
        Builds the JSON object to be stored, containing initArgs and managed data fields.
      • convertNamedListToMap

        protected Map<String,​Object> convertNamedListToMap​(NamedList<?> args)
        Converts a NamedList<?> into an ordered Map for returning as JSON.
      • doPut

        public void doPut​(BaseSolrResource endpoint,
                          Object json)
        Applies changes to initArgs or managed data.
      • onResourceDeleted

        public void onResourceDeleted()
                               throws IOException
        Called by the RestManager framework after this resource has been deleted to allow this resource to close and clean-up any resources used by this.
        Throws:
        IOException - if an error occurs in the underlying storage when trying to delete
      • applyUpdatesToManagedData

        protected abstract Object applyUpdatesToManagedData​(Object updates)
        Called during PUT/POST processing to apply updates to the managed data passed from the client.
      • doDeleteChild

        public abstract void doDeleteChild​(BaseSolrResource endpoint,
                                           String childId)
        Called to delete a named part (the given childId) of the resource at the given endpoint
      • doGet

        public abstract void doGet​(BaseSolrResource endpoint,
                                   String childId)
        Called to retrieve a named part (the given childId) of the resource at the given endpoint