Hi Andrea, I ran into a similar problem when I try to use Configurer to load 
and parse my own config file (see 
AnnotationHandlerChainBuilder.buildHandlerChainFromClass()). In my case, I 
create a new Configure to do the job, as it only needs to be aware of my 
handler config file and corresponding jaxb property editor file. The problem I 
have is that I can not specify my own classloader that is used to load handler 
cfg file for ConfigurerImpl or JaxbClassPathXmlApplicationContext.

There might be two ways to fix it. One is allow passing URLs into 
ConfigurerImpl (ConfigurerImpl  can only pass in one cfg file, it better can 
deal with an array of cfg files). The parameter type does not have to be URL 
type, but can be a URL format string (eg., file://d:/handerls.xml), 
underlyingly we first try to parse the input string using File format, if it 
fails try URL. 

Another way to fix the problem is to write my 
HandlerChainClassPathXmlApplicationContext in jaxws/handler package, this 
context can pass in a classloader to load specified cfg file. 

Which way do you prefer? I feel the first one can address a more general 
requirement.

Cheers,
Jervis

> -----Original Message-----
> From: Smyth, Andrea 
> Sent: Friday, September 29, 2006 4:05 PM
> To: [email protected]
> Subject: Re: About the user defined configuration file
> 
> 
> Jiang Ning wrote:
> 
> > Hi Andrea,
> > In current cxf user defined configuration file name was passed by 
> > System Properity
> > -Dcxf.config.file=user_defined_configuration
> > This user defined configuration file name will be treat as 
> > ClassPathResource.
> >
> >  public ConfigurerImpl(String cfgFile) {
> >        if (null == cfgFile) {
> >            cfgFile = 
> System.getProperty(USER_CFG_FILE_PROPERTY_NAME);
> >        }
> >        if (null == cfgFile) {
> >            cfgFile = DEFAULT_USER_CFG_FILE;
> >        }
> >        ClassPathResource cpr = new ClassPathResource(cfgFile);
> >        if (cpr.exists()) {
> >            try {
> >                ApplicationContext ac = new 
> > JaxbClassPathXmlApplicationContext(cfgFile);
> >                setApplicationContext(ac);
> >            } catch (BeansException ex) {
> >                LogUtils.log(LOG, Level.WARNING, 
> > "APP_CONTEXT_CREATION_FAILED_MSG", ex, (Object[])null);
> >            }
> >        } else {
> >            LOG.log(Level.INFO, new 
> > Message("USER_CFG_FILE_NOT_FOUND_MSG", LOG, cfgFile).toString());
> >        }
> >    }
> >
> > There is an issue about the user defined configuration. If the 
> > user_defined_configuration file name is same as cxf.xml in 
> the classpath
> > or the user_defined_configuration file not in the classpath. The 
> > user_defined_configuration file would not be loaded rightly.
> 
> Hi Willem,
> 
> What do you mean with  'same as cxf.xml on the classpath'? 
> The default 
> user cfg file (cxf.xml) is not the same as  META-INF/cxf/cxf.xml.
> I don't see a problem as there is no cxf.xml on the classpath 
> unless a 
> user puts one there.
> 
> Andrea.
> 
> >
> > My suggestion is configurer treats the 
> user_defined_configuration file 
> > as URL like Celtix had done before, to make sure the configuration 
> > file right there.
> > Any other thought?
> >
> > Willem.
> >
> 
> 

Reply via email to