Update of /var/cvs/src/org/mmbase/util/logging/commons/impl
In directory james.mmbase.org:/tmp/cvs-serv5522/commons/impl
Modified Files:
MMBaseLoggingFactory.java
Log Message:
codeconventions, generics, javadoc
See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/util/logging/commons/impl
Index: MMBaseLoggingFactory.java
===================================================================
RCS file:
/var/cvs/src/org/mmbase/util/logging/commons/impl/MMBaseLoggingFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- MMBaseLoggingFactory.java 6 Jul 2008 14:34:41 -0000 1.1
+++ MMBaseLoggingFactory.java 4 Sep 2008 21:20:30 -0000 1.2
@@ -9,9 +9,7 @@
*/
package org.mmbase.util.logging.commons.impl;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
+import java.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogConfigurationException;
@@ -30,17 +28,17 @@
*
*
* @author Kees Jongenburger
- * @version $Id: MMBaseLoggingFactory.java,v 1.1 2008/07/06 14:34:41 nklasens
Exp $
+ * @version $Id: MMBaseLoggingFactory.java,v 1.2 2008/09/04 21:20:30 michiel
Exp $
*/
public class MMBaseLoggingFactory extends LogFactory {
/**
* The configuration attributes for this [EMAIL PROTECTED] LogFactory}.
*/
- private Hashtable attributes = new Hashtable();
+ private Map<String, Object> attributes = new Hashtable<String, Object>();
// Previously returned instances, to avoid creation of proxies
- private Hashtable instances = new Hashtable();
+ private Map<Object, Log> instances = new Hashtable<Object, Log>();
// --------------------------------------------------------- Public
Methods
@@ -51,7 +49,7 @@
*
*/
public Object getAttribute(String name) {
- return (attributes.get(name));
+ return attributes.get(name);
}
/**
@@ -60,28 +58,25 @@
* length array is returned.
*/
public String[] getAttributeNames() {
- Vector names = new Vector();
- Enumeration keys = attributes.keys();
- while (keys.hasMoreElements()) {
- names.addElement((String) keys.nextElement());
- }
+ Vector<String> names = new Vector<String>();
+ names.addAll(attributes.keySet());
String results[] = new String[names.size()];
for (int i = 0; i < results.length; i++) {
- results[i] = (String) names.elementAt(i);
+ results[i] = names.elementAt(i);
}
- return (results);
+ return results;
}
/**
* This method first first looks in it's internal cache if there is a
existing Log for the given class. If that is not the case
* the method uses org.mmbase.Version to determine the version of
mmbase used and depending on the version
- * create a [EMAIL PROTECTED] MMBase17Logger} or a [EMAIL PROTECTED]
MMBaseLogger};
+ * create a [EMAIL PROTECTED] MMBaseLogger};
*
* @param clazz the class for witch to create a logger
* @return a mmbase backed Log implementationfor the given class
*/
public Log getInstance(Class clazz) throws LogConfigurationException {
- Log instance = (Log) instances.get(clazz);
+ Log instance = instances.get(clazz);
if (instance != null)
return instance;
@@ -93,14 +88,13 @@
/**
* This method first first looks in it's internal cache if there is a
existing Log with the given name. If that is not the case
* the method uses org.mmbase.Version to determine the version of
mmbase used and depending on the version
- * create a [EMAIL PROTECTED] MMBase17Logger} or a [EMAIL PROTECTED]
MMBaseLogger};
+ * create a [EMAIL PROTECTED] MMBaseLogger};
*
- * @param clazz the class for witch to create a logger
* @return a mmbase backed Log implementation for the given log
*/
public Log getInstance(String category) throws
LogConfigurationException {
- Log instance = (Log) instances.get(category);
+ Log instance = instances.get(category);
if (instance != null)
return instance;
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs