Aggelos

I am not a regular user of Knopflerfish, so it is hard for me to comment. 
I would suggest that you try with Equinox to rule out the possibility of a 
bug in the framework.  I am certain that this works in Equinox, but as I 
say, cannot comment on Knopflerfish.

Regarding manifest headers:  Using SAT does not introduce any changes to 
your OSGi manifest.  Your comment on export/import headers worries me 
since it is unclear if you're talking about Import-Package and 
Export-Package, or the deprecated Import-Service and Export-Service 
headers.  The SAT runtime completely ignores the deprecated headers.

To which OSGi book are you referring?

Good luck,

Simon




Aggelos Mpimpoudis <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
07/31/2007 07:22 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






In addition to the previous, the manifest file structure, remaines 
intact right? I mean that, even if the the whole service coordination 
model is somehow altered, we still have to declare explicitly, 
export/import headers,at manifest file, dont' we(as is documented in 
OSGi book)?

A.

Simon J Archer wrote:
>
> Aggelos
>
> [ I'm happy to discuss this here, unless anyone else objects to the 
> discussion happening on the OSGi mailing list. ]
>
> ...
>
> I do not see a getImportedServiceNames() method that returns a 
> String[] of service names. 
>
>         protected String[] getImportedServiceNames() {
>                 return new String[] {
>                         servicetype1.class.getName(),
>                         servicetype2.class.getName(),
>                         servicetype3.class.getName()
>                 };
>         }
>
> Without that, your getservicetype1() methods are probably returning 
> null.  I am assuming that getservicetype1() is something like:
>
>         private servicetype1 getservicetype1() {
>                 return (servicetype1) 
> getImportedService(servicetype1.class.getName());
>         }
>
>
> This worried me too:
>
> >     protected void createExportedServices(type BCObject) {
> > 
> >         String[] names = new String[] {
> >                 mplampla, mplampla
> >          };
> >          addExportedServices(names, BCObject, null);
> > 
> >     }
>
>
> The names must be fully qualified type names.  I guess "mplampla" is 
> just your pseudo-code.
>
> >>Furthermore, if the deactivator is called (for any reason), is the
> >>service facility going to be destructed, or the previous instance will
> >>be used?
>
> After returning from deactivate(), SAT will automatically unregister 
> all registered services for your.  You would only need deactivate() if 
> MyserviceType needed some sort of clean up, for example:
>
>         protected void activate() {
>                 ...
>                 MyserviceType service = new MyserviceType(...);
>                 service.start();
>                 ...
>         }
>
>         protected void deactivate() {
>                 ...
>                 MyserviceType service = 
> getExportedService(MyserviceType,class.getName());
>                 service.stop();
>                 ...
>         }
>
>
> I hope this helps.
>
> Simon
>
>
>
> *Aggelos Mpimpoudis <[EMAIL PROTECTED]>*
> Sent by: [EMAIL PROTECTED]
>
> 07/30/2007 12:12 PM
> Please respond to
> OSGi Developer Mail List <[email protected]>
>
>
> 
> To
>                OSGi Developer Mail List <[email protected]>
> cc
> 
> Subject
>                Re: [osgi-dev] Service Tracking Matter
>
>
>
> 
>
>
>
>
>
> Something like, plus the appropriate private service getters methods.
> > package ...
> >
> > imports ...
> >
> > public class Activator extends BaseBundleActivator {
> >     private type1 var1;
> >     private type2 var2;
> > 
> >
> > 
> >     protected void activate() {
> >         var1 = getservicetype1();
> >         var2 = getservicetype2();
> >         var3 = getservicetype2();
> > 
> >         try {
> >             MyserviceType service = new MyserviceType (var1,
> > 
> var2,
> > 
> var3,
> > 
> var4);
> >             createExportedServices(service);
> >         } catch (... e) {
> >             // TODO Auto-generated catch block
> >             e.printStackTrace();
> >         }
> > 
> >     }
> >
> >     public void start (){
> > 
> >         System.out.println("Init Bootstrap");
> >     }
> >
> > 
> >     protected void createExportedServices(type BCObject) {
> > 
> >         String[] names = new String[] {
> >                 mplampla, mplampla
> >          };
> >          addExportedServices(names, BCObject, null);
> > 
> >     }
> >
> >
> >     protected void deactivate() {
> >         // TODO Implement deactivate()
> >     }
> >
> >
> > }
> Although the required bundles are up, I still cannot see results from a
> println call..... :(
> Furthermore, if the deactivator is called (for any reason), is the
> service facility going to be destructed, or the previous instance will
> be used?
>
> Thx,
> Aggelos
>
>
>
> Simon J Archer wrote:
> >
> > 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
>
>
> -- 
> 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