Ad Code

Tuesday, February 20, 2018

cq:template and cq:templatePath Properties of a Component in AEM

Hello Everyone,

I am a strong believer of “The more we explore, the more we learn” and today when i came to  know about the following properties of a component
I was a bit surprised why i have not gone through this previously.

So In this blog, we will talk about two properties of a components which are cq:template and cq:templatePath.
cq:template: This is a node having cq:template name of type nt:unstructured inside a
component. The use case for this property can be if you want to provide the default
values of properties of a component, then it can help you out.
cq:template node can have multiple properties and even other nodes as a children in case if you need to aggregate some of the properties (i.e., name = ./name/title).This content will be used as default values whenever you drop a new instance of the component from the sidekick.

Fig-Configure cq:template in a component
cq:templatePath: This property is of type string. If you want to share the same default values across multiple components, you can create a node with any name, put all the properties there and add the path of that node as a value in the cq:templatePath property.It works exactly like cq:template but with the help of cq:templatePath, the same values can be shared across multiple components.


Fig-Add configurationPath as the value of cq:templatePath property of the component

How these properties work?
When an author drops the component, the component fetches all the values from its templatePath or cq:template node and store them in the /content hierarchy of that component. When author opens the dialog, the values can be seen there. If the author wants to change, he/she can also do that.
Use Case: The use case of these properties can be if you have one style tab in a component where you decide font size, color, font-family ( something like theme), you can set the initial default theme of a component.

Demonstration Video on cq:template and cq:templatePath Properties of a Component:


If you have any query or suggestion then kindly comment or mail us at sgaem.blog02@gmail.com

Hope it will help you guys !!
Thanks and Happy Learning.

Sunday, February 18, 2018

Debugging and Vault Configuration in IntellijIdea and Eclipse in AEM

If you love life, don’t waste time.For time is what life is made of.

Being a developer, I always believe to use the automated things in place of manual, because I am a strong believer of smart work, but not hard work.

Today in this blog we will discuss some of the ways that saves us to do the following work manually.
  • Debug java code using debugger
  • Sync Data (The data sync between CRX and File System)

In AEM Development, People mostly use two IDE's for development intellijIdea and Eclipse. So in this blog, I am going to cover the above points using both IDE’s.

Debugging JAVA Code in AEM

We need a write a big java code to support backend. How cool is that if we could debug each and every line at any point and find out what is happening.To put loggers can be a lengthy process.

So how to debug java code....
1. Start your aem jar in debug mode.

java -jar cq-author-4502.jar -fork -forkargs -- -Xdebug -Xrunjdwp:transport=dt_socket,address=59865,suspend=n,server=y -Xmx1520m -XX:MaxPermSize=512m -XX:-UseSplitVerifier

Note: In place of “cq-author-4502.jar” you need to put your jar name.
In IntellijIdea,

1. Go to Run-> Edit Configurations.
2. Click on “+” and choose Remote.
Fig : Choose Remote from the Edit Cofiguration
3. Add Name(Optional) and Port defined as socket address in command.You can change the socket address at both places if you want to.
Fig : Debug Configurations in IntellijIdea
That’s all you need to configure.

Now to start debugging , Go to Run-> Debug-> Choose your configuration. This will start your IDE in debug mode. Now put breakpoints and debug the code.

In Eclipse
Go to Run->Debug Configurations->Remote Java Application

Fig : Debug Configurations in Eclipse
Configure the above options and click on apply.

VLT Plugin to Sync data with CRX

Configure IntelliVault: The IntellijIdea Plugin
IntelliVault is not by default available in IntellijIdea. It is a plugin you need to install in your IDE.
1. Go to File->Settings-> Plugins.
2. Search for IntelliVault. Click on search in repositories.
3. Now install the plugin in IDE.and restart IntellijIdea.

Fig : Install IntelliVault Plugin

Fig : Configure IntelliVault

Fig : Pull/Push data from/to CRX using IntelliVault
This is how, you can push/pull data from/to CRX.


Note: Sometimes syncing doesn’t work even after these configurations. I noticed this issue in windows. So, to resolve this issue:
1. Go to intellijidea icon, right click and choose properties.
2. In the Start In, copy your intellijidea path :C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.4\bin.(Copy yours)
Fig: Configuration in IntellijIdea Properties
3. Click on apply and then ok.
4. Now you will be able to use Vault plugin successfully.

Configure VaultClipse: The Eclipse Plugin

If we directly go and install VaultClipse plugin, our vault plugin won't work because vault plugin require eclipse 2.0 UI style plugin update to display in eclipse UI.

How to install eclipse 2.0 UI style plugin:

1. Go to help->Install new Software
2. In the work with drop down select  “http://download.eclipse.org/eclipse/updates/4.5”.

Fig : Install Eclipse 2.0 UI Style Plugin
   3. Now go to Eclipse Tests,tools,Examples and Extras and choose Eclipse 2.0 Style Plugin Support.
4. Install this software and restart the eclipse to see the changes.

Install VaultClipse Plugin

  1. Go to Help-> Eclipse MarketPlace and Search for VaultClipse plugin.
Fig : Install VaultClipse Plugin
2. Install VaultClipse software and restart the eclipse to see the changes.

To configure the VaultClipse, Go to

         a. Go to Window-> Preferences
b. Choose VaultClipse and Configure the Vault plugin
c. Configure Vault Plugin Configurations and now you can import and export content.

Note: In eclipse, I am trying to configure vaultClipse, but when I try to configure vault Configurations, it is giving me this error.



Fig : Error while configuring the VaultClipse

If you are able to run it on your system, please comment and share the solution with me as well.

Demonstartion Video on Debugging and Vault Configuration:

If you have any query or suggestion then kindly comment or mail us at sgaem.blog02@gmail.com

Hope it will help you guys !!
Thanks and Happy Learning.