Hi,
What i intended to do was to provide a simple way to load plugins even while the application was running... i'd like to provide a way, other than fiddling with the xmlblaster plugin's xml conf file, for users to specify which "agents" they'd like to see running natively or remotely.
In other words.. i'd like to provide my very own configuration file, and do the plugin loading using the helper classes in xmlBlaster. This way new native clients could be started as plugins simply by providing the class files.
regards, Nelson
Michele wrote:
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
