All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.commons.discovery.defaults.Defaults Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 7.4.0
Show newest version
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;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy