Featured

Wednesday 30 December 2015

Instagram feed component in cq5

        For this, You can create a custom Adobe CQ data feed component that retrieves external data and displays the data within a CQ web page. For example, a CQ component can retrieve data from an Instagram feed to let your users view current forum data. Likewise, a CQ component can retrieve data from a social site like Twitter to keep your users updated with the latest social data.

Here we are creating a custom component that can show the Instagram feed data :

       Once added to the CQ sidekick, a CQ author can drag and drop it onto a CQ page during design time. You create a Twitter feed component by integrating the Twitter API into Adobe CQ (shown in this development article).
Create a CQ component that integrates with the Twitter API by performing these steps:
  1. Create an Adobe CQ application folder structure.
  2. Create a template on which the render component is based.
  3. Create a render component that displays the CQ sidekick.
  4. Get the Instagram widget code to use in your AEM application.
  5. Create a site that contains a page that displays Instagram data.
Here is the dialog for the custom Instagram feed component.

Dialog for Instagram feed component
Dialog for Instagram feed component in cq5


          After adding a dialog , we need to define the jsp file for it. And in that we can use a script as follows to generate the feed. This feed can be generated by using the userid and accessToken provide by the user.

Here is the script, (this will fetch the data by using the instafeed.min.js which is shared by the instagram itself)

<script type="text/javascript">
      var userFeed = new Instafeed({
                     get: 'user',
                     userId: 'xxxxxxxx',
                     accessToken: 'xxxxxxxxx.xxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
      });
      userFeed.run();
</script>

By this we can get output as a JSON file as follows,

json file for instagram feed
JSON file for instagram feed



By looping the JSON file we can retrieve the exact content that should be shown on page(Name, date, comment, image etc..).

So finally, we can loop the data as per the requirement. Once you got the JSON file means you are succeeded in getting the feed data, so play with it.

Hope it helps :)
Thanks,
SonyCharan


Creating a maven project in cq5

Here we are Setting up only project structure for CQ/AEM project using maven and development of AEM/CQ project with eclipse.

Configuring AEM Maven Archetype for Eclipse can be done by installing and adding AEM plugin to the existing eclipse IDE,

The manual setup for the Maven is as follows


PREREQUISITES TO SETUP

     To set up a development environment based on Maven the following software must be installed before starting:

  •      Apache Maven 3.0.4 or higher
  •      Oracle Java SE 1.5.x or higher
  •      CQ5.5, AEM 5.6 or higher

Now follow these defined steps,

Create the initial structure from Adobe's multimodule-content-package-archetype

In your shell, go to a directory where your project is supposed to be created.

In the following example, line breaks are only to make reading simpler. Everything goes on one line.

$ mvn 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 -DgroupId=my-group-id -DartifactId=myproject -Dversion=1.0-SNAPSHOT -Dpackage=com.mycompany.myproject -DappsFolderName=myproject -DartifactName="My Project" -DcqVersion="5.6.1" -DpackageGroup="My Company"

Confirm the provided values by entering "Y" and hitting Return when Maven asks.

Confirm properties configuration:

  • groupId: my-group-id
  • artifactId: myproject
  • version: 1.0-SNAPSHOT
  • package: com.mycompany.myproject
  • appsFolderName: myproject
  • artifactName: My Project
  • cqVersion: 5.6.1
  • packageGroup: My Company
  •  Y: :
Now ,

Maven has created a directory for the project. Change into it:

       # cd myproject

Now build the project and install it into your AEM instance.

       # mvn -PautoInstallPackage install

By the above procedure, it should create different XML files for the project and content.

The archetype has created the following project definition for us.

myproject/pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <!-- ====================================================================== -->
    <!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
    <!-- ====================================================================== -->

    <groupId>my-group-id</groupId>
    <artifactId>myproject</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <name>My Project - Reactor Project</name>
    <description>Maven Multimodule project for My Project.</description>

    <prerequisites>
        <maven>3.0.2</maven>
    </prerequisites>

    <!-- ====================================================================== -->
    <!-- P R O P E R T I E S -->
    <!-- ====================================================================== -->
    <properties>
        <crx.host>localhost</crx.host>
        <crx.port>4502</crx.port>
        <crx.username>admin</crx.username>
        <crx.password>admin</crx.password>
        <publish.crx.host>localhost</publish.crx.host>
        <publish.crx.port>4503</publish.crx.port>
        <publish.crx.username>admin</publish.crx.username>
        <publish.crx.password>admin</publish.crx.password>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.core</artifactId>
                <version>4.2.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.osgi</groupId>
                <artifactId>org.osgi.compendium</artifactId>
                <version>4.2.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.felix</groupId>
                <artifactId>org.apache.felix.scr.annotations</artifactId>
                <version>1.6.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>biz.aQute</groupId>
                <artifactId>bndlib</artifactId>
                <version>1.43.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.5.10</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
                <version>2.5</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.jcr</groupId>
                <artifactId>jcr</artifactId>
                <version>2.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.api</artifactId>
                <version>2.2.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.jcr.api</artifactId>
                <version>2.1.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.8.1</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!--
        Inclusion of repositories in POMs is controversial, to say the least.
        It would be best if you proxied the Adobe repository using a Maven
        Repository Manager. Once you do that, remove these sections.
     -->
    <repositories>
        <repository>
            <id>adobe</id>
            <name>Adobe Public Repository</name>
            <url>http://repo.adobe.com/nexus/content/groups/public/</url>
            <layout>default</layout>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>adobe</id>
            <name>Adobe Public Repository</name>
            <url>http://repo.adobe.com/nexus/content/groups/public/</url>
            <layout>default</layout>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-scr-plugin</artifactId>
                    <version>1.7.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>2.3.7</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.6</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.7</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.14.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.9</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>maven-sling-plugin</artifactId>
                    <version>2.1.0</version>
                    <configuration>
                        <username>${crx.username}</username>
                        <password>${crx.password}</password>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.day.jcr.vault</groupId>
                    <artifactId>content-package-maven-plugin</artifactId>
                    <version>0.0.20</version>
                    <extensions>true</extensions>
                    <configuration>
                        <failOnError>true</failOnError>
                        <username>${crx.username}</username>
                        <password>${crx.password}</password>
                    </configuration>
                </plugin>
                <!--This plugin's configuration is used to store Eclipse
                    m2e settings only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.apache.felix
                                        </groupId>
                                        <artifactId>
                                            maven-scr-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.0.0,)
                                        </versionRange>
                                        <goals>
                                            <goal>scr</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore/>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>autoInstallBundle</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>maven-sling-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>install-bundle</id>
                                <goals>
                                    <goal>install</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
  <modules>
    <module>bundle</module>
    <module>content</module>
  </modules>
</project>

THE BUNDLE MODULE

The bundle module is set up to contain OSGi Services required in your project.

Note that depending on the complexity of your project, you may want to refine this setup and create separate modules for individual areas of your project. For example, it is common to have a separate bundle for the project specific tag library, and to separate infrastrutural components (loggers, filters, login modules, etc) from business components (workflow steps, live action factories, content builders and transport handlers, etc).

The following structure has been created by the Maven archetype.

+-- pom.xml
+-- src
    +-- main
    ¦   +-- java
    ¦       +-- com
    ¦           +-- mycompany
    ¦               +-- myproject
    ¦                   +-- HelloService.java
    ¦                   +-- impl
    ¦                   ¦   +-- HelloServiceImpl.java
    ¦                   ¦   +-- filters
    ¦                   ¦       +-- LoggingFilter.java
    ¦                   +-- package-info.java
    +-- test
        +-- java
            +-- com
                +-- mycompany
                    +-- myproject
                        +-- SimpleUnitTest.java


Below is the Bundle POM file generated by the Maven archetype.

