java - How do I get the symbolic name of the bundle, which serivce i use? -


i'm implementing journalling service needed map flow of data throughout osgi framework.

each time clientbundle wants use service form bundle first call function journalling bundle goes little this:

journalservice.journal(args); neededservice.neededfunction(args); 

i need following things journal service:

  • bundlename of bundle uses service.
  • bundlename of bundle provides service.
  • which service used.
  • which function of service used (probably string)
  • function arguments.

i know how last 2 (i pass arguments journal: string functionname , object[] args). don't know needs passed first 3, least amount of needed arguments.

if have servicereference, can information off of it. believe frameworks, deep down, use servicereferences reference individual services bundles.

http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/servicereference.html

you can bundle of service referencing. if bundle referencing service b bundle b, instance method servicereference.getbundle bundle b, , current bundlecontext bundle a.

that said, best bet may use referencelisteners (though may not using blueprint). let know when services referenced or dereferenced , contextual data related it. way may use serviceevent, lets listen register/deregister events. apologize if knew this.

http://www.ibm.com/developerworks/xml/library/os-osgiblueprint/index.html#srms

http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/serviceevent.html

as far tracking individual methods, can proxy references once pulled out of osgi. bundle have reference service b bundle b. bundle gets proxy of service b which, when called, delegates original method , calls journalservice.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -