Creating an Adobe CQ web application that uses MySQL

- Scott Macdonald

You can create an Adobe CQ web application that performs database operations on a relational database. For example, you can create an Adobe CQ web application that retrieves data from MySQL and displays the data in a JSP. The following illustration shows data being retrieved from a relational database and displayed in a JSP.

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).

The OSGi component that is created in this development article contains Java JDBC application logic that retrieves data from MySQL. (This OSGi component corresponds to the JDBC Java code shown in the previous illustration.) To keep this article simple, the MySQL database is named bank and contains a single table named user. The user table contains two fields named id and name. This development article guides you through how to create an Adobe CQ application that displays data located in the user table in a JSP.

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

Read the complete blog post at Scott's Digital Community.

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.

Integrating the JQuery Framework into DAY CQ

- Scott McDonald

You can integrate the JQuery Framework into DAY CQ (5.4) thereby enabling you to build components that take advantage of the JQuery framework. The JQuery framework is a popular JavaScript library that simplifies the creation of powerful components. For example, you can build components that contain visual effects, data grids that display information, user forms that capture information from end users, and so on. For more information about JQuery, see www.jquery.com.

The component that is created in this development article renders text and uses a JQuery fade effect. That is, the text becomes visible over a period of five seconds. The objective of this article is not to demonstrate how to create a complex JQeury effect, but rather guide you through the process of creating a CQ page and then how to make use of the JQuery framework.

NOTE: Before following along with this development article, make sure that you install DAY CQ 5.4 and have it running. Also, make sure that you have CRXDE, which is the development environment.

To create a DAY CQ page that uses the JQuery framework, perform the following tasks:

  1. Create a CQ 5.4 application that contains the page that displays the JQuery fade effect. 
  2. Create a template on which the component that uses JQuery is based.
  3. Create a render component that uses the template.
  4. Add the JQuery framework to the component.
  5. Modify the component to use JQuery application logic.
  6. Create a site that contains a page that displays the component that contains a JQuery effect.

Create a CQ 5.4 application

You can create a DAY CQ application that contains templates, components, and pages. Before you create application assets such as templates, components, and pages, you create an application, which is essentially a specific folder structure. You can create this folder by using CRXDE Lite.

The following illustration shows a typical application folder structure  .

...
--------------
Read the full post at this URL.

Programmatically Accessing Adobe CQ Content using the JCR API

- Scott McDonald

You can programmatically modify nodes and properties located within the Adobe CQ 5.5 repository, which is part of the Adobe Digital Marketing Suite. To access the CQ repository, you use the Java Content Repository (JCR) API. You can use the Java JCR API to perform create, replace, update, and delete (CRUD) operations on content located within the DAY CQ repository. For more information about the Java JCR API, see http://jackrabbit.apache.org/jcr-api.html.

This development article creates a Java class that modifies nodes and properties within  Adobe CQ. The Java class connects to a local instance of  Adobe CQ and creates nodes and stores data values to node properties. You can store data by manipulating node properties.

...

-------

Read the full article at this URL.