Creating OSGi bundles for the Adobe Digital Marketing Suite using CRXDE

- Scott McDonald, Senior Content and Community Lead - Adobe Digital Marketing

You can create an OSGi bundle that can be used within the Adobe Digital Marketing Suite by using CDXDE. An OSGi bundle is essentially a Java module that contains application logic that meets your business requirements. An OSGi bundle lets you dynamically load, unload, configure, and control the Java module without restarting the server. CRXDE is the IDE that lets you develop applications for Adobe CQ (part of the Adobe Digital Marketing Suite).

An OSGi bundle can use third-party JAR files. That is, classes located within a third-party JAR file can be used within an OSGi bundle. To demonstrate how to create an OSGi bindle that uses a third-party JAR file, this development article uses a third-party JAR file and EchoService.jar. This JAR file contains the following basic Java class named EchoService2.

package com.adobe.myexample;
public class EchoService2 {
    
    public String sayHello(String val){
        
        return "Echo Service says: " +val ;
    }
}

Note: Before following along with this development article, install Adobe CQ 5.5 and have it running. Also, ensure that you have CRXDE, which is the development environment. Finally create a JAR file named EchoService.jar and ensure that it contains the EchoService2 class shown above. 

The objective of this article is to demonstrate how to create an Adobe CQ project that uses an OSGi bundle. The OSGi bundle uses the EchoService.jar file and makes use of the EchoService2 class. To create an Adobe CQ project that uses an OSGi bundle, perform the following tasks:

  1. Create an Adobe CQ 5.5 application that contains the page that displays results from the OSGi bundle.
  2. Create a template on which the page component is based.
  3. Create a render component that uses the template.
  4. Create the OSGi bundle that uses the EchoService JAR file.
  5. Modify the JSP to call a Java method defined in the OSGi bundle.
  6. Create a new site that contains a page that displays content from the OSGi bundle.

....

--------------

Read the full post at Scott's Digital Community.

Comments are closed.


Copyright © 2012 Adobe Systems Incorporated. All rights reserved.
Terms of Use | Privacy Policy and Cookies (Updated)