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

Re: [xmlblaster] xmlBlaster client as OSGi bundle (eclipse plugin)



Kai,

is this released under LGPL or some other more relaxed license?
If so i could add it to xmlBlaster,

regards
Marcel

kai wrote:
As there were several questions about how I solved the classloader issue
 attached you will find the specialized classloaderfactory. If you use
this workaround don't forget to set the property "urlClassLoaderFactory".

See also at the topic "[xmlblaster] small fix regarding classloader" in
the news group archive.

------------------------------------------------------------------------

import java.net.URL;
import java.net.URLClassLoader;

import org.xmlBlaster.util.XmlBlasterException;
import org.xmlBlaster.util.classloader.StandaloneClassLoaderFactory;
import org.xmlBlaster.util.plugin.PluginInfo;

/**
* Custom <code>ClassLoaderFactory</code> for xmlBlaster. This implementation
* takes care of ClassCastExceptions in the default
* <code>StandaloneClassLoaderFactory</code>. It assumes that the current
* classloader is an instance of <code>URLClassLoader</code> but it can be an
* <code>EclipseClassLoader</code> or something else. If the default implemenation fails a new
* delegating <code>URLCLassLoader</code> will be returned to the callers. To use this implementation set
* xmlBlaster property <i>urlClassLoaderFactory</i>.
* * at see org.xmlBlaster.util.Global#getClassLoaderFactory()
* at see org.xmlBlaster.util.classloader.StandaloneClassLoaderFactory
* at author Kai Klesatschke <kai.klesatschke at netallied.de>
*/
public class OsgiClassLoaderFactory extends StandaloneClassLoaderFactory
{
/*
* (non-Javadoc)
* * at see org.xmlBlaster.util.classloader.StandaloneClassLoaderFactory#getPluginClassLoader(org.xmlBlaster.util.plugin.PluginInfo)
*/
at Override
public URLClassLoader getPluginClassLoader(PluginInfo pluginInfo) throws XmlBlasterException
{
try
{
return super.getPluginClassLoader(pluginInfo);
} catch (ClassCastException e)
{
return new URLClassLoader(new URL[0], this.getClass().getClassLoader());
}
}


/*
* (non-Javadoc)
* * at see org.xmlBlaster.util.classloader.ClassLoaderFactory#getXmlBlasterClassLoader()
*/
public URLClassLoader getXmlBlasterClassLoader() throws XmlBlasterException
{
try
{
return super.getXmlBlasterClassLoader();
} catch (ClassCastException e)
{
return new URLClassLoader(new URL[0], this.getClass().getClassLoader());
}
}


}