Thank you Richard. As your said that if I used felixConstants, I actually didn't use standard API, so I think I should find another way to achieve my requirement.
PS: Maybe newFramework() should allow Map<String, Object> in the next release. 2011-09-27 XuHuiSheng 发件人: Richard S. Hall 发送时间: 2011-09-27 22:05:41 收件人: users 抄送: 主题: Re: Felix 4.0.0 didn't allow Object in configMap On 9/27/11 1:38 AM, echo_o wrote: > Hi Guys, > > First, Glad to see felix 4.0.0 released and provide OSGi 4.3 new features. > Thank you for your greate job. > > But I meet a small problem, that the > org.osgi.framework.launch.FrameworkFactory.newFramework() need a Map<String, > String> for its parameter now. It means that I could not pass a Object to > configMap. > > Unfortunately, I need put a SystemBundleActivator to the framework, So > you will see codes like below: > > configMap.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, > Collections.singletonList(activator)); > > which is not allow in OSGi 4.3. I digged the source of Felix.java, there > is also some config parameter using non-string type, E.G. > > m_logger = (Logger) m_configMutableMap.get(FelixConstants.LOG_LOGGER_PROP); > > So I guess, if I still want to use Felix non-standard config parameter, > then I cannot use FrameworkFactory any more. You know, I never noticed this, but yes that is correct. I didn't realize that this was changed to <String, String>...if I did, I would have probably pushed for <String, Object> in R4.3. > > Is there anyway that I could still using FrameworkFactory? Any suggestion > will be appreciated. Thank you very much. Internally, the Felix framework does not completely use generics, so just by chance, you can probably still do it. If you create a raw Map and then cast it to Map<String, String> when you call newFramework(), then it will still work. However, this is a short-term solution. We'll likely need to create a FelixFrameworkFactory that allows you to pass in a Map<String, Object>. Sort of sucks, since it will be non-standard API, but the fact is, if you are passing in Objects as config properties then you are already using non-standard API. -> richard > > > > PS: the download URL of felix source in home page is broken. > > http://labs.renren.com/apache-mirror//felix/org.apache.felix.framework-4.0.0-project.zip > > I think it should be changed to > > http://labs.renren.com/apache-mirror//felix/org.apache.felix.framework-4.0.0-source-release.zip > > > 2011-09-27 > > > > XuHuisheng > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

