Aggelos

The BaseBundleActivator's activate() method is only called when the 
activator has acquired ALL of the service it requires, as described by the 
getImportedServices() method.  Remember that the required services either 
may or may not be available when the bundle activator starts, so the 
activate()/deactivate() methods are often called asynchronously as a 
result of events published by OSGi.  In some cases the activate() method 
WILL get called as the bundle activator starts, but not necessarily.  The 
goal here is to make sure that there are no start-up order dependencies 
between the bundles.

The activate()/deactivate() methods always execute in pairs, meaning that 
deactivate() only happens after an activate(), and the activate() can be 
re-executed after a deactivate().  As services are acquired/released the 
activate()/deactivate() methods will get called.

If you show me the activator code you have that might help.

Good luck,

Simon




Aggelos Mpimpoudis <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
07/30/2007 10:47 AM
Please respond to
OSGi Developer Mail List <[email protected]>


To
OSGi Developer Mail List <[email protected]>
cc

Subject
Re: [osgi-dev] Service Tracking Matter






Quick question: what the following question means?
/
Hook Method:/ You have been activated. This method is implemented by 
bundles that wish to execute *domain specific activation*

Even if I have implemented my activate() method, I think that it doesn't 
execute it's code at all (when the bundle is started).

Thx,
Aggelos.

Simon J Archer wrote:
>
> Hi Aggelos
>
> The SAT Bundle Activator Wizard behaves much like the Java Class 
> Wizard in that by default it only offer types that are on the 
> project's classpath.  While using the Import/Export page of the wizard 
> you can actually make it see types visible to the workspace, rather 
> than simply those on the project's classpath... Use the "Edit Type 
> Scope..." button.  Of course, if you deviate from the project 
> classpath then you'll need to update the classpath to ensure that your 
> Activator will compile.  See the following page of the documentation:
>
> 
> 
http://www.vanderleiindustries.com/sat/help/topic/org.eclipse.soda.sat.plugin.activator.doc/books/tooling/activator/wizard-page-02.html
 

