commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxim Ulanovskiy <mulanovs...@iponweb.net>
Subject Re: [CONFIGURATION{ Re: Extending commons-configuration XML configuration definition issue
Date Thu, 21 Jan 2010 15:20:54 GMT
Thanks Ralph

The idea is to create a custom Configuration named <remote> which can
load/update configuration files using REST service with some params such as
ETag, revision etc. as those features are not supported by standard API. You
right I've used DefaultConfigurationBuilder to load this file and registered
custom ConfigurationProvider to handle <remote> tag only:

//client
DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
builder.addConfigurationProvider("remote", new
RemoteConfigurationProvider());

//internals
public class RemoteConfigurationProvider extends ConfigurationProvider {
@Override
    public Object createBean(Class beanClass, BeanDeclaration data,
            Object parameter) throws Exception {
            //this code throws exception because a few <conf> tags defined

data.getNestedBeanDeclarations().get("configs").getNestedBeanDeclarations();
            ...
    }
}

2010/1/21 Ralph Goers <ralph.goers@dslextreme.com>

> I'm having trouble figuring out what you are trying to do. Is this the
> configuration file you are feeding to DefaultConfigurationBuilder or
> something else? The syntax below doesn't seem to match what
> DefaultConfigurationBuilder would expect and I'm not sure why you aren't
> just using that since as far as I can tell it supports what you are trying
> to do without you writing any custom code.
>
> Ralph
>
> On Jan 21, 2010, at 12:57 AM, Maxim Ulanovskiy wrote:
>
> > Hello,
> > I need to extend XML configuration definition to have something like:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <configuration>
> >   <additional>
> >       <remote server="http://configserver/config/" refreshDelay="5000">
> >           <configs>
> >               <conf>testCfg1.cfg</conf>
> >               <conf>testCfg2.xml</conf>
> >           </configs>
> >       </remote>
> >   </additional>
> > </configuration>
> >
> > To parse "remote" element I've defined custom ConfigurationProvider, but
> it
> > fails because of there are a few <conf> tags and the framework holds them
> as
> > NestedBeanDeclarations that should be unique. How can I resolve this
> issue?
> >
> > --
> > Best Regards,
> > Maxim
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>


-- 
Best Regards,
Maxim

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message