• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

OSGi and Spring modules

 
Greenhorn
Posts: 11
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Craig and ranchers!

Wich Spring core functionality (DI, AOP, ...) better suite OSGi ? and what´s the relantionship with other Spring projects (Web flow, Security, etc.) ?

Thanks!
 
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Manassés Souza wrote:Wich Spring core functionality (DI, AOP, ...) better suite OSGi ? and what´s the relantionship with other Spring projects (Web flow, Security, etc.)



That's a tough one to answer. Certainly DI and OSGi go together very well, as that's what Spring-DM is all about: wiring OSGi services and wiring the beans that make up those services. AOP is a bit tougher, because (due to OSGi's unique way of dealing with the classpath), AOP's reach is a bit constrained in OSGi.

As for the rest of the Spring portfolio...I'm not sure, but I suspect most or all of it can fit into OSGi somehow. It just kinda depends on what you want to do.

In my opinion, one such mix of Spring in OSGi that looks appealing is a mixture of Spring-DM, Spring Security, Spring Integration, and Spring-WS. I've not spent any time exploring this mix, but I've pondered it quite some bit on my drive to work and it seems like a powerful mix of Spring related technologies within OSGi.
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Craig Walls wrote:
AOP is a bit tougher, because (due to OSGi's unique way of dealing with the classpath), AOP's reach is a bit constrained in OSGi.


Could you please to explain more on this? How could using OGSi make it difficult to use Spring AOP?
 
Craig Walls
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kengkaj Sathianpantarit wrote:

Craig Walls wrote:
AOP is a bit tougher, because (due to OSGi's unique way of dealing with the classpath), AOP's reach is a bit constrained in OSGi.


Could you please to explain more on this? How could using OGSi make it difficult to use Spring AOP?



Well, the gist of it has to do with OSGi's way of constraining the classloader. Each bundle gets its own classloader and that bundle can only see its own contents plus the contents of the packages that it has imported. That means that a bundle with an aspect in it can only advise those things it sees and not necessarily everything in the OSGi runtime. (As opposed to non-OSGi where the classpath is one big dumping ground for classes and resources and an aspect can advise pretty much anything its pointcut specifies.)
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see, but I think it might be a good thing to advise only things a bundle see, what do you think?

I don't like AOP much, and I would not advise junior developers to use AOP.
I'm not quite comfortable for the fact that I might accidentally advise something I don't want or I don't even know about.
Or when I'm refactoring a class, maybe this class is being advised from an unknown aspect, and refactoring it might break some functionality.
 
Craig Walls
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kengkaj Sathianpantarit wrote:I see, but I think it might be a good thing to advise only things a bundle see, what do you think?



Maybe, but I think that there's a certain amount of value in creating a bundle that provides an aspect that can be used across all other bundles. I can totally understand the concerns you presented, but I still kinda like the idea and can see it being useful (even if dangerous in the wrong hands).
 
reply
    Bookmark Topic Watch Topic
  • New Topic