Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

When to use OSGI Bundles and when not to use them?

Avatar

Level 6

I understand how to  create an OSGI bundle using the Maven

- mvn -Padobe-public archetype:generate -DarchetypeRepository=http://repo.adobe.com/nexus/content/groups/public/ -DarchetypeGroupId=com.day.jcr.vault  -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.2.

I understand the technical tasks required to make a bundle and in eclipse and import it into AEM. 

On the site i am working on I have been given 3 points of view for using OSGI Bundles in Components.

1) (Also my preference). Place as little code as possible inside JSP files, place all Java class code inside OSGI Bundle in eclipse and then import bundles into AEM.

2)  Bundles are kept simple, with as little as possible “data” in them.  Authors are empowered to configure as much as possible from the component dialog with the bundle simply doing the “heavy lifting”.

3) Avoid bundles, if and get the JSP to do processing, including placing classes in the JSP. While this can be made to work I can foresee problems in the future.This idea proposed was that the web site would consist of series of cards, each card holder just being a place for the Author's to drop components into. Each component would be a self sufficient module, with all java code existing in its jsp files. 

So my question is, is what is the best strategy for optimizing use of bundles (as in view 2).

1 Accepted Solution

Avatar

Correct answer by
Level 10
  • Keep data in repository and not in osgi bundle. 
  • Think of templating (Slightly) rather than jsp from the view point.
  • Little old video but not upto latest templating. might help http://www.youtube.com/watch?v=SNI6wr_u2a8
  • Make a good design and move global configurations to bundle & have flexibility to overide at component level also. In essence need both to create rich internet applications. The strategy depends on kind of application,requirements. 
  • with simple service-oriented component mode & platform for developing flexible and modular software do not know reason you would avoid using osgi which has both Real-time features and software runtime adaptation.  Many of you are using every day beyond the scene osgi bundle without your knowledge like
    • Health Home Care Program Monitors  
    • Commuter Bus Tracker application etc...

View solution in original post

6 Replies

Avatar

Level 10

To follow up with Sham's answer -

Most web applications have backed processes doing the heavy crunching/processing and a thinner client. Be it a J2EE application, or a Spring Java app, most developers still employ back-end Java classes to do the job of processing data. In AEM, its really no different. A bundle is only a JAR with a MF file.   

Avatar

Correct answer by
Level 10
  • Keep data in repository and not in osgi bundle. 
  • Think of templating (Slightly) rather than jsp from the view point.
  • Little old video but not upto latest templating. might help http://www.youtube.com/watch?v=SNI6wr_u2a8
  • Make a good design and move global configurations to bundle & have flexibility to overide at component level also. In essence need both to create rich internet applications. The strategy depends on kind of application,requirements. 
  • with simple service-oriented component mode & platform for developing flexible and modular software do not know reason you would avoid using osgi which has both Real-time features and software runtime adaptation.  Many of you are using every day beyond the scene osgi bundle without your knowledge like
    • Health Home Care Program Monitors  
    • Commuter Bus Tracker application etc...

Avatar

Level 6

Thank you for your reply.

 

You have given me clarity on the issue.

Avatar

Level 6

If I have a class in my bundle that fetches data via a web Api as an XML string and I parse the string to create a list of Objects (The objects being a Model Class of each entity) , would that mean that I am breaking the advice of 

  • Keep data in repository and not in osgi bundle. 

Avatar

Level 10

Clive Stewart wrote...

If I have a class in my bundle that fetches data via a web Api as an XML string and I parse the string to create a list of Objects (The objects being a Model Class of each entity) , would that mean that I am breaking the advice of 

  • Keep data in repository and not in osgi bundle. 

 

it should be fine for external integration & not frequently accessed.