Package org.apache.activemq.util
Class LogWriterFinder
- java.lang.Object
-
- org.apache.activemq.util.LogWriterFinder
-
public class LogWriterFinder extends Object
Class used to find a LogWriter implementation, and returning a LogWriter object, taking as argument the name of a log writer. The mapping between the log writer names and the classes implementing LogWriter is specified by the files in the resources/META-INF/services/org/apache/activemq/transport/logwriters directory.- Author:
- David Martin Clavo david(dot)martin(dot)clavo(at)gmail.com
-
-
Constructor Summary
Constructors Constructor Description LogWriterFinder(String path)
Builds a LogWriterFinder that will look for the mappings between LogWriter names and classes in the directory "path".
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Properties
doFindLogWriterProperties(String logWriterName)
Given a log writer name, returns a Properties object with a "class" property whose value is a String with the name of the class to be loaded.LogWriter
newInstance(String logWriterName)
Returns a LogWriter object, given a log writer name (for example "default", or "custom").
-
-
-
Constructor Detail
-
LogWriterFinder
public LogWriterFinder(String path)
Builds a LogWriterFinder that will look for the mappings between LogWriter names and classes in the directory "path".- Parameters:
path
- The directory where the files that map log writer names to LogWriter classes are.
-
-
Method Detail
-
newInstance
public LogWriter newInstance(String logWriterName) throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException
Returns a LogWriter object, given a log writer name (for example "default", or "custom"). Uses a ConcurrentHashMap to cache the Class objects that have already been loaded.- Parameters:
logWriterName
- a log writer name (for example "default", or "custom").- Returns:
- a LogWriter object to be used by the TransportLogger class.
- Throws:
IllegalAccessException
InstantiationException
IOException
ClassNotFoundException
-
doFindLogWriterProperties
protected Properties doFindLogWriterProperties(String logWriterName) throws IOException
Given a log writer name, returns a Properties object with a "class" property whose value is a String with the name of the class to be loaded.- Parameters:
logWriterName
- a log writer name.- Returns:
- a Properties object with a "class" property
- Throws:
IOException
-
-