org.apache.logging.log4j.core.config.plugins.util
Class PluginRegistry<T extends Serializable>

java.lang.Object
  extended by org.apache.logging.log4j.core.config.plugins.util.PluginRegistry<T>
Type Parameters:
T - plugin information object such as PluginType or PluginEntry.

public class PluginRegistry<T extends Serializable>
extends Object

Registry for PluginType maps partitioned by category names.


Constructor Summary
PluginRegistry()
           
 
Method Summary
 void clear()
          Resets the registry to an empty state.
 Set<Map.Entry<String,ConcurrentMap<String,T>>> getCategories()
          Gets an entry set for iterating over the registered plugin categories.
 ConcurrentMap<String,T> getCategory(String category)
          Gets or creates a plugin category if not already available.
 int getCategoryCount()
          Returns the number of plugin categories currently available.
 boolean hasCategory(String category)
          Indicates whether or not the given category name is registered and has plugins in that category.
 boolean isEmpty()
          Indicates whether or not any plugin categories have been registered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginRegistry

public PluginRegistry()
Method Detail

getCategory

public ConcurrentMap<String,T> getCategory(String category)
Gets or creates a plugin category if not already available. Category names are case-insensitive. The ConcurrentMap that is returned should also be treated as a case-insensitive plugin map where names should be converted to lowercase before retrieval or storage.

Parameters:
category - the plugin category to look up or create.
Returns:
the plugin map for the given category name.
Throws:
IllegalArgumentException - if the argument is null

getCategoryCount

public int getCategoryCount()
Returns the number of plugin categories currently available. This is primarily useful for serialization.

Returns:
the number of plugin categories.

isEmpty

public boolean isEmpty()
Indicates whether or not any plugin categories have been registered. Note that this does not necessarily indicate if any plugins are registered as categories may be empty.

Returns:
true if there any categories registered.

clear

public void clear()
Resets the registry to an empty state.


hasCategory

public boolean hasCategory(String category)
Indicates whether or not the given category name is registered and has plugins in that category.

Parameters:
category - the plugin category name to check.
Returns:
true if the category exists and has plugins registered.
Throws:
IllegalArgumentException - if the argument is null

getCategories

public Set<Map.Entry<String,ConcurrentMap<String,T>>> getCategories()
Gets an entry set for iterating over the registered plugin categories.

Returns:
an entry set of the registered plugin categories.


Copyright © 1999-2014 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.