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

Re: [xmlblaster-devel] JBoss support/ClassLoaderFactory



On Tue, 2003-09-09 at 08:42, Marcel Ruff wrote:
> Peter Antman wrote:
> > Hi,s
> > I have done a first round of updates to the j2ee (JBoss) support that I
> > would like to commit. However, to get it to work I had to abstract the
> > way XMlBlaster handles the ClassLoaderFactory. 
> > 
> > Basically I have done this:
> > Made ClassLoaderFactory and intercace:
> > 
> > public interface ClassLoaderFactory {
> >    public void init(Global glob);
> >    public URLClassLoader getPluginClassLoader(PluginInfo pluginInfo)
> > throws XmlBlasterException;
> >    public URLClassLoader getXmlBlasterClassLoader() throws
> > XmlBlasterException;
> > }
> > 
> > Moved the old implementation to StandaloneClassLoaderFactory. Created an
> > aditional factory: ContextClassLoaderFactory, which used returnes the
> > context class loader.
> > 
> > Which factory to use is now configurable with the property
> > classLoaderFactory. Here's the new method in Global:
> > 
> > public ClassLoaderFactory getClassLoaderFactory() {
> >       boolean usemlBlasterClassloader =
> > getProperty().get("usemlBlasterClassloader", true);
> >       if (usemlBlasterClassloader == false) return null;
> > 
> >       synchronized (ClassLoaderFactory.class) {
> >          if (classLoaderFactory == null) {
> >             String clf =
> > getProperty().get("classLoaderFactory",(String)null);
> >             if ( clf != null) {
> >                try {
> >                   Class clfc =
> > Thread.currentThread().getContextClassLoader().loadClass(clf);
> >                   
> >                   
> >                   classLoaderFactory =
> > (ClassLoaderFactory)clfc.newInstance();
> >                   classLoaderFactory.init(this);
> >                   return classLoaderFactory;
> >                   
> >                } catch (Exception e) {
> >                   log.warn(ME,"Could not load custom classLoaderFactory
> > " + clf + " using StandaloneClassLoaderFactory");
> >                } // end of try-catch
> >             } // end of if ()
> >             
> >             classLoaderFactory = new StandaloneClassLoaderFactory(this);
> >          }
> >       }
> >       return classLoaderFactory;
> >    }
> > 
> > Basically I am wondering if this is an ok change to check in, or if you
> > would like it done in a different way?
> > 
> > //Peter
> Peter,
> 
> i think this is a good way to go.
> Could you please update the outdated classloader requirements as well
> (probably merge the 3 reqs to one) and add a note to xmlBlaster/CHANGES?
> 

I only found one. But I could take a look at it.

//Peter
> thanks
> 
> Marcel
> 
> -- 
> http://www.xmlBlaster.org
-- 
------------------------------------------------------------
Peter Antman	Chief Technology Officer, Development
Technology in Media, Box 34105 100 26 Stockholm
WWW: http://www.tim.se	WWW: http://www.backsource.org
Email: pra at tim.se	 
Phone: +46-(0)8-506 381 11 Mobile: +46-(0)704 20 58 11
------------------------------------------------------------