ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose Alberto Fernandez <j_a_fernan...@yahoo.com>
Subject RE: Saxon Liason for Style task
Date Thu, 07 Mar 2002 17:38:09 GMT
 --- Stephane Bailliez <stephane.bailliez@haht.com>
wrote: > > -----Original Message-----
> > From: Jose Alberto Fernandez
> [mailto:j_a_fernandez@yahoo.com]
> [...]
> > Well, the escence of my proposal is to be able to
> > specify which TraX we want. The mechanics of how
> to
> > obtain it, we probably need to think some more
> about
> > it. I really do not know JAXP that well, so I just
> > tried with something simple. 
> 
> > For the JAXP experts, can I just do new of the
> class
> > directly and just use that instead of what JAXP
> would
> > have returned? If that works, we do not need to
> change
> > the System.property, we just bypass all that.
> 
> So yes IMHO you have no choice than to instantiate
> directly the factory
> (which means you must know it so you break the
> pluggability thing since you
> are not supposed to know it).
> 

Well the whole point is that in this cases I know it.
I have specified which implementation to use. I just
want the TraxLiaison to use it.

> Alternatively you could create your own jaxp factory
> that will act as a
> facade/registry for others factory implementation.
> (ie mapping). 
[...]
> What alternative do you have in your own code rather
> than instantiating
> explicitely the factory of the desired package. You
> cannot rely on jaxp and
> you cannot change the system property on the fly
> (what about MT (ie parallel
> tasks in Ant)) or ClassLoader trick to be in another
> namespace ?
> 

My own code is a bad example :-( 
I just need to get Saxon, so I just do the
System.property change. But this is not generic enough
that is why I did not propose it as a patch.

Now, what I was thinking was to modify the the code to
do something like this:

    /** The trax TransformerFactory */
    private TransformerFactory tfactory = null;

    {
      if(useFactory == null)
        tfactory = TransformerFactory.newInstance();
      else {
        tfactory = (TransformerFactory) 
          ctxLoader.loadClass(useFactory);
      }
      ....
    }

where useFactory contains the value you ussually give
to TraX via the System property.

Would such an arrangement work?

Jose Alberto


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message