[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] PluginClassLoader



Hi Nelson,

The simplest (and xmlBlaster stylish correct) way of loading plugins is via the run level manager.

Then again, if you want to dynamically instantiate objects you could use the plugin loaded by the run level manager to instantiate these objects dynamically. For example the plugin could subscribe on certain messages and either do delegate subscribes or load other objects (other clients) doing that.

Regards
Michele


inEvo wrote:
Hi,

How can i load a plugin during runtime? I'm trying to do something like :

private void loadNativeClient()
{
// This works but clients are hard coded!
//GlobalUtil globalUtil = new GlobalUtil(serverThread.getMain().getGlobal());
//new NativeClient(globalUtil.getClone( glob ));
// Let's use XmlBlaster's Class loading
java.net.URL [] urls=new java.net.URL [1];
try {
urls[0]=new java.net.URL("file://target/classes/");
}catch(MalformedURLException e){
System.err.println("URL mal formado!");
};
try{
PluginClassLoader.newInstance(urls).loadClass("pt.inevo.NativeClient");
}
catch(ClassNotFoundException e)
{
System.err.println("Classe não encontrada!");
}
}


Unfortunately this does nothing :(

Any help?

regards,

Nelson Silva