>
>
> Please give it another try.  If you continue to have trouble, please 
> reply with the steps you are taking; the clearer the better, since 
> this way I can help get you back on track.
>
> Let me know how it goes,
>
> Simon
>
>
>
> *Aggelos Mpimpoudis <[EMAIL PROTECTED]>*
> Sent by: [EMAIL PROTECTED]
>
> 07/27/2007 10:10 AM
> Please respond to
> OSGi Developer Mail List <[email protected]>
>
>
> 
> To
>                OSGi Developer Mail List <[email protected]>
> cc
> 
> Subject
>                Re: [osgi-dev] Service Tracking Matter
>
>
>
> 
>
>
>
>
>
> Xmm....Today was an OSGi day. I try several hours now to get along with
> SAT usage and I think I am getting along with it up until now. One
> little query though. Using the toolkit of SAT package, I try to import
> services through the Bundle Activator Wizard, but I cannot-it does not
> show me my project's packages. How does this works? I have a project
> with multiple packages (manifest files are constructed with ant
> directives and saved at a resource directory at project's root). I have
> scanned through SAT's documents but I didn't find a solution.
>
>
> Thank you,
> Aggelos Mpimpoudis
>
> Simon J Archer wrote:
> >
> > Seriously, SAT is easier than the ServiceTracker.  I encourage you to
> > try both and find out for yourself.
> >
> > I'm happy to help where I can,
> >
> > Simon
> >
> >
> >
> > *Aggelos Mpimpoudis <[EMAIL PROTECTED]>*
> >
> > 07/26/2007 05:17 PM
> >
> > 
> > To
> >                  Simon J Archer/Raleigh/[EMAIL PROTECTED]
> > cc
> > 
> > Subject
> >                  Re: [osgi-dev] Service Tracking Matter
> >
> >
> >
> > 
> >
> >
> >
> >
> >
> > Mr Archer in the past we have spoked in private about SAT and 
eclipsecon
> > that took place in March ;-)  (remember me?)
> > I find ServiceTracker a bit easier....Well. I will reconsider it
> > tonight, after a little time with me vs SAT (again)
> > I have all the appropriate material.
> >
> > I will answer at this mail, prividing my final decision. Thank u 
all!!!
> >
> > Thx,
> > Aggelos Mpimpoudis
> >
> > Simon J Archer wrote:
> > >
> > > Hello Agellos
> > >
> > > When you say, "only when 3 other services are added" I presume you
> > > mean 3 distinct services, right.  This is EASY to do with SAT....
> > >  Here's what you'd need:
> > >
> > > *public* *class* Activator *extends* BaseBundleActivator {
> > >         *protected* *void* activate() {
> > >                 ConfigurationAdmin cm = getConfigurationAdmin();
> > >                 LogService ls = getLogService();
> > >                 PackageAdmin pa = getPackageAdmin();
> > > 
> > >                 FooService service = *new* Foo(cm, ls, pa);
> > >                 addExportedService(FooService.*class*.getName(),
> > > service, *null*);
> > >         }
> > >
> > >         *private* ConfigurationAdmin getConfigurationAdmin() {
> > >                 *return* (ConfigurationAdmin)
> > > getImportedService(ConfigurationAdmin.*class*.getName());
> > >         }
> > >
> > >         *protected* String[] getImportedServiceNames() {
> > >                 *return* *new* String[] {
> > >                         ConfigurationAdmin.*class*.getName(),
> > >                         LogService.*class*.getName(),
> > >                         PackageAdmin.*class*.getName()
> > >                 };
> > >         }
> > >
> > >         *private* LogService getLogService() {
> > >                 *return* (LogService)
> > > getImportedService(LogService.*class*.getName());
> > >         }
> > >
> > >         *private* PackageAdmin getPackageAdmin() {
> > >                 *return* (PackageAdmin)
> > > getImportedService(PackageAdmin.*class*.getName());
> > >         }
> > > }
> > >
> > > I am assuming that you need three distinct services:
> > > ConfigurationAdmin, LogService and PackageAdmin service.  When, and
> > > ONLY WHEN, you have all three will activate() execute.  When you 
lose
> > > ANY ONE of the three services then deactivate() gets called.  In 
this
> > > case deactivate() is the inherited no-op implementation from the
> > > superclass.  When and ONLY WHEN, you have re-acquired all three
> > > services activate() will re-execute.
> > >
> > > Easy.
> > >
> > > Simon
> > >
> > > http://eclipse-sat.blogspot.com/
> > >
> > >
> > >
> > > *Aggelos Mpimpoudis <[EMAIL PROTECTED]>*
> > > Sent by: [EMAIL PROTECTED]
> > >
> > > 07/26/2007 02:30 PM
> > > Please respond to
> > > OSGi Developer Mail List <[email protected]>
> > >
> > >
> > > 
> > > To
> > >                  OSGi Developer Mail List <[email protected]>
> > > cc
> > > 
> > > Subject
> > >                  [osgi-dev] Service Tracking Matter
> > >
> > >
> > >
> > > 
> > >
> > >
> > >
> > >
> > >
> > > Hello, OSGi community.
> > >
> > > Here is my question. I have an OSGi service, that I want to 
initialize
> > > it's facilities only when 3 other services are added to the 
> framework. I
> > > construct 3 service trackers (each one for every needed service). 
How
> > > can I proceed after obtaining the knowledge that the 3 services are
> > > ready? I am thinking of keeping a map maintained and at every add 
and
> > > remove of service to check map's size and only if it is of size 3, 
to
> > > proceed with the thread's execution. Is this practice very naive? Is
> > > there something more obvious that I am missing?
> > >
> > > Thank you!
> > >
> > > My Best Regards,
> > > Aggelos Mpimpoudis
> > > --
> > > Dept. of Informatics & Telecommunications, University of Athens
> > > Athens, Greece
> > > Gsm: +306942075153 / Skype: aggelos.mpimpoudis
> > > email: a.mpimpoydhs [at] di.uoa.gr
> > > _______________________________________________
> > > OSGi Developer Mail List
> > > [email protected]
> > > http://www2.osgi.org/mailman/listinfo/osgi-dev
> > >
> >
> >
> > --
> > Dept. of Informatics & Telecommunications, University of Athens
> > Athens, Greece
> > Gsm: +306942075153 / Skype: aggelos.mpimpoudis
> > email: a.mpimpoydhs [at] di.uoa.gr
> >
>
>
> -- 
> Dept. of Informatics & Telecommunications, University of Athens
> Athens, Greece
> Gsm: +306942075153 / Skype: aggelos.mpimpoudis
> email: a.mpimpoydhs [at] di.uoa.gr
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> http://www2.osgi.org/mailman/listinfo/osgi-dev
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> http://www2.osgi.org/mailman/listinfo/osgi-dev


-- 
Dept. of Informatics & Telecommunications, University of Athens
Athens, Greece
Gsm: +306942075153 / Skype: aggelos.mpimpoudis
email: a.mpimpoydhs [at] di.uoa.gr
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev

Reply via email to