Package org.apache.solr.core
Class PluginBag<T>
- java.lang.Object
-
- org.apache.solr.core.PluginBag<T>
-
- All Implemented Interfaces:
AutoCloseable
public class PluginBag<T> extends Object implements AutoCloseable
This manages the lifecycle of a set of plugin of the same type .
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPluginBag.JaxrsResourceToHandlerMappingsAllows JAX-RS 'filters' to find the requestHandler (if any) associated particular JAX-RS resource classesclassPluginBag.LazyPluginHolder<T>A class that loads plugins Lazily.static classPluginBag.PluginHolder<T>An indirect reference to a plugin.
-
Constructor Summary
Constructors Constructor Description PluginBag(Class<T> klass, SolrCore core)Constructs a non-threadsafe plugin registryPluginBag(Class<T> klass, SolrCore core, boolean needThreadSafety)Pass needThreadSafety=true if plugins can be added and removed concurrently with lookups.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>checkContains(Collection<String> names)Check if any of the mentioned names are missing.voidclose()Close this registry.static voidcloseQuietly(Object inst)booleancontains(String name)PluginBag.PluginHolder<T>createPlugin(PluginInfo info)Tget(String name)Get a plugin by name.Tget(String name, boolean useDefault)Fetches a plugin by name , or the defaultApiBaggetApiBag()PluginBag.JaxrsResourceToHandlerMappingsgetJaxrsRegistry()org.glassfish.jersey.server.ResourceConfiggetJerseyEndpoints()Map<String,PluginBag.PluginHolder<T>>getRegistry()static voidinitInstance(Object inst, PluginInfo info)booleanisLoaded(String name)To check if a plugin by a specified name is already loadedSet<String>keySet()PluginBag.PluginHolder<T>put(String name, PluginBag.PluginHolder<T> plugin)Tput(String name, T plugin)register a plugin by a nameApiv2lookup(String path, String method, Map<String,String> parts)
-
-
-
Method Detail
-
getJaxrsRegistry
public PluginBag.JaxrsResourceToHandlerMappings getJaxrsRegistry()
-
initInstance
public static void initInstance(Object inst, PluginInfo info)
-
checkContains
public Set<String> checkContains(Collection<String> names)
Check if any of the mentioned names are missing. If yes, return the Set of missing names
-
createPlugin
public PluginBag.PluginHolder<T> createPlugin(PluginInfo info)
-
get
public T get(String name)
Get a plugin by name. If the plugin is not already instantiated, it is done here
-
get
public T get(String name, boolean useDefault)
Fetches a plugin by name , or the default- Parameters:
name- name using which it is registereduseDefault- Return the default , if a plugin by that name does not exist
-
put
public PluginBag.PluginHolder<T> put(String name, PluginBag.PluginHolder<T> plugin)
-
getRegistry
public Map<String,PluginBag.PluginHolder<T>> getRegistry()
-
contains
public boolean contains(String name)
-
isLoaded
public boolean isLoaded(String name)
To check if a plugin by a specified name is already loaded
-
close
public void close()
Close this registry. This will in turn call a close on all the contained plugins- Specified by:
closein interfaceAutoCloseable
-
closeQuietly
public static void closeQuietly(Object inst)
-
getApiBag
public ApiBag getApiBag()
-
getJerseyEndpoints
public org.glassfish.jersey.server.ResourceConfig getJerseyEndpoints()
-
-