RE: org.osgi.framework.bootdelegation and org.osgi.framework.system.packages.extra
Hi Richard, You're the master ;-) Sorry, but I totally miss that from documentation. My example now works perfectly with : org.osgi.framework.bundle.parent = framework and org.osgi.framework.bootdelegation = com.foo Thanks a lot WBR // David -Original Message- From: Richard S. Hall [mailto:he...@ungoverned.org] Sent: mercredi 2 mai 2012 16:30 To: users@felix.apache.org Subject: Re: org.osgi.framework.bootdelegation and org.osgi.framework.system.packages.extra For the boot delegation property, org.foo.* does not match org.foo, only sub-packages like org.foo.bar. Also, you may have to set the org.osgi.framework.bundle.parent (name?) property to be something like app or framework or something...check the spec for correct names/values. - richard On 5/2/12 10:18 , Gay David (Annecy) wrote: Hi all, I'm trying to understand and use Felix osgi properties o.o.f.bootdelegation and o.o.f.s.packages.extra My main goal is to be able to integrate some legacy, non osgi code into Felix. I've read ton of articles and pointer regarding these properties. But I still have one understanding problem. Here is my case : * The class I want to use is located in a jar named foo.jar. Inside this jar, there is a class com.foo.Foo * This jar is added in the JVM classpath that start Felix * I made a bundle use-foo.jar that do somewhere this code : Class c = Class.forName( com.foo.Foo ); First try with packages.extra : * use-foo.jar has the manifest info : Import-Package = com.foo * I use org.osgi.framework.system.packages.extra=com.foo It works ok, cool ! Now, the problem is by using bootdelegation, I understand that it could be used without having to specify Import-Package directive, so second try : * Use-foo.jar has not the Import-Package = com.foo (even if set, it doesn't works but not the same error) * I use org.osgi.framework.bootdelegation=sun.*,com.sun.*,com.foo.* It doesn't work, oups ! Felix debug is : DEBUG: WIRE: [1.0] osgi.wiring.package; (osgi.wiring.package=org.osgi.framework) - [0] java.lang.ClassNotFoundException: *** Package 'com.foo' is not imported by bundle com.use-foo [1], nor is there any bundle that exports package 'com.foo'. However, the class 'com.foo.Foo' is available from the system class loader. There are two fixes: 1) Add package 'com.foo' to the 'org.osgi.framework.system.packages.extra' property and modify bundle com.use-foo [1] to import this package; this causes the system bundle to export class path packages. 2) Add package 'com.foo' to the 'org.osgi.framework.bootdelegation' property; a library or VM bug can cause classes to be loaded by the wrong class loader. The first approach is preferable for preserving modularity. *** So, AFAIU, this second try is the fix 2, but it doesn't works. I'm sure I miss or misunderstand something. Also, I use Felix 4.0.2 and JVM 1.6.0_26 PS : I know that the second solution is not the best approach, but in reality my problem is much more complex : it deals with JVM security provider and ton of legacy code and I would like to have a first working integration and clean it later. And last but not least : I like to understand what I don't understand ;-) Thanks for any helps. WBR // David G. - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org
RE: Blocked Thread while shutting down Felix / IPojo
Hi, Thanks for your analysis Richard, I have open an issue on iPojo here : https://issues.apache.org/jira/browse/FELIX-3421 It the meantime, I will try to find a workaround to solve my problem. WBR // David -Original Message- From: Richard S. Hall [mailto:he...@ungoverned.org] Sent: lundi 2 avril 2012 22:40 To: users@felix.apache.org Subject: Re: Blocked Thread while shutting down Felix / IPojo This is not related to FELIX-3393, although it appears related to the Aries Blueprint comment on FELIX-3393, which is also unrelated to FELIX-3393. It appears in both situations the component framework (Aries Blueprint and/or iPOJO) is synchronously dealing with a bundle being stopped while at the same time trying to register a service for that bundle. Since the component framework is holding and/or needs its own internal lock when dealing with the stopped bundle and registering the service, we get into a deadlock situation, since both threads also need the bundle lock too. Perhaps just open an issue against the framework to track this. - richard On 4/2/12 13:46, Gay David (Annecy) wrote: Hi, I'm currently have a problem with Felix and or IPojo. Basically the problem is when Felix is starting up and services are still registering while and in the meantime a stop Felix is request. The code to stop is simple : getBundle(0).stop(); If I have a look at the thread dump on JVisualVM, I have (full thread dump in attachement) : FelixStartLevel daemon prio=6 tid=0x06d6c000 nid=0xb00 waiting for monitor entry [0x07fbf000] java.lang.Thread.State: BLOCKED (on object monitor) at org.apache.felix.ipojo.IPojoFactory.removeFactoryStateListener(IPojoFactory.java:491) - waiting to lock 0xc048c790 (a org.apache.felix.ipojo.ComponentFactory) at org.apache.felix.ipojo.InstanceCreator.removeFactory(InstanceCreator.java:187) at org.apache.felix.ipojo.Extender.closeManagementFor(Extender.java:156) at org.apache.felix.ipojo.Extender.bundleChanged(Extender.java:129) at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:868) at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:789) at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:514) at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4245) at org.apache.felix.framework.Felix.stopBundle(Felix.java:2352) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1215) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295) at java.lang.Thread.run(Unknown Source) Locked ownable synchronizers: - None And Thread-2 daemon prio=6 tid=0x07050800 nid=0x6d8 in Object.wait() [0x084bd000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on 0xc029d238 (a [Ljava.lang.Object;) at java.lang.Object.wait(Object.java:485) at org.apache.felix.framework.Felix.acquireBundleLock(Felix.java:4872) - locked 0xc029d238 (a [Ljava.lang.Object;) at org.apache.felix.framework.Felix.registerService(Felix.java:3206) at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346) at org.apache.felix.ipojo.IPojoContext.registerService(IPojoContext.java:338) at org.apache.felix.ipojo.handlers.providedservice.ProvidedService.registerService(ProvidedService.java:345) - locked 0xeafc8ea0 (a org.apache.felix.ipojo.handlers.providedservice.ProvidedService) at org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.__stateChanged(ProvidedServiceHandler.java:494) at org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.stateChanged(ProvidedServiceHandler.java) at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471) at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353) at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166) at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301) - locked 0xc048c790 (a org.apache.felix.ipojo.ComponentFactory) at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238) at org.apache.felix.ipojo.Factory$$Proxy.createComponentInstance(Unknown Source
Blocked Thread while shutting down Felix / IPojo
Hi, I'm currently have a problem with Felix and or IPojo. Basically the problem is when Felix is starting up and services are still registering while and in the meantime a stop Felix is request. The code to stop is simple : getBundle(0).stop(); If I have a look at the thread dump on JVisualVM, I have (full thread dump in attachement) : FelixStartLevel daemon prio=6 tid=0x06d6c000 nid=0xb00 waiting for monitor entry [0x07fbf000] java.lang.Thread.State: BLOCKED (on object monitor) at org.apache.felix.ipojo.IPojoFactory.removeFactoryStateListener(IPojoFactory.java:491) - waiting to lock 0xc048c790 (a org.apache.felix.ipojo.ComponentFactory) at org.apache.felix.ipojo.InstanceCreator.removeFactory(InstanceCreator.java:187) at org.apache.felix.ipojo.Extender.closeManagementFor(Extender.java:156) at org.apache.felix.ipojo.Extender.bundleChanged(Extender.java:129) at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:868) at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:789) at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:514) at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4245) at org.apache.felix.framework.Felix.stopBundle(Felix.java:2352) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1215) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295) at java.lang.Thread.run(Unknown Source) Locked ownable synchronizers: - None And Thread-2 daemon prio=6 tid=0x07050800 nid=0x6d8 in Object.wait() [0x084bd000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on 0xc029d238 (a [Ljava.lang.Object;) at java.lang.Object.wait(Object.java:485) at org.apache.felix.framework.Felix.acquireBundleLock(Felix.java:4872) - locked 0xc029d238 (a [Ljava.lang.Object;) at org.apache.felix.framework.Felix.registerService(Felix.java:3206) at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346) at org.apache.felix.ipojo.IPojoContext.registerService(IPojoContext.java:338) at org.apache.felix.ipojo.handlers.providedservice.ProvidedService.registerService(ProvidedService.java:345) - locked 0xeafc8ea0 (a org.apache.felix.ipojo.handlers.providedservice.ProvidedService) at org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.__stateChanged(ProvidedServiceHandler.java:494) at org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.stateChanged(ProvidedServiceHandler.java) at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471) at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353) at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166) at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301) - locked 0xc048c790 (a org.apache.felix.ipojo.ComponentFactory) at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238) at org.apache.felix.ipojo.Factory$$Proxy.createComponentInstance(Unknown Source) at com.axway.cmp.ume.ui.internal.ComponentDefinition.__createAndStart(ComponentDefinition.java:147) at com.axway.cmp.ume.ui.internal.ComponentDefinition.createAndStart(ComponentDefinition.java) at com.axway.cmp.ume.ui.internal.ComponentDefinition.__validate(ComponentDefinition.java:85) at com.axway.cmp.ume.ui.internal.ComponentDefinition.validate(ComponentDefinition.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.felix.ipojo.util.Callback.call(Callback.java:237) at org.apache.felix.ipojo.util.Callback.call(Callback.java:193) at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86) at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:162) at
IPojo Service Creation
Hi all, I would like to know how to create by code an instance of an IPojo component without creating a Configuration in the ConfigAdmin. I know today that I can create an instance with the ConfigurationAdmin, and also with the IPojo factory : but this create a Configuration object and my need is not to persist the service. I would like kind of volatile services that dies when the JVM stop or crash. WBR // David
RE: iPojo and @Modified
Hi Clement, I understand that @Modified callback is call when a modification is done on : * a @ServiceProperty * and also a @Property, if and only if, the attribute propagation=true on the @Component annotation is set : that's why on my test class [DummyServiceImpl] I put it. But, this is what I understand from the iPojo documentation, and I may have misunderstood the propagation concept ! Can you confirm me this behavior ? Thanks again for you help Regards, David -Message d'origine- De : Clement Escoffier [mailto:clement.escoff...@gmail.com] Envoyé : lundi 13 juin 2011 12:16 À : users@felix.apache.org Objet : Re: iPojo and @Modified Hi, The interesting thing is your case it that @Modified should not be called at all, as your properties are not service properties. In fact, I just fixed a bug triggering updates every time the instance is reconfigured regardless there are changes or not (https://issues.apache.org/jira/browse/FELIX-2995). Now, this should not happen anymore, updates are triggered only when the published properties are really changed. Regards, Clement On 08.06.2011, at 12:07, Gay David (Annecy) wrote: Hi all, While working with iPojo, I found a strange behaviors. I've attach a small sample to illustrate what's happen. The strange behaviors I found is on the @Modified callback. When a new instance is created, the @Modified callback is called just after the @Bind, I think it should not because it's the first time init and not a modification of a already create service. This can be seen on my sample : - modified create foo1 foo2 DummyServiceImpl.updated foo1 / foo2 DummyServiceImpl.validatefoo1 / foo2 Bind : DoIt - foo1 / foo2 Modified : DoIt - foo1 / foo2 DummyServiceImpl.postRegistrationfoo1 / foo2 As you see the Modified method is call just after the bind. The other problem is when there is a reconfiguration : the @Modified callback is called twice. This can be seen on my sample : - modified update foo10 foo20 Modified : DoIt - foo10 / foo20 Modified : DoIt - foo10 / foo20 DummyServiceImpl.updated foo10 / foo20 As you see the Modified method is call twice. Also note that the updated is call at the end, I'm wondering if it's normal or not. If you need to change some internal state in the service when configuration change, it's too late for the ones that uses the service. But maybe it's a normal behavior and in this case, a @PreUpdated callback would be useful. By looking at the stack trace when the method @Modified is called, it may be the Felix framework that is responsible ? Modified : DoIt - foo10 / foo20 at test.ipojo.modified.DummyServiceTester.__modifiedControlService(DummyServiceTester.java:106) at test.ipojo.modified.DummyServiceTester.modifiedControlService(DummyServiceTester.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.felix.ipojo.util.Callback.call(Callback.java:237) at org.apache.felix.ipojo.handlers.dependency.DependencyCallback.call(DependencyCallback.java:244) at org.apache.felix.ipojo.handlers.dependency.Dependency.invokeCallback(Dependency.java:312) at org.apache.felix.ipojo.handlers.dependency.Dependency.callModifyMethod(Dependency.java:337) at org.apache.felix.ipojo.handlers.dependency.Dependency.onServiceModification(Dependency.java:485) at org.apache.felix.ipojo.util.DependencyModel.manageModification(DependencyModel.java:615) at org.apache.felix.ipojo.util.DependencyModel.modifiedService(DependencyModel.java:497) at org.apache.felix.ipojo.util.Tracker$Tracked.track(Tracker.java:676) at org.apache.felix.ipojo.util.Tracker$Tracked.serviceChanged(Tracker.java:647) at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:871) at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:733) at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662) at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3890) at org.apache.felix.framework.Felix.access$000(Felix.java:79) at org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:728) at org.apache.felix.framework.ServiceRegistry.servicePropertiesModified(ServiceRegistry.java:480) at org.apache.felix.framework.ServiceRegistrationImpl.setProperties(ServiceRegistrationImpl.java:116) at org.apache.felix.ipojo.handlers.providedservice.ProvidedService.update(ProvidedService.java
iPojo callback concurrent access
[PS : I post this message in the felix dev mailing list by error, that why I re-post it here, sorry] Hi all, Have a question about iPojo. I made a simple component like that : @Component( name=My.Manager ) @Instantiate public class MyManagerImpl { private boolean register; private SetServiceReference myservices; public MyManagerImpl() { register = false; apis = new HashSetServiceReference(); adapters = new HashMapLong,ComponentInstance(); } @Validate private void validate() { for( ServiceReference ref : myservices ) { install( ref ); } register = true; } @Invalidate private void invalidate() { for( ServiceReference ref : myservices ) { uninstall( ref ); } register = false; } @Bind( id=services, aggregate=true, optional=true ) private void bindMyService( MyService srv, ServiceReference ref ) { myservices.add( ref ); if( register ) { install( ref ); } } @Unbind( id=services ) private void unbindMyService( MyService srv, ServiceReference ref ) { if( myservices.remove(ref) register ) { uninstall( ref ); } } @Modified( id=services ) private void modifiedMyService( MyService srv, ServiceReference ref ) { if( register ) { uninstall( ref ); install( ref ); } } private void install( ServiceReference ref ) { // bla bla ... } private void uninstall( ServiceReference ref ) { // bla bla ... } } At runtime, sometimes I have an exception : 2011-06-06 16:21:37,222 GMT+0200 - [Thread-3] ERROR (test.?:?) - [ERROR] My.Manager : [My.Manager-0] The callback method validate has thrown an exception : null java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at test.MyManagerImpl.__validate(RestManagerImpl.java:78) at test.MyManagerImpl.validate(RestManagerImpl.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.felix.ipojo.util.Callback.call(Callback.java:235) at org.apache.felix.ipojo.util.Callback.call(Callback.java:191) For what I understand, it means that the iteration over the collection in the validate() method is modified by another thread. Is it possible that bind/unbind/validate/unvalidate callback method could be call concurrently ? I don't find it clearly in the ipojo doc, but I understand that iPojo take care of that. I'm wrong ? Do I have to synchronize myself ? BTW : I'm currently using iPojo 1.6.4 Regards David
RE: iPojo composite configuration
Hi Clement, I try with the trunk as you suggest and it works perfectly. Thanks for your help. Do you know when the next iPojo Composite will be released ? Regards, David -Message d'origine- De : Clement Escoffier [mailto:clement.escoff...@gmail.com] Envoyé : jeudi 17 février 2011 14:17 À : Apache Felix - Users Mailing List Objet : Re: iPojo composite configuration Hi, The composite 1.8.0 is not yet released. You should use the trunk version of the composite bundle for now. (the iPOJO-1.8.0 version in jira is misleading, next versions will be separated). Regards, Clement From: Gay David (Annecy) d...@axway.com Reply-To: Apache Felix - Users Mailing List users@felix.apache.org Date: Thu, 17 Feb 2011 13:14:34 + To: Apache Felix - Users Mailing List users@felix.apache.org Subject: iPojo composite configuration Hi all, I¹m trying to create configurable iPojo composite instance. But I¹m unable to made it works properly. Regarding the issue here, it¹s supported : https://issues.apache.org/jira/browse/FELIX-2746 I made a little test to reproduce what I want to do. Could someone helps me. I¹m sure I miss something but I don¹t see where my error is. I¹ve made my test with latest iPojo (1.8.0) and Felix (3.0.8) ID|State |Level|Name 0|Active |0|System Bundle (3.0.8) 1|Active |1|Apache Felix Bundle Repository (1.6.2) 2|Active |1|Apache Felix Configuration Admin Service (1.2.8) 3|Active |1|Apache Felix Gogo Command (0.8.0) 4|Active |1|Apache Felix Gogo Runtime (0.8.0) 5|Active |1|Apache Felix Gogo Shell (0.8.0) 6|Active |1|Apache Felix iPOJO (1.8.0) 7|Active |1|Apache Felix iPOJO API (1.6.0) 8|Active |1|Apache Felix iPOJO Gogo Command (1.0.1) 9|Active |1|Apache Felix iPOJO Composite (1.6.0) 10|Active |1|Unnamed - acme:foo-provider:bundle:1.0.0-SNAPSHOT (1.0.0.SNAPSHOT) 11|Active |1|Unnamed - acme:foo-composite:bundle:1.0.0-SNAPSHOT (1.0.0.SNAPSHOT) 13|Active |1|Unnamed - acme:foo-application:bundle:1.0.0-SNAPSHOT (1.0.0.SNAPSHOT) Thanks and regards David G. - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org
RE: iPojo composite configuration
Clement, Thanks you. Next week will be perfect ! Regards David. -Message d'origine- De : Clement Escoffier [mailto:clement.escoff...@gmail.com] Envoyé : jeudi 17 février 2011 17:05 À : Apache Felix - Users Mailing List Objet : Re: iPojo composite configuration On 17.02.11 16:56, Gay David (Annecy) d...@axway.com wrote: Hi Clement, I try with the trunk as you suggest and it works perfectly. Thanks for your help. Do you know when the next iPojo Composite will be released ? ASAP :-) I will to try to cut the release this weekend, then it takes a couple of days for the acceptance vote. So you can expect it for end of next week. Regards, Clement
Ipojo Composite Configuration
Hi all, I'm playing today with iPojo Composite. I'm still searching but does anybody know if I can declare properties on a composite that will configure the instances define inside my composite ? What 'm looking is somethink like that : !-Define the composite -- composite name=MySuperComposite property name=compositeUrlJdbc value=jdbc://default/url/ instance component=my.jdbc.consumer.impl property name=db.url value=compositeUrlJdbc/ /instance instance component=my.other.jdbc.consumer.impl property name=db.url value=compositeUrlJdbc/ /instance /composite !-Define a first instance -- instance component=MySuperComposite name=msc1 property name=compositeUrlJdbc value=jdbc://oracle.../ /instance !-Define a second instance -- instance component=MySuperComposite name=msc2 property name=compositeUrlJdbc value=jdbc://mysql.../ /instance In fact I would like to have a same mechanism like standard component. With OSGi Config Admin support. Is it possible ? Thanks for your help. David G.
RE: Ipojo Composite Configuration
Hi, Thanks Clement for your answer. Too bad, for me :-) Do you have plan to add configurable composite in the future ? I find Composite so powerful and it add so much value to OSGi that I right now can't imagine living without ! Thanks again for your help. Merry Christmas and a Happy New Year Regards David G. -Message d'origine- De : Clement Escoffier [mailto:clement.escoff...@gmail.com] Envoyé : vendredi 24 décembre 2010 14:08 À : users@felix.apache.org Objet : Re: Ipojo Composite Configuration Unfortunately, it's not supported. You can define configured instances inside the composite, but the composite does not support configuration right now. It was never implemented. Regards, Clement - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org
iPojo context-awareness
Hi all, While looking at some documents about iPojo composition, I've see that there is a notion of context-source. For example : * this presentation at page 91 : http://felix.apache.org/site/presentations.data/ipojo-berlin-20080611.pd f * this presentation at page 43 : http://felix.apache.org/site/article-presentations.data/iPOJO-Defense-FI NAL.pdf In the iPojo API, I've also see this interface : http://felix.apache.org/ipojo/api/1.6.0/org/apache/felix/ipojo/ContextSo urce.html And in the composite documentation here : http://felix.apache.org/site/ipojo-composition-tutorial.html , there is nothing about it, just a word in the conclusion that say that context-awareness will be addressed shortly (as other topics) While composite are very clear to me (BTW this is an fantastic feature, thanks), I'm not sure I understand what's really the context-source and context awareness. Can someone provides me more info / links / samples about this ? Thanks for your help. David G.
RE: iPojo context-awareness
First of all, thanks Clement and Richard for you explainations. What I understand : By looking at iPojo sources, if I want to use this feature, I must publish an implementation of the interface org.apache.felix.ipojo.ContextSource in the service registry with a service property source.name=foo. The value foo, is in fact the name of the context in the composite declaration : context-source=global:foo With that, I can refer to any property inside the context in my LDAP filter. So that, if I change a value in the context all LDAP filter are recomputed automatically. Is my understanding correct ? Thanks again. Regards, David -Message d'origine- De : Richard S. Hall [mailto:he...@ungoverned.org] Envoyé : mercredi 24 novembre 2010 16:49 À : users@felix.apache.org Objet : Re: iPojo context-awareness On 11/24/10 9:17, Clement Escoffier wrote: Hi, On 24.11.10 13:27, Gay David (Annecy)d...@axway.com wrote: Hi all, While looking at some documents about iPojo composition, I've see that there is a notion of context-source. For example : * this presentation at page 91 : http://felix.apache.org/site/presentations.data/ipojo-berlin-20080611.pd f * this presentation at page 43 : http://felix.apache.org/site/article-presentations.data/iPOJO-Defense-FI NAL.pdf In the iPojo API, I've also see this interface : http://felix.apache.org/ipojo/api/1.6.0/org/apache/felix/ipojo/ContextSo urce.html And in the composite documentation here : http://felix.apache.org/site/ipojo-composition-tutorial.html , there is nothing about it, just a word in the conclusion that say that context-awareness will be addressed shortly (as other topics) While composite are very clear to me (BTW this is an fantastic feature, thanks), I'm not sure I understand what's really the context-source and context awareness. Can someone provides me more info / links / samples about this ? The context-awareness was made to allow composition to evolve according to a context (I.e. When the context changes, the composition is re-evaluated). This is a little bit experimental in the sense that this was never really used in production (as far as I know). The idea is kind of simple. You define context-sources providing the context and publishing the changes. Then, the compositions are expressed in term of the context by configuring 'context-aware-filters'. I will add ASAP an example of the context-awareness on the composition tutorial to make this topic clearer. To be a little more concrete (although details may be out of date)... A context source is just something that supplies name/value pairs at run time. A composition with a context source can have its filters written in terms of properties from the context source. For example, assume you have a context source that provides the user's current location. Then when you specify a sub-service in a composite, you can reference the user's current location in its filter, e.g.: composite name=foo ... sub-service context-source=global:user-context-source action=instantiate specification=org.foo.Printer filter=(location=${user.location}) / ... /composite In this case, the global context source user-context-source is used to determine the user's current location, which is used to track printer services in the same location as the user. - richard Regards, Clement PS: As I'm pretty sure you can read French, you can check: http://tel.archives-ouvertes.fr/tel-00347935/en/ (pages 129 to 131) Thanks for your help. David G. - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org
RE: iPojo customer handler
Hi Guillaume, Hi Clement, Thanks you very much for help and quick answer. I'll open an issue ASAP. Regards David G. -Message d'origine- De : Clement Escoffier [mailto:clement.escoff...@gmail.com] Envoyé : jeudi 9 septembre 2010 19:19 À : users@felix.apache.org Objet : Re: iPojo customer handler On 08.09.2010, at 09:45, Guillaume Sauthier wrote: Hmm AFAIK, there is no such option (Clement, correct me if I'm wrong). Component type's handlers are discovered using the metadata: all child elements of ipojo:component will be considered as handler requirements. This computation is done once during the component startup, and then the required handlers list is never touched again. ATM, you may implement a new iPOJO ComponentFactory (extending the usual ComponentFactory class) that automatically adds a new handler declaration for all the components that will be created. But that will still requires a change in the metadata.xml: components should be declared using a new tag (like my-component instead of component). And you'll have to digg inside the iPOJO's internals ... not an ideal solution :) I think that could be a nice new feature for the next iPOJO version: something that let you adapt ComponentFactory services to your own needs... Clement, what do you think ? Hi, Just definitely a good idea, and everything to do that is already here. Indeed, the architecture handle is ... automatically plugged to the instance :-) Please open an issue, we will investigate this issue ASAP. Regards, Clement --Guillaume Le 08/09/2010 09:12, Gay David (Annecy) a écrit : Hi all, I would like to create a new iPojo handler. I've read the tutorial here : http://felix.apache.org/site/how-to-write-your-own-handler.html I want to know if it's possible to create a handler without having to define the handler usage in metadata. For example, want I would like to do, is to have a log handler like in the example ,but without to modify existing iPojo component (to not have to specify log:log level=WARNING/) What I would like to have, is an optional service method interceptor handler to compute some metrics and/or check some security policies. But I don't want developers have to explicitly set the handler usage. Is it possible to do that ? Thanks for your help. Regards David G. - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org
RE: iPojo customer handler
Ok, issue created here : https://issues.apache.org/jira/browse/FELIX-2594 Thanks again and have a nice week end ! David G. -Message d'origine- De : Gay David (Annecy) [mailto:d...@axway.com] Envoyé : vendredi 10 septembre 2010 15:24 À : users@felix.apache.org Objet : RE: iPojo customer handler Hi Guillaume, Hi Clement, Thanks you very much for help and quick answer. I'll open an issue ASAP. Regards David G. -Message d'origine- De : Clement Escoffier [mailto:clement.escoff...@gmail.com] Envoyé : jeudi 9 septembre 2010 19:19 À : users@felix.apache.org Objet : Re: iPojo customer handler On 08.09.2010, at 09:45, Guillaume Sauthier wrote: Hmm AFAIK, there is no such option (Clement, correct me if I'm wrong). Component type's handlers are discovered using the metadata: all child elements of ipojo:component will be considered as handler requirements. This computation is done once during the component startup, and then the required handlers list is never touched again. ATM, you may implement a new iPOJO ComponentFactory (extending the usual ComponentFactory class) that automatically adds a new handler declaration for all the components that will be created. But that will still requires a change in the metadata.xml: components should be declared using a new tag (like my-component instead of component). And you'll have to digg inside the iPOJO's internals ... not an ideal solution :) I think that could be a nice new feature for the next iPOJO version: something that let you adapt ComponentFactory services to your own needs... Clement, what do you think ? Hi, Just definitely a good idea, and everything to do that is already here. Indeed, the architecture handle is ... automatically plugged to the instance :-) Please open an issue, we will investigate this issue ASAP. Regards, Clement --Guillaume Le 08/09/2010 09:12, Gay David (Annecy) a écrit : Hi all, I would like to create a new iPojo handler. I've read the tutorial here : http://felix.apache.org/site/how-to-write-your-own-handler.html I want to know if it's possible to create a handler without having to define the handler usage in metadata. For example, want I would like to do, is to have a log handler like in the example ,but without to modify existing iPojo component (to not have to specify log:log level=WARNING/) What I would like to have, is an optional service method interceptor handler to compute some metrics and/or check some security policies. But I don't want developers have to explicitly set the handler usage. Is it possible to do that ? Thanks for your help. Regards David G. - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org - To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org
Bundle plugin and _exportcontents version
Hi all, I try to use the Maven Bundle Plugin to create a bundle that embed several other non-osgi jars. I'll take an example with the well known Apache Commons IO, but my real case is to be able to embed several internal libraries. If I use this pom.xml : ?xml version=1.0 encoding=UTF-8? project xmlns=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/POM/4.0.0 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd http://maven.apache.org/maven-v4_0_0.xsd !-- General information -- modelVersion4.0.0/modelVersion groupIdcom.sample/groupId artifactIdcommons/artifactId packagingbundle/packaging version0.0.1-SNAPSHOT/version descriptionOSGi bundelization of many externals commons libraries/description !-- Build -- build plugins plugin groupIdorg.apache.felix/groupId artifactIdmaven-bundle-plugin/artifactId version2.1.0/version extensionstrue/extensions configuration unpackBundlefalse/unpackBundle instructions Embed-Dependencycommons-io;inline=false/Embed-Dependency _exportcontents*/_exportcontents /instructions /configuration /plugin /plugins /build !-- Dependencies -- dependencies dependency groupIdcommons-io/groupId artifactIdcommons-io/artifactId version1.4/version /dependency /dependencies /project The generated Manifest is : (...) Export-Package: org.apache.commons.io.output;uses:=org.apache.commons .io,org.apache.commons.io.filefilter;uses:=org.apache.commons.io,o rg.apache.commons.io.comparator;uses:=org.apache.commons.io,org.apa che.commons.io.input;uses:=org.apache.commons.io,org.apache.commons .io;uses:=org.apache.commons.io.filefilter,org.apache.commons.io.out put (...) Import-Package: org.apache.commons.io;version=1.4,org.apache.commons .io.comparator;version=1.4,org.apache.commons.io.filefilter;version =1.4,org.apache.commons.io.input;version=1.4,org.apache.commons.i o.output;version=1.4 (...) My problem is that the Export-Package don't have the version=1.4 information automatically added. Is it a normal behavior ? Why can't the bundle plugin do that automatically ? it's done for the Import-Package ! Is there a special syntax that I haven't found in BND ? I know I can modify manually in the pom the _exportcontents directive by adding : _exportcontents*;version=1.4/_exportcontents but I like to apply the rule Don't Repeat Yourself : the version information is already in the dependency ! Also, if I add more and more dependencies to embed in this bundle, I would prefer if it's only a matter of adding a Maven dependency. Thanks a lot for your helps Regards David