Package org.apache.activemq.util
Class LogWriterFinder
java.lang.Object
org.apache.activemq.util.LogWriterFinder
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
ConstructorsConstructorDescriptionLogWriterFinder(String path) Builds a LogWriterFinder that will look for the mappings between LogWriter names and classes in the directory "path". -
Method Summary
Modifier and TypeMethodDescriptionprotected PropertiesdoFindLogWriterProperties(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.org.apache.activemq.transport.LogWriternewInstance(String logWriterName) Returns a LogWriter object, given a log writer name (for example "default", or "custom").
-
Constructor Details
-
LogWriterFinder
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 Details
-
newInstance
public org.apache.activemq.transport.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:
IllegalAccessExceptionInstantiationExceptionIOExceptionClassNotFoundException
-
doFindLogWriterProperties
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
-