cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Smyth <andrea.sm...@iona.com>
Subject Re: About the user defined configuration file
Date Fri, 29 Sep 2006 08:51:14 GMT
Jiang Ning wrote:

> Hi Andrea,
>
> Sorry for my confusing cxf.xml definition.
> My means of 'same as cxf.xml on the classpath' is the cfgFile which is 
> passed to ConfigurerImple by System properties is same as the 
> DEFAULT_USER_CFG_FILE.
> Here is the real error, if the cfgFile passed by System properties was 
> an URL string like "file:///local/customer_cxf.xml",  the below code 
> can't work.

No, obviously we do expect a resource name here -  a documentation issue.
We could use multiple properties: cxf.config.file.url, 
cxf.config.file.location, cxf.config.file.resourcename, ...
But as I said, such system properties are fallbacks, and corresponding 
factory methods should be provided, e.g. createBus(URL cfgFileUrl), or 
createBus(Map<String, Object> properties) (we don't have the latter yet 
for the Spring bus).

> And we mostly want to pass the configuration file's absolute path to CXF.

Do we? Personally I think classpath resources are a more flexible- and 
absolute paths should be avoided where possible.

Andrea.

>
> Thanks,
>
> Willem.
>
> Andrea Smyth wrote:
>
>> 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.
>>>
>>
>>
>
>


Mime
View raw message