myproject/bundle/pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
    <modelVersion>4.0.0</modelVersion>
    <!-- ====================================================================== -->
    <!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
    <!-- ====================================================================== -->
    <parent>
        <groupId>my-group-id</groupId>
        <artifactId>myproject</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <!-- ====================================================================== -->
    <!-- P R O J E C T D E S C R I P T I O N -->
    <!-- ====================================================================== -->

    <artifactId>myproject-bundle</artifactId>
    <packaging>bundle</packaging>
    <name>My Project Bundle</name>

    <dependencies>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.scr.annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>biz.aQute</groupId>
            <artifactId>bndlib</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.jcr</groupId>
            <artifactId>jcr</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.jcr.api</artifactId>
        </dependency>
    </dependencies>

    <!-- ====================================================================== -->
    <!-- B U I L D D E F I N I T I O N -->
    <!-- ====================================================================== -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-scr-descriptor</id>
                        <goals>
                            <goal>scr</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>my-group-id.myproject-bundle</Bundle-SymbolicName>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.sling</groupId>
                <artifactId>maven-sling-plugin</artifactId>
                <configuration>
                    <slingUrl>http://${crx.host}:${crx.port}/apps/myproject/install</slingUrl>
                    <usePut>true</usePut>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                 <configuration>
                    <excludePackageNames>
                        *.impl
                    </excludePackageNames>
                 </configuration>
            </plugin>
        </plugins>
    </build>
</project>

THE CONTENT MODULE

The content module is set up to build an AEM content package which combines

components
templates
configurations
sample content
the OSGi bundle that is built by the bundle module
The archetype provides the structure below. As you can see, it deviates a little from a standard Maven Java module as there are no Java sources in the context of a content module. Accordingly, the module contains a directory src/main/content.

+-- pom.xml
+-- src
    +-- main
        +-- content
            +-- META-INF
            ¦   +-- vault
            ¦       +-- config.xml
            ¦       +-- definition
            ¦       ¦   +-- .content.xml
            ¦       +-- filter.xml
            ¦       +-- nodetypes.cnd
            ¦       +-- properties.xml
            +-- jcr_root
                +-- apps
                    +-- myproject
                        +-- config
                        ¦   +-- put-your-configs-here.txt
                        +-- install
                            +-- .vltignore
                            +-- bundle-will-go-here.txt


The POM generated by the archetype has a couple of noteworthy points.

The content-package-maven-plugin is configured to embed the OSGi bundle at /apps/myproject/install, (where Apache Sling's JCR Installer Provider will pick it up and install it with the OSGi Installer)
It is also configured to install the package at the host and port configured in the parent pom
By default, the content-package-maven-plugin uses the project's resources definition.
Depending on your other development tools, you may want to exclude more files, such as .git, .project etc.
A profile autoInstallPackage is defined, which binds the content-package-maven-plugin's install goal to Maven's install phase. This profile allows you to automatically install the package to AEM after it has been built.
A profile autoInstallPackagePublish is defined, which does the same for a publish server

myproject/content/pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <!-- ====================================================================== -->
    <!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
    <!-- ====================================================================== -->
    <parent>
        <groupId>my-group-id</groupId>
        <artifactId>myproject</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <!-- ====================================================================== -->
    <!-- P R O J E C T D E S C R I P T I O N -->
    <!-- ====================================================================== -->

    <artifactId>myproject-content</artifactId>
    <packaging>content-package</packaging>
    <name>My Project Package</name>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>myproject-bundle</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
    <build>
        <resources>
            <resource>
                <directory>src/main/content/jcr_root</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/.vlt</exclude>
                    <exclude>**/.vltignore</exclude>
                </excludes>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <includeEmptyDirs>true</includeEmptyDirs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.day.jcr.vault</groupId>
                <artifactId>content-package-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <group>My Company</group>
                    <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
                    <embeddeds>
                        <embedded>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>myproject-bundle</artifactId>
                            <target>/apps/myproject/install</target>
                        </embedded>
                    </embeddeds>
                    <targetURL>http://${crx.host}:${crx.port}/crx/packmgr/service.jsp</targetURL>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>autoInstallPackage</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.day.jcr.vault</groupId>
                        <artifactId>content-package-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>install-content-package</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>install</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>autoInstallPackagePublish</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.day.jcr.vault</groupId>
                        <artifactId>content-package-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>install-content-package-publish</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>install</goal>
                                </goals>
                                <configuration>
                                    <targetURL>http://${publish.crx.host}:${publish.crx.port}/crx/packmgr/service.jsp</targetURL>
                                    <username>${publish.crx.username}</username>
                                    <password>${publish.crx.password}</password>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

Typical Steps in a Development Cycle

CONTENT PACKAGE DEVELOPMENT TASKS

The typical development cycle for your content package is to

  • make changes to the project, either on the filesystem or in the repository
  • run mvn -PautoInstallPackage clean install to deploy the package to the repository
  • Making Changes to the Project
You can make changes to the content/ project in two ways:

  • Make changes below content/src/main/content/jcr_root and deploy them to the repository
  • Make changes in the repository and use the vlt tool to sync them back to the filesystem

mvn -PautoInstallPackage clean install

Running mvn -PautoInstallPackage clean install will

  • build the content package according to the definition in myproject/content/pom.xml and save that package to content/target/myproject-content-1.0-SNAPSHOT.zip
  • install the package into your local maven repository (that is what Maven's "install" phase always does)
  • activate the autoInstallPackage profile of the content module, which binds the content-package-maven-plugin:install goal to the install phase and so installs the package into AEM through the Package Manager's HTTP API. See the documentation of the Content Package Maven Plugin for details.

BUNDLE DEVELOPMENT TASKS

The bundle module follows a standard Java setup, and so does the process:

  • make changes to your Java sources
  • run mvn -PautoInstallBundle install in the bundle/ directory to compile and deploy the bundle
And Further,

VLT is used to keep the file system and the repository synchronized. The basic steps for setting this up are
  • install the package to your repository
  • cd to content/src/main/content/jcr_root
  • run vlt co --force http://localhost:4502/ -- this will check out the content from the repository into your filesystem and set up vlt to keep track
  • run vlt sync install -- this will install the vlt sync service into your repository if not already available
  • run vlt sync register -- this will register this project's directory with the vlt sync service
We can setup appropriate vlt commands to keep the system up to date. For this you need to configure the XML file accordingly.


Hope it helps :)
Thanks,
SonyCharan


Friday 18 December 2015

New Features in AEM 6.1

New Features in AEM 6.1

                    Adobe Experience Manager 6.1 is an upgrade release to the Adobe Experience Manager 6.0 code base. It provides new and enhanced functionality, key customer fixes, high priority customer enhancements and general bug fixes oriented toward product stabilization. It also includes all Adobe Experience Manager 6.0 feature pack, hot fix, and service pack releases.

The list below provides an overview - while the subsequent pages list the full details.

EXPERIENCE MANAGER PLATFORM

                    The platform of Adobe Experience Manager 6.1 build on top of updated versions of the OSGi-based framework (Apache Sling and Apache Felix) and the Java Content Repository: Apache Jackrabbit Oak 1.2.

The Quickstart uses the Eclipse Jetty 9.2.9 as servlet engine.

1) Security :

                    AEM 6.1 includes a range a new and improved capabilities to maintain a secure deployment and run a secure web property. Most notable is a new Cross-Site Request Forgery (CSRF) protection, with that the server does extra checks on POST, PUT and DELETE HTTP requests from browser to avoid CSRF attacks.

Further, the 'nosamplecontent' server run mode was extended to also deploy a range of 'secure by default' best practices, that with previous releases had to be manually configured.

2) Repository :

                   Since the introduction of Apache Jackrabbit Oak with AEM 6.0 in 2014, the successor of CRX2, Adobe and the community have improved and extended a wide range of aspects.

Here a few highlights:
  • Introduce cold standby topology with TarMK for simplified disaster recovery deployments
  • Substantial search improvements, in default configuration at install/update and possibilities to tune the search performance.
  • New UI that shows slow queries and explain query execution in details, and tool to manage search index.
  • Simplified maintenance operations, adding support to purge audit logs and compaction to reclaim disk space.
  • Added option to use a relational database as repository persistence. More details
  • Note, Adobe has removed support for CRX2 with 6.1. The release update routine converts the existing CRX2 repository to Oak during the update (CRX2Oak).
