Developing with CRXDE Lite

You are reading the AEM 6.2 version of Developing with CRXDE Lite.
This documentation is also available for the following versions:  AEM 6.3  AEM 6.1  AEM 6.0  AEM 5.6.1  AEM 5.6  CQ 5.5 

This section describes how to develop your AEM application using CRXDE Lite.

Please refer to the overview documentation for more information on the different development environments that are available.

CRXDE Lite is embedded into AEM and enables you to perform standard development tasks in the browser. With CRXDE Lite, you can create a project, create and edit files (like .jsp and .java), folders, templates, components, dialogs, nodes, properties and bundles while logging and integrating with SVN.
CRXDE Lite is recommended when you do not have direct access to the AEM server, when you develop an application by extending or modifying the out-of-the-box components and Java bundles or when you do not need a dedicated debugger, code completion and syntax highlighting.

Note

By default, all AEM users can access CRXDE Lite. If desired, configure ACLs for the following node so that only developers can access CRX DE Lite:

/libs/granite/crxde

Note

It is recommended to use the AEM Developer Tools for Eclipse and the AEM HTL Brackets Extension during project development.

Getting Started with CRXDE Lite

To get started with CRXDE Lite, proceed as follows:

  1. Install AEM.
  2. In your browser, enter http://<host>:<port>/crx/de. By default it is http://localhost:4502/crx/de.
  3. Enter your username and password. By default it is admin and admin.
  4. Click OK.

The CRXDE Lite User Interface looks as follows in your browser:

file

You can now use CRXDE Lite to develop your application.

Overview of the User Interface

CRXDE Lite offers the following functionality:

Top switcher bar Allows you to quickly switch between CRXDE Lite, Package Manager, and Package Share.  
Node path widget

Displays the path to the currently selected node.

You can also use it to jump to a node, by entering the path by hand, or pasting it from somewhere else, and hitting Enter.

It also provides support for looking for nodes with specific node name. Enter the name of the node you would like to find, and wait (or hit the search symbol on the right-hand side). You can try entering, e.g., the string oak into the widget to see how it works. If a given node or nodes is loaded into the explorer pane, the list will be displayed, and you can select the path and hit Enter to navigate to it. Note that it only works for the nodes currently loaded into the CRXDE client application in browser. If you want to search the whole repository, use Tools, then Query.

 
Explorer pane

Displays a tree of all the nodes in the repository.

Click a node to display its properties in the Properties tab. After clicking a node, you can select an action in the toolbar. Click the node again to rename it.

Tree Navigation Filter (binocular icon): enables you to filter the nodes in the repository for which the name contains the input text. It only applies to nodes that have been loaded locally.

 
Edit pane

Home tab: lets you search content and/or documentation and access developer resources (documentation, developer blog, knowledge base) and support (Adobe homepage and support center).

Double-click a file in the Explorer pane to display its content; like for example a .jsp or a .java file. You can then modify it and save the changes.

Once a file is edited in the Edit pane, the following tools are available on the toolbar:

- Show in tree: shows the file in the repository tree.
- Search/Replace ...: do search or replace.

Double-click on the status line of the Edit pane opens the Go to line dialog so you can enter a specific line number to go to.
 
Properties tab
Displays the properties of the node that you have selected. You can add new properties or delete existing ones.
 
Access Control tab

Display permissions based on current path, repository-level or principal.

The permissions are broken down into

- Applicable Access Control Policy: The policies that can be applied to the current selection.

- Local Access Control Policies: The current policies applied locally to the current selection.

- Effective Access Control Policies: The current policies applied for the current selection, might be set locally or inherited from parent nodes.

Note. To be able to see the Access Control information at all, the user logged in to CRXDE Lite must have rights to read ACL entries. The anonymous user cannot see this information by default - please log in as, e.g., admin to see the information.

 
Replication tab

Display the replication status of current node. You can replicate and replicate delete the current node.

 
Console tab

Server Logs:

Displays logs messages. You can configure the log level, clear the console, pin at the selected scroll position and enable/disable the displaying of messages.

Version Control:

Displays version control messages.

 
Build Info tab
Displays information when a bundle is being built.
 
Refresh
Refreshes the current selection. Changes from other users are updated in your view of the repository. Changes you have made are unaffected.
 
Save All

Save All:

Saves all the changes you have made. Until you click save, the changes are temporary, and will be lost when you exit the console.

Revert:

Discards all the changes that you have made on the selected node since the last save action, then reloads the current state of the repository for the selected node.

Revert All:

Discards all the changes that you have made throughout the entire repository since the last save action, then reloads the current state of the repository.

 
Create ...

Drop-down menu to create the following under the selected node:

- Node: a node with an arbitrary node type

- File: nt:file node and its nt:resource subnode

- Folder: nt:folder node

- Template: AEM template

- Component: AEM component

- Dialog: AEM dialog

 
Delete
Deletes the selected node.
 
Copy Copies the selected node.
 
Paste
Pastes the copied node under the selected node.
 
Move ...
Moves the selected node to the node that is set through the dialog.  
Rename ...
Renames the selected node.
 
Mixins ...
Allows you to add mixin types to the node type. The mixin types are mostly used to add advanced features such as versioning, access control, referencing, and locking to the node.  
Team

Drop-down menu to perform standard version control tasks:

- Update repository from SVN server

- Commit local changes to SVN server

- View Status of the current node

- View Recursive Status of the subtree of the current node

- Checkout a working copy from SVN server

- Export a project from SVN server (without creating a working copy)

- Import a project from repository to SVN server

Note you need to be logged in as user with sufficient permissions to be able to execute some of the tasks (especially the ones that write to the local repository).

 
Tools

Drop-down menu with the following tools:

- Server Config ...: to access the Felix Console.

- Query ...: to query the repository.

- Privileges ...: to open privilege management, where you can view and add privileges.

- Test Access Control ...: a place where you can test the permission for certain path and/or principal.

- Export Node Type: to export node types in the system as cnd notation.

- Import Node Type ...: to import node types using cnd notation.

- Import Site ...: opens the Site Importer tool to import an existing site into AEM

- Install SiteCatalyst Debugger ...: instructions on how to install Analytics Debugger.

 
Login widget

Displays the currently logged-in users and the workspace they are logged into, e.g., admin@crx.default.

Click it to log in or re-login as a specific user. If you don't specify a workspace to log in to, you will be logged into the default workspace, crx.default.

If you want to browse the repository as Anonymous user, use anonymous as the login name, and any password (e.g., a space or a dot).

If your authorization is no longer valid (e.g., it is expired), the login widget displays "Unauthorized - Login...". Click it to log in again.

 

Creating a Project

With CRXDE Lite you can create a working project in three clicks. The project wizard creates a new project under /apps, some content under /content and a package wrapping all the project the content under /etc/packages. The project can be used right away to render a sample page displaying Hello World, based on a jsp script that renders a property from the repository and calls a Java class to render some text.

To create a project with CRXDE Lite:

  1. Open CRXDE Lite in your browser.
  2. In the Navigation pane, right-click a node, select Create ..., then Create Project ....
    Note: you can right-click any node in the tree navigation, as the new project nodes are, by design, created below /apps, /content and /etc/packages.
  3. Define:
    • Project Name - the project name is used to create the new nodes and the bundle, e.g. myproject.
    • Java Package - the Java package name prefix, e.g. com.mycompany.
  4. Click Create.
  5. Click Save All to save the changes on the server.

To access the sample page displaying Hello World, point your browser to:

http://localhost:4502/content/<project-name>.html

The Hello World page is based on a content node, that calls a jsp script through the sling:resourceType property. The script reads the jcr:title property from the repository and gets the body content by calling a method of the SampleUtil class, that is available in the project bundle.

The following nodes are created:

  • /apps/<project-name>: the application container.
  • /apps/<project-name>/components: the components container, containing the sample html.jsp file, used to render a page.
  • /apps/<project-name>/src: the bundles container, containing a sample project bundle.
  • /apps/<project-name>/install: the compiled bundles container, containing the compiled sample project bundle.
  • /content/<project-name>: the content container.
  • /etc/packages/<java-suffix>/<project-name>.zip, a package wrapping all the project app and content. You can use it to rebuild the project for further deployment (e.g. to other environments) or for sharing through Package Share.

The structure looks as follows in CRXDE Lite with a project called myproject and a java package suffix called mycompany:

file
file

Creating a Folder

To create a folder with CRXDE Lite:

  1. Open CRXDE Lite in your browser.
  2. In the Navigation pane, right-click the folder under which you want to create the new folder, select Create ..., then Create Folder ....
  3. Enter the folder Name and click OK.
  4. Click Save All to save the changes on the server.

Creating a Template

To create a template with CRXDE Lite:

  1. Open CRXDE Lite in your browser.
  2. In the Navigation pane, right-click the folder where you want to create the template, select Create ..., then Create Template ....
  3. Enter the Label, Title, Description, Resource Type and Ranking of the template. Click Next.
  4. This step is optional: set the Allowed Paths. Click Next
  5. This step is optional: set the Allowed Parents. Click Next.
  6. This step is optional: set the Allowed Children. Click OK.
  7. Click Save All to save the changes on the server.

It creates:

  • A node of type cq:Template with Template properties
  • A child node of type cq:PageContent with Page Content properties

You can add properties to your template: refer to the Creating a Property section.

Creating a Component

The feature described here is only available if CQ5 is installed, that is if the node type cq:Component is available in the repository.

To create a component with CRXDE Lite:

  1. Open CRXDE Lite in your browser.
  2. In the Navigation pane, right-click the folder where you want to create the component, select Create ..., then Create Component ....
  3. Enter the Label, Title, Description, Super Resource Type and Group of the component. Click Next.
  4. This step is optional: set the component properties Is Container, No Decoration, Cell Name and Dialog Path. Click Next.
  5. This step is optional: set the component property Allowed Parents. Click Next.
  6. This step is optional: set the component property Allowed Children. Click OK.
  7. Click Save All to save the changes on the server.

It creates:

  • A node of type cq:Component
  • Component properties
  • A component .jsp script

Creating a Dialog

To create a dialog with CRXDE Lite:

  1. Open CRXDE Lite in your browser.
  2. In the Navigation pane, right-click the component where you want to create the dialog, select Create ..., then Create Dialog ....
  3. Enter the Label and the Title. Click OK.
  4. Click Save All to save the changes on the server.

It creates a dialog with the following structure:

dialog[cq:Dialog]/items[cq:Widget]/items[cq:WidgetCollection]/tab1[cq:Panel]

You can now adapt the dialog to your needs by modifying properties or creating new nodes.

You can also use the Dialog Editor to edit a dialog. Double clicking the dialog node in CRXDE Lite will bring up the editor. More information about the Dialog Editor can be found here.

Creating a Node

To create a node with CRXDE Lite:

  1. Open CRXDE Lite in your browser.
  2. In the Navigation pane, right-click the node where you want to create the new node, select Create ..., then Create Node ....
  3. Enter the Name and the Type. Click OK.
  4. Click Save All to save the changes on the server.

You can now adapt the node to your needs by modifying properties or creating new nodes.

Note

Most of the edit operations, including Create Node, keeps all the changes in memory, and only stores them into the repository upon saving (via the "Save All" button).

The validation with regard to whether the newly created node is allowed by the node type of the parent node is also carried out by the JCR repository first when saving changes. If you receive an error message while saving a node, please check, whether the content structure is valid (e.g., you cannot create an nt:unstructured node as a child of nt:folder node).

Creating a Property

To create a property with CRXDE Lite:

  1. Open CRXDE Lite in your browser.
  2. In the Navigation pane, select the node where you want to add the new property.
  3. In the Properties tab in the bottom pane, enter the Name, the Type and the Value. Click Add.
  4. Click Save All to save the changes on the server.

Creating a Script

To create a new script:

  1. Open CRXDE Lite in your browser.
  2. In the Navigation pane, right-click the component where you want to create the script, select Create ..., then Create File ....
  3. Enter the File Name including its extension. Click OK.
  4. The new file opens as a tab in the Edit pane.
  5. Edit the file.
  6. Click Save All to save the changes.

Managing a Bundle

With CRXDE Lite, it is straightforward to create an OSGI bundle, add Java classes to it, and build it. The bundle is then automatically installed and started in the OSGI container.

This section describes how to create a Test bundle with a HelloWorld Java class that displays Hello World! in your browser when the resource is requested.

Creating a Bundle

To create the Test bundle with CRXDE Lite:

  1. In CRXDE Lite create myapp project with the project wizard. Among others the following nodes are created:
    • /apps/myapp/src
    • /apps/myapp/install
  2. Right-click the folder /apps/myapp/src that will contain the Test bundle, select Create ..., then Create Bundle ....
  3. Set the bundle properties as follows:
    • Symbolic Bundle Name: com.mycompany.test.TestBundle
    • Bundle Name: Test Bundle
    • Bundle Description: This is my Test Bundle
    • Package: com.mycompany.test
    Click OK.
  4. Click Save All to save the changes on the server.

The wizard creates the following elements:

  • The node com.mycompany.test.TestBundle of type nt:folder. It is the bundle container node.
  • The file com.mycompany.test.TestBundle.bnd.  It acts as deployment descriptor for your bundle and consists of a set of headers.
  • The folder structures:
    • src/main/java/com/mycompany/test. It will contain the packages and the Java classes.
    • src/main/resources. It will contain the resources used within the bundle.
  • The Activator.java file. It is the optional listener class to be notified of bundle start and stop events.

The following table lists all the properties of the .bnd file, their values and descriptions:

Property Value (at bundle creation)
Description
Export-Package:

*

Note: this value needs to be adapted to reflect the specificity of the bundle.

The Export-Package header defines exported packages from the bundle (comma-separated list of packages). The exported packages constitute the public
view of the bundle.
Import-Package:

*

Note: this value needs to be adapted to reflect the specificity of the bundle.

The Import-Package header defines imported packages for the bundle (comma-separated list of packages)
Private-Package:

*

Note: this value needs to be adapted to reflect the specificity of the bundle.

The Private-Package header defines private packages for the bundle (comma-separated list of packages). The private packages constitute the internal implementation.
Bundle-Name: Test Bundle Defines a short, human-readable name for the bundle
Bundle-Description: This is my Test Bundle Defines a short, human-readable description for the bundle
Bundle-SymbolicName: com.mycompany.test.TestBundle Specifies a unique, non-localizable name for the bundle
Bundle-Version: 1.0.0-SNAPSHOT Specifies the version of the bundle
Bundle-Activator: com.mycompany.test.Activator Specifies the name of the optional listener class to be notified of bundle start and stop events

For more information on the bnd format, refer to the bnd utility used by CRXDE to create OSGI bundles.

Creating a Java Class

To create the HelloWorld Java class within the Test Bundle:

  1. Open CRXDE Lite in your browser.
  2. In the Navigation pane, right-click the node containing the Activator.java file (/apps/myapp/src/com.mycompany.test.TestBundle/src/main/java), select Create ..., then Create File ....
  3. Name the file HelloWorld.java. Click OK.
  4. The HelloWorld.java file opens in the Edit pane.
  5. Add the following lines into HelloWorld.java:
    package com.mycompany.test;

    public class HelloWorld {
        public String getString(){
        return "Hello World!";
        }
    }
  6. Click Save All to save the changes on the server.

Building a Bundle

To build the Test Bundle:

  1. Open CRXDE Lite in your browser.
  2. In the Navigation pane, right-click the .bnd file, select Tools, then Bundle.

The Build Bundle wizard:

  • Compiles the Java classes.
  • Creates the .jar file containing the compiled Java classes and the resources and places it into the myapp/install folder.
  • Installs and starts the bundle in the OSGI container.

To see the effect of the Test Bundle, create a component that uses the Java method HelloWorld.getString() and a resource that is rendered by this component:

  1. Create the component mycomp under myapp/components.
  2. Edit mycomp.jsp and replace the code with the following lines:
    <%@ page import="com.mycompany.test.HelloWorld"%><%
    %><%@ include file="/libs/foundation/global.jsp"%><%
    %><% HelloWorld hello = new HelloWorld();%><%
    %>
    <html>
    <body>
    <b><%= hello.getString() %></b><br>
    </body>
    </html>
  3. Create the resource test_node of type nt:unstructured under /content.
  4. For test_node, create the following property: Name = sling:resourceType, Type = String, Value = myapp/components/mycomp.
  5. Click Save All to save the changes on the server.
  6. In your browser, request test_node: http://<hostname>:<port>/content/test_node.html.
  7. A page is displayed with the Hello World! message.

Exporting and Importing Node Types

With CRXDE Lite you can import and/or export node type definitions in CND (Compact Namespace and Node Type Definition) notation.

To export a node type definition:

  1. Open CRXDE Lite in your browser.
  2. Select your required node.
  3. Select Tools then Export Node Type.
  4. The definition, in cnd notation will be displayed in your browser. Save the information if required.

To import a node type definition:

  1. Open CRXDE Lite in your browser.
  2. Select Tools then Import Node Type....
  3. Enter the CND notation for the definition n the text box.
  4. Check Allow Update if you are updating an existing definition.
  5. Click Import.

Logging

With CRXDE Lite you can display the file error.log that is located on the file system at <crx-install-dir>/crx-quickstart/server/logs and filter it with the appropriate log level. Proceed as follows:

  1. Open CRXDE Lite in your browser.
  2. In the Console tab at the bottom of the window, in the drop-down menu on the right, select Server Logs.
  3. Click the Stop icon to display the messages.

You can:

  • Adjust the log parameters in the Felix Console by clicking the Logging Configurations icon.
  • Clear the messages by clicking the Brush icon.
  • Pin the message at the current selection by clicking the Pin icon.
  • Enable or disable the displaying of messages by clicking the Stop icon.

Access Control

Note

Any questions?

Have a question about this or any other AEM topic? Ask our Community.
Learn more about AEM topics on our help hub.
Was this helpful?

By submitting your feedback, you accept the Adobe Terms of Use.

Thank you for submitting your feedback.