Are you able to share your workspace? Regards,
Tim Sent from my iPhone > On 26 Oct 2016, at 12:34, <[email protected]> > <[email protected]> wrote: > > Just tried @Component(immediate = true, service=SampleImpl.class This did > *not* work either.. L > > But, you are right… I have *not* implemented any interface ..though I have > created a dummy one (simply lying there – created just in case I need it > later) > > public interface Alljoyn{ > } > > From: [email protected] [mailto:[email protected]] > On Behalf Of Daghan ACAY > Sent: 26 October 2016 15:55 > To: [email protected] > Subject: Re: [osgi-dev] Understanding activate > > ** This mail has been sent from an external source ** > I guess I know the problem. > > Your component does not implement an interface. That is, Osgi is build on the > idea of abstraction. You define an interface (java interface) and your > component implements it. If you follow that pattern then @Component can > figure out properly how to register your component. In your case you have an > implementation without an interface, hence you are breaking the convention. > there is nothing wrong with that, but you net to say OSGi DS that you are > doing this. Here is how you can do it: > > try > > @Component(immediate = true, service=SampleImpl.class) > public class SampleImpl { > > I hope this works > > Cheers > Daghan > > > > From: [email protected] <[email protected]> on > behalf of [email protected] <[email protected]> > Sent: Wednesday, October 26, 2016 9:47 AM > To: [email protected] > Subject: Re: [osgi-dev] Understanding activate > > I did this..Put a breakpoint at the print..anad ran it usin debug osgi ...I > did not get any different result... > From: [email protected] <[email protected]> on > behalf of Daghan ACAY <[email protected]> > Sent: 26 October 2016 15:00:17 > To: [email protected] > Subject: Re: [osgi-dev] Understanding activate > > ** This mail has been sent from an external source ** > Another thing i do is put a break point at the line, e.g. activate method in > your case, and run it in debug mode. It is more reliable than logs on console. > Sent by MailWise – See your emails as clean, short chats. > > > -------- Original Message -------- > From: Daghan ACAY <[email protected]> > Sent: Wednesday, October 26, 2016 08:27 PM > To: [email protected] > Subject: Re: [osgi-dev] Understanding activate > > I will just get a wild guess at it. > DS component start time is not deterministic. That is your component can > start first in all components, in the middle or the last. > I see you are using debug run which starts a lot components and prints out to > log. I say your "starting..." can be printed earlier in console. Please run > again with debug and scroll up. I have a feeling you will find "starting..." > Cheers > Daghan > Sent by MailWise – See your emails as clean, short chats. > > > -------- Original Message -------- > From: Timothy Ward <[email protected]> > Sent: Wednesday, October 26, 2016 08:22 PM > To: OSGi Developer Mail List <[email protected]> > Subject: Re: [osgi-dev] Understanding activate > > Also, your component should definitely not have a waiting thread which > discovers devices. The devices should register services which are injected > into the component. The injection can be used to trigger an action at that > time. This is known as the whiteboard pattern - bundles register a service so > that they can be discovered and used by another component. > > Regards, > > Tim > > > On 26 Oct 2016, at 11:20, Neil Bartlett <[email protected]> wrote: > > You don’t invoke the activate/deactivate methods yourself. They are invoked > by the SCR at the appropriate time, assuming they have been correctly > declared. > > On 26 Oct 2016, at 09:20, <[email protected]> > <[email protected]> wrote: > > Please find reply inline… > > From: [email protected] [mailto:[email protected]] > On Behalf Of Timothy Ward > Sent: 26 October 2016 13:20 > To: OSGi Developer Mail List <[email protected]> > Subject: Re: [osgi-dev] Understanding activate > > ** This mail has been sent from an external source ** > An activate method is able to start its own threads, but it sounds like this > may not be the right approach for you. > Me: Oh..okay.. > > What do you mean when you say "which would sleep and wait for others to join > before proceeding for next action”? This sounds a lot like you should be > using the OSGi service registry and referencing services rather than > sleeping. That way your activate method will not need to wait. > Me: Actually my plan is to wait on sleep to discover devices. [ I get a > callback when I other devices join the network. That part is written (not > tested).] > > As for your current problem - is that code snippet really the component? The > output indicates that you have a deactivate method defined as well. > Me: I have written a dummy deactivate method as well. It does nothing. My > intention is to somehow invoke this function in this bundle and see what > happens going forward when my java code executes. To start with I have just > written a dummy print statement “starting….” > > Regards, > > Tim > > > On 26 Oct 2016, at 09:43, <[email protected]> > <[email protected]> wrote: > > No…none of the others have activate() in them.. This is the first time I am > writing an activate() method… > > Plaese note: I just want a method in this bundle to be invoked on running the > framework. I thought activate() would be the right one. But I understand from > your comments that activate should not have a thread sleeping (which I > eventually planned). So, then activate() would not help me, right ? > > Could you propose as to what I should do alternatively to invoke a function > (which would sleep and wait for others to join before proceeding for next > action) on start up? > > > From: [email protected] [mailto:[email protected]] > On Behalf Of Timothy Ward > Sent: 26 October 2016 13:03 > To: OSGi Developer Mail List <[email protected]> > Subject: Re: [osgi-dev] Understanding activate > > ** This mail has been sent from an external source ** > I note that there are a number of other DS components present - are any of > the others showing the same issue? > > I’m making a guess here, but do any of the other components have Activate > methods which can block the activation Thread? > > Felix SCR owns a background worker thread which is used for a number of > different tasks. In components like this one the thread will be used to > invoke the activate method. If a component is blocks that thread then it may > cause your whole SCR to get “stuck”. This is one of several reasons why > activate methods should not block for long periods. > > Your problem may be totally unrelated to this, but it is worth checking. > > Regards, > > Tim > > > On 26 Oct 2016, at 09:11, [email protected] wrote: > > Please find my code snippet + the scr diagnostics ..below: > > ============ > @Component(name = "com.wipro.iot.Alljoyn", immediate = true) > public class AlljoynImpl { > > @Activate > public void activate() > { > System.out.println("starting....."); > } > } > > > ============ > > g! > g! scr:list > Name BundleId DefaultEnabled > [com.wipro.iot.Alljoyn] [ 6] [true] > [com.wipro.iot.DeviceManager] [ 1] [true] > [com.wipro.iot.GatewayDevice] [ 2] [true] > [com.wipro.iot.HueLight] [ 3] [true] > [com.wipro.iot.LampDevice] [ 4] [true] > [com.wipro.iot.MobilePhone] [ 5] [true] > [com.wipro.iot.poc] [ 7] [true] > [org.eclipse.equinox.event] [ 18] [true] > [osgi.enroute.configurer.simple.provider.Configurer] [ 22] [true] > [osgi.enroute.dto.bndlib.provider.DTOsProvider] [ 23] [true] > [osgi.enroute.logger.simple.provider.LoggerAdminImpl] [ 26] [true] > [osgi.enroute.logger.simple.provider.LoggerComponentImpl] [ 26] [true] > [osgi.enroute.rest.simple] [ 27] [true] > [osgi.enroute.simple.server] [ 29] [true] > [osgi.executor.provider] [ 24] [true] > g! > g! > g! > g! scr:info com.wipro.iot.Alljoyn > *** Bundle: com.wipro.iot.alljoyn.adapter (6) > Component Description: > Name: com.wipro.iot.Alljoyn > Default State: enabled > Activation: immediate > Configuration Policy: optional > Activate Method: activate > Deactivate Method: deactivate > Modified Method: - > Configuration Pid: [com.wipro.iot.Alljoyn] > Services: Service Scope: null > Properties: > Component Configuration: > ComponentId: 5 > State: satisfied > Properties: > component.id = 5 > component.name = com.wipro.iot.Alljoyn > g! > g! > g! > > From: [email protected] <[email protected]> on > behalf of Tim Ward <[email protected]> > Sent: 26 October 2016 12:04:44 > To: OSGi Developer Mail List > Subject: Re: [osgi-dev] Understanding activate > > ** This mail has been sent from an external source ** > Manoj, > > As Bernd suggested, it would be a good idea to run the Felix SCR diagnostic > commands. > > scr:list will list the DS components in the runtime. If you don't see your > component in the output then you need to check the bundle you're building to > see if you've forgotten to include the DS component. > > scr:info <component name> will give detailed information about the component, > including what state it is in. > > Regards, > > Tim > > Sent from my iPhone > > On 26 Oct 2016, at 07:31, <[email protected]> > <[email protected]> wrote: > > Bernd…I am on Enroute Eclipse/Bndtools and clicking on “Debug OSGi” to run > the application. > > From: [email protected] [mailto:[email protected]] > On Behalf Of Bernd Eckenfels > Sent: 26 October 2016 10:55 > To: OSGi Developer Mail List <[email protected]> > Subject: Re: [osgi-dev] Understanding activate > > ** This mail has been sent from an external source ** > How do you build and install your bundle? Make sure the resulting JAR > actually contains the SCR descriptor for the component and also ensure the DS > service is actually available in the runtime. Other than that, the actual > code can be correct (depending on your actual imports which was not shown). > > If this contains Felix Services and gogo Shell you can use scr:list command > to verify. > > Gruss > Bernd > -- > http://bernd.eckenfels.net > > > > > > On Wed, Oct 26, 2016 at 7:07 AM +0200, <[email protected]> wrote: > > Hi All, > > @Component(immediate = true) > public class SampleImpl { > > @Activate > public void activate() > { > System.out.println("starting....."); > } > } > > How to invoke this ? activate() is not getting invoked when I run this simple > application. > > Thanks, > Manoj > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. WARNING: Computer viruses can be transmitted via > email. The recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any damage caused > by any virus transmitted by this email. www.wipro.com > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. WARNING: Computer viruses can be transmitted via > email. The recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any damage caused > by any virus transmitted by this email. www.wipro.com > _______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. WARNING: Computer viruses can be transmitted via > email. The recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any damage caused > by any virus transmitted by this email. > www.wipro.com_______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev > > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. WARNING: Computer viruses can be transmitted via > email. The recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any damage caused > by any virus transmitted by this email. > www.wipro.com_______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev > > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. WARNING: Computer viruses can be transmitted via > email. The recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any damage caused > by any virus transmitted by this email. www.wipro.com > _______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev > > _______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev > > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. WARNING: Computer viruses can be transmitted via > email. The recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any damage caused > by any virus transmitted by this email. www.wipro.com > The information contained in this electronic message and any attachments to > this message are intended for the exclusive use of the addressee(s) and may > contain proprietary, confidential or privileged information. If you are not > the intended recipient, you should not disseminate, distribute or copy this > e-mail. Please notify the sender immediately and destroy all copies of this > message and any attachments. WARNING: Computer viruses can be transmitted via > email. The recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any damage caused > by any virus transmitted by this email. www.wipro.com > _______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
