org.apache.commons.discovery.defaults.Defaults Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-discovery Show documentation
Show all versions of commons-discovery Show documentation
Its an port to fix bugs in OSGi support. ... The Apache Commons Discovery 0.5 component is about discovering, or finding,
implementations for pluggable interfaces.
package org.apache.commons.discovery.defaults;
import de.mhus.lib.core.lang.MObject;
import de.mhus.lib.core.M;
public class Defaults extends MObject {
private static Defaults instance;
public static synchronized Defaults instance() {
if (instance == null)
instance = new Defaults();
return instance;
}
public Class> findClass(String name) {
try {
Class> ifc = Class.forName(name);
Object obj = M.l(ifc);
if (obj != null) return obj.getClass();
} catch (Throwable e) {
}
// build in defaults
if (name.equals("org.apache.commons.logging.LogFactory")) {
return MyLogFactory.class;
}
if (name.equals("org.apache.axis.components.net.TransportClientProperties")) {
return null;
}
System.out.println("Unknown Class: " + name);
return null;
}
}