3) Component Framework

                 In Version 6.0, Adobe introduced Sightly and Sling Models, as new way to develop components, in an time efficient and secure way. AEM version 6.1 delivers incremental improvements to the new approach.

New in Sightly 1.1:
  • New <sly> element as alternative to data-sly-unwrap
  • URI manipulation options (e.g. ${'http://foo.com/test.html '@ scheme='https', extension='json'} outputs https://foo.com/test.json)
  • Allow java.util.Locale objects to be used in i18n locale option
  • data-sly-repeat (alternative to data-sly-list that repeats the whole element, instead of just the content)
  • improved performance (on par with JSP) and around 150 bug fixes since 6.0
  • the specification and implementation for Apache Sling of Sighlty are open source (since end of 2014)
4) User Interface :
                  Experience Manager 6.1 includes the Classic UI (same as in AEM 6.0) and Touch-optimized UI. The Touch-optimized UI in 6.1 is substantially extended to efficiently cover every-day use cases of marketing and content management practitioners. The user interface and interaction patterns aligns with the Adobe Marketing Cloud. Please refer to the individual areas of AEM on the detailed enhancements done to the Touch-optimized UI.

                 For Web Developers, 6.1 includes Plug-ins for Eclipse, Extension for Brackets and the web-based UI CRXDE Lite. Brackets, integrated with the Creative Cloud Extract service, allows efficient update of templates/components based on designs created in Adobe Photoshop.
Workflow

                 The focus for AEM 6.1 was to improve the throughput of workflow tasks that can be executed by the workflow engine, by optimizing various parts of the way workflow steps are run within AEM. Customers that update to 6.1 should see that workflows take less time to complete (in particular with lots of them running in parallel), and take less resources to run on the server.
Summary of improvements:

                  Introduction of transient workflows, that runs the workflow tasks in memory and don't persist them in the repository. This has to be enabled on the workflow level, and is useful for shot-lived workflow where no audit, or history is needed.
Internal changes, such as reducing JCR observation listeners, amount of Sling Jobs needed to run workflow tasks.
APIs
                 AEM 6.1 introduces a new simplified remote HTTP API based on JSON+Siren. This allows easier interaction with 3rd party tools to read and write content into/from the repository, compared to lower-level Sling HTTP API.

5) Supported Platforms :
                With 6.1, Adobe recommends to use Java 8 with a 64bit JVM as default. Exceptions are deployments on web application servers - such as IBM WebSphere that come recommended with their JVMs. Please consult the Supported Platform list for all details.

6) Languages :
               Including which are available in AEM 6.0 languages,  additionally certified for GB18030-2005 CITS to use the Chinese Encoding Standard.


Some Deprecated features from API side:

Security (User/Groups) :
From com.day.cq.security.* to org.apache.jackrabbit.api.security.*

Security (login) :
from loginAdministrative (org.apache.sling.jcr.api) to  Apache Sling Service Authentication

Sightly :
            Sightly i18n source option should no longer be used, use locale option instead: ${'Assets' @ i18n, locale=request.locale.language}

            The Sightly Use helper class com.adobe.cq.sightly.WCM Usehas been deprecated and is now replaced bycom.adobe.cq.sightly.WCMUsePojo which uses the new Sightly API from Apache Sling.

             The com.adobe.granite.sightly.* API has been deprecated as the Sightly engine has been donated to the Apache Foundation and is now provided by Apache Sling, through org.apache.sling.scripting.sightly.*. An adapter is provided to support code that was using the old API.

XSS :
         The com.adobe.granite.xssprotection has been deprecated in favour of org.apache.sling.xss. All XSS API calls are delegated to the Sling implementation, with the Granite bundle only loading the product's AntiSamy policies.

Vault :
          The package com.day.jcr.vault.* API is marked as deprecated starting 6.0. Vault has been donated to the Apache Foundation and is now org.apache.jackrabbit.vault.*

ClientLibs :
         The ClientLib granite.ui.bootstrap and granite.ui.bootstrap.embedded are marked as deprecated starting 6.1

CRXDE (Eclipse-based) :
         Adobe is not planning to further enhance the Eclipse-based CRXDE. Recommendation is to used the new Eclipseplug-ins shipped  with 6.0 that also work with 5.6.x.

JSP components :
         JSP components were deprecated starting 6.0 and removed in 6.1. Most components have been implemented as HBS components based on SCF, with few exceptions, such as the Poll component.

Removed Features :

This section lists features and capabilities that have been removed.

Area Feature Replacement
Platform Repository Remove ability to install/run instance with CRX2 repository. The update process replaces the CRX2 with Apache Jackrabbit Oak.
Platform GFX Removed support for fix-size BitMap FonterFonts. Use TrueType fonts instead
Developer Tools Removed SVN Sync support (server-side) in CRXDE Lite (Team menu) Brackets/Eclipse developer/code workflow is the replacement and supports any source management system incl. SVN
Client Context / ContextHub The implementation for client-side location reverse geocoding using Google Map API. This implementation in /libs/cq/personalization/components/contextstores/geolocation/clientlib/kernel/GeolocationUtils.js has been removed due to usage terms by Google.
MSM Indicator for deleted Live Copies was removed in Classic UI Blueprint Control Center. The state has been merged with 'skipped' Live Copies
Apps Removed OSGi bundle for "Adobe CQ Apple Push Notification Service (APNS)" that was introduced with CQ 5.4 Version 6.1 adds support for Amazon SNS Mobile Push and Pushwoosh
Marketing Cloud Version 6.0 - removed Cloud Services and integration with Adobe Tag Management (EOL) that was introduced with AEM 5.6 Version 6.0 adds support for Adobe Dynamic Tag Management service
Communities Removed OSGi bundle and components that provide support for OpenSocial There is no replacement in the product.
Communities Remove the JSP "SoCo" and "Social" components Version 6.0 introduces replacement HBS components based on SCF that support the various new UGC storage options. Collab components have been removed.
Custom Nodetypes Removed the Calendar nodetypes : cq:Calendar, cq:CalendarComponent, cq:CalendarEvent, cq:CalendarRecurrence, cq:CalendarRecurrenceRule, cq:CalendarTodo, cq:Alarm, cq:CalendarAttendee.
Removed the Comment nodetype cq:Rating.



Source : https://docs.adobe.com/docs/en/aem/6-1/release-notes.html
Thanks,
SonyCharan

Wednesday 16 December 2015

How to use querybuilder in cq5

It is important to know how to build a query in normal sql and need to implement in cq5 query form.
     We can have query types here , XPATH and JCR_SQL2.
     Can build a query using any of above.

<%@ page session="false" %><%
%><%@ page import="javax.jcr.*,
                   javax.jcr.query.*,
                   java.util.*,
                   org.apache.sling.api.resource.*,
                   org.apache.sling.jcr.api.SlingRepository,
                   org.apache.sling.commons.json.io.JSONWriter" %><%
%><%@ include file="/libs/foundation/global.jsp" %>
<%

    SlingRepository repo = sling.getService(SlingRepository.class);
   
    Session session = null;
    try {
        session = repo.loginAdministrative(null);
        QueryManager qm = session.getWorkspace().getQueryManager();



     1)   // QueryResult result = qm.createQuery("//element(*, cq:PageContent)[@demo]", Query.XPATH).execute();
     2)   QueryResult result = qm.createQuery("SELECT * FROM [cq:PageContent]",            javax.jcr.query.Query.JCR_SQL2).execute();


        NodeIterator nodes = result.getNodes();

        while (nodes.hasNext()) {
            Node node = nodes.nextNode();
         %><%=node.getPath()%><br/><%//--Here you can get the nodes info which you suggested in query
                }
    } finally {
        if (session != null) {
            session.logout();
        }
    }
%>


Thanks,
Sony

Thursday 16 July 2015

Teaser Creation & Interacting with Segments in CQ5 - Campaign creation in CQ5

To implements Teasers in CQ5 , we need to interact with the Segment, Campaign, Teaser.

  -- Segment can hold the condition(Rule for the teaser to be load)
  -- Campaign can hold teasers
  -- Teaser can hold the customised content

1) First of all need to declare the segment in http://localhost:4502/siteadmin#/etc/segmentation
Here we need to declare the segment, means rule, to be filtered our teaser in the page.

Segment creation in cq5
Segments in cq5

2) Declare the Campaign in http://localhost:4502/siteadmin#/content/campaigns
Here declare our root campaign

Campaigns in cq5
Campaigns in cq5


3) Finally delcare teaser in http://localhost:4502/siteadmin#/content/campaigns/our-campaign/
Here our-campaign refers to the newly created campaign.
Under this need to create the teaser, and edit the teaser which is declared in section-3, add the customized content as per our requirement.


Creating Teaser in cq5
Creating Teaser in cq5


Now include this Teaser into our page

Drag Teaser component from sidekick in to our page. And mention fields as,
Campaign Path : /content/campaigns/our-campaign
Strategy*   First or Random or Clickstream score

Then test your teaser as mentioned rule in segment.



Now you will get the customized content based on the condition which is mentioned in segment.

Hope it helps!!!
Thanks,
SonyCharan

Tuesday 26 May 2015

How to pass json data to a dialog in cq5



By following this process, we can pass the sample data in json format to a dropdown in dialog.

Step 1 : Create component  --> create a node for it
             in tab1 --> create "items" node of type cq:WidgetCollection
             in items --> create node called "counts" of type "cq:widget"
             add these properties to "counts" node as follows







Step 2 : Now we need to define a servlet to expose json as return parameter.

For this create a java class called "JsonDataExtractor.java"
Here it follows,


package com.demo.serv;

/*
*Author SONYC
*
*/
import org.apache.felix.scr.annotations.*;
import org.apache.sling.api.servlets.*;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import javax.servlet.ServletException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.*;
import java.util.ArrayList;

import org.json.*;
import javax.servlet.Servlet;

@SuppressWarnings({"deprecation", "serial"})
@Component
@Service(Servlet.class)
@Properties(value = {
    @Property(name = "sling.servlet.paths", value = "/bin/jsondataextractor.json")
})
public class JsonDataExtractor extends SlingAllMethodsServlet{    

    private static final Logger log = LoggerFactory.getLogger(JsonDataExtractor.class);

    @Override
    protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException,IOException {      
        init(request, response);
    }
 
    @Override
    protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException,IOException {      
        init(request, response);
    }
 
    @SuppressWarnings("static-access")
    private void init(SlingHttpServletRequest request, SlingHttpServletResponse response ){    
 
    try
      {
        log.info("-------------In Json Provider class--------------");  
        ArrayList jsonAr=new ArrayList();      
        JSONObject obj=new JSONObject();
        String jsonData=null;        
   for(int i=0;i<=4;i++)
{
 obj.put("id",i);
 obj.put("value",i);
 jsonData = obj.toString();
 jsonAr.add(jsonData);
 obj=new JSONObject();        
   }
        //Return the JSON formatted data
        response.getWriter().write(jsonAr.toString());
      }
      catch(Exception e)
      {
log.info("-------------exception-------------"+e.getMessage());
        e.printStackTrace();
      }
    }  
}


Step 3 : Now you are able to get the values as json , and can check by hitting http://localhost:4502/bin/jsondataextractor.json

Step 4 :
Place this below code in your component jsp to get selected value.

<%@include file="/libs/foundation/global.jsp"%>
<%@page import="com.day.cq.wcm.api.WCMMode"%><%
%><%@page session="false" %>

<%
    pageContext.setAttribute("counVal", properties.get("count",""));
    if ( (WCMMode.fromRequest(request) == WCMMode.EDIT))
   {
       %>
           Please click here to add HTML
       <%
   }
%>
<c:if test="${not empty counVal}">
    <div class="container">
        ${counVal}
    </div>
</c:if>


Hope it helps :)
Thanks,
SonyCharan