How to Install/Add Bundles, Content Packages or Configurations at Runtime CRX in AEM/Adobe CQ5
Install Bundles, Content Packages or Configurations at Runtime
If you want to install additional packages into the CRX , Create install folder under the crx-quickstart.Put your bundles, content packages or configurations in install folder. It will pick up while instance start and install into the CRX repository. Packages will install into CRX in the alphabetic order.
References :
AEM Documentation
Adobe Community
You can define additional bundles based on run modes
for this you need to create install.<run mode> folder.for more information click here
AEM6 /Adobe CQ5 How to Add and Read Bundle / Service Configurations(String, Dropdown, Array/Multifield )
Adding Properties to the Bundle/ OSGI CQ Service
String / TextField
@Property(value = "GET")
static final String STRING_VAL = "string.textfield";
String Array / Multifield
@Property ( unbounded=PropertyUnbounded.ARRAY, value={"*"},label="Template paths",description="eg: /apps/devtools/templates/page-home" )
private static final String MUTIFIELD_EX = "multifield.test";
Boolean Field
@Property(boolValue={false}, label="Boolean values", description="Booealn test")
private static final String BOOLEN_TEST = "boolean_test";
Dropdown
@Property( options={
@PropertyOption(name="blue", value="color-blue"),
@PropertyOption(name="green", value="color-green"),
@PropertyOption(name="red", value="color-red"),
@PropertyOption(name="yellow", value="color-yellow"),
private static final String SELECTION_TEST = "dropdown.test";
Reading Properties of Bundle/ OSGI CQ Service
1) You to get the ConfigurationAdmin reference
@Reference
ConfigurationAdmin configAdmin;
2) Get Bundle Configuratinn
Configuration config = configAdmin.getConfiguration(this.getClass().getCanonicalName());
3) Get properties of conguration
Dictionary<?, ?> configProperties = config.getProperties();
4) Red Properties
Reading String/TextField
String texfiledValue = (String) configProperties.get( STRING_VAL );
Reading the Dropdown
String dropdownTest = (String) configProperties.get( SELECTION_TEST );
Reading Boolean
Boolean booealnTest = ( Boolean ) configProperties.get( BOOLEN_TEST );
Reading Array/Multifield
String[] multifieldVlaues = (String[]) configProperties.get( MUTIFIELD_EX );
for( String value : multifieldVlaues ){
out.println( value );
}
Sitemaps for the Adobe CQ Site
Sitemaps for the Adobe CQ Site
Sitemaps are an easy way for webmasters to inform search engines about pages on their sites that are available for crawling. In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL. We don’t need to submit each Sitemap individually. Just submit the Sitemap index file and you're good to go.
Creating and submitting a Sitemap helps make sure that search engine knows about all the pages on your site, including URLs that may not be discoverable by search engine normal crawling process.
The Sitemaps protocol enables you to let search engines know what content you would like indexed. To tell search engines the content you don't want indexed.
The Sitemaps protocol enables you to let search engines know what content you would like indexed. To tell search engines the content you don't want indexed.
Create sitemap index category page:
Create a page “sitemap-index-categories” in CQ. Under this page create category node with urls property. The category node name should be the page name that is under the root of your site.
Note: “/…” mean that all pages and subdirectories in that directory should be included in the referenced sitemap.
Sitemap index file generation:
Create a sitemap-index template and page component. Create xml.jsp under the sitemap index page component. Write the logic in the xml.jsp that will iterate over the category nodes which are created under the page “sitemap-index-categories” and generated the xml file in the below structure .
Sample sitemap index file
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap> <loc>http://<host>/<category-node-name>.xml</loc></sitemap>
<sitemap><loc>http://<host>/<category-node-name>..xml</loc></sitemap>
</sitemapindex>
Sitemap Generation
Create xml.jsp under the page component which would be the super type of all your templates, So that you can access in the every page in the site.
In the xml.jsp write a logic that will read the URl to get the “category-node-name”. Read the urls property of “category-node” and then generate the below xml structure. If the URL contains “/…” at the end you need to include all pages and subdirectories in that directory in the xml file.
Sample sitemap file:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url> <loc>http://<host>/about_us.html</loc></url>
<url> <loc http://<host>/about_us/<page-path>.html
</loc> </url>
</urlset >
Note: Create sitemap_index page using sitemap-index template under the root of your site. Access sitemap_index.xml from browser url to generate the sitemap index.
References:
How to setup Maven in your development environment
You can use Maven to build an OSGi bundle. Maven manages required JAR files that a Java project needs in its class path. Instead of searching the Internet trying to find and download third-party JAR files to include in your project’s class path, Maven manages these dependencies for you.
You can download Maven 3 from the following URL:
- Unzip the distribution archive, i.e. apache-maven-3.1.1-bin.zip to the directory you wish to install Maven 3.1.1. These instructions assume you chose C:\Program Files\Apache Software Foundation. The subdirectory apache-maven-3.1.1 will be created from the archive
- Add the M2_HOME environment variable by opening up the system properties (WinKey + Pause), selecting the "Advanced" tab, and the "Environment Variables" button, then adding the M2_HOME variable in the user variables with the value C:\Program Files\Apache Software Foundation\apache-maven-3.1.1. Be sure to omit any quotation marks around the path even if it contains spaces. Note: For Maven 2.0.9, also be sure that the M2_HOME doesn't have a '\' as last character.
- In the same dialog, add the M2 environment variable in the user variables with the value %M2_HOME%\bin.
- Optional: In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven.
- In the same dialog, update/create the Path environment variable in the user variables and prepend the value %M2% to add Maven available in the command line.
- In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK, e.g. C:\Program Files\Java\jdk1.5.0_02 and that %JAVA_HOME%\bin is in your Path environment variable.
- Open a new command prompt (Winkey + R then type cmd) and run mvn --version to verify that it is correctly installed.
Create an Adobe CQ Maven archetype project
To create an Adobe CQ archetype project, perform these steps:
1. Open the command prompt and go to your working directory (D:\smaple-cq-project).
2. Run the following Maven command:
mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.0 -DarchetypeRepository=adobe-public-releases
3. When prompted for additional information, specify these values:
groupId: com.test
artifactId: cq-test-project
version: 1.0-SNAPSHOT : 1.0.0
package: com.aem.coe
appsFolderName: AEM-Training
artifactName: AEM Training
packageGroup: AEM
confirm: Y
4. Once done, you will see a message like:
1. Open the command prompt and go to your working directory (D:\smaple-cq-project).
2. Run the following Maven command:
mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.0 -DarchetypeRepository=adobe-public-releases
3. When prompted for additional information, specify these values:
groupId: com.test
artifactId: cq-test-project
version: 1.0-SNAPSHOT : 1.0.0
package: com.aem.coe
appsFolderName: AEM-Training
artifactName: AEM Training
packageGroup: AEM
confirm: Y
4. Once done, you will see a message like:
Maven Plugin to Install Bundle Directly Into OSGI in AEM/Adobe CQ5
Use the following plugin in your POM to install bundle directly into OSGI console.
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>maven-sling-plugin</artifactId>
<version>2.1.0</version>
<executions>
<execution>
<id>install-bundle</id>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
<configuration>
<slingUrl>http://localhost:8080/system/console/install</slingUrl>
<user>admin</user>
<password>admin</password>
</configuration>
</plugin>
Best way to use suffix in AEM/Adobe CQ5 URLs
It is better to use the suffix with selectors only that will help the dispatcher when flush cache.
Ex:-
<resource path>/results.html
<resource path>/results.html/suffix(Not recommended )
<resource path>/results.html/suffix.suffix1 (Not recommended )
<resource path>/results.slelector.html/suffix(Recommended)
<resource path>/results.slelector.html/suffix.suffix1(Recommended)
Ex:-
<resource path>/results.html
<resource path>/results.html/suffix(Not recommended )
<resource path>/results.html/suffix.suffix1 (Not recommended )
<resource path>/results.slelector.html/suffix(Recommended)
<resource path>/results.slelector.html/suffix.suffix1(Recommended)
AEM /Adobe CQ 5.6.1 Supported Browsers and Java Content Repositories
AEM 5.6.1 supports the following browsers
|
Browser
|
Support for Classic UI
|
Support for Touch UI
|
|
Microsoft Internet Explorer 11
|
Z: Not supported
|
Z: Not supported
|
|
Microsoft Internet Explorer 10
|
A: Supported
|
A: Supported (1)
|
|
Microsoft Internet Explorer 9
|
A: Supported
|
A: Supported
|
|
Microsoft Internet Explorer 8
|
A: Supported (6)
|
Z: Not supported
|
|
Microsoft Internet Explorer 7
|
Z: Not supported
|
Z: Not supported
|
|
Microsoft Internet Explorer 6
|
Z: Not supported
|
Z: Not supported
|
|
Mozilla Firefox 25
|
A: Supported
|
A: Supported
|
|
Mozilla Firefox 24 (ESR) (3)
|
A: Supported
|
A: Supported
|
|
Mozilla Firefox 17 (ESR) (3)
|
Z: Not supported
|
Z: Not supported
|
|
Mozilla Firefox 10 (ESR) (3)
|
Z: Not supported
|
Z: Not supported
|
|
Google Chrome 31+
|
A: Supported
|
A: Supported
|
|
Apple Safari 7.0 (OS X)
|
A: Supported
|
A: Supported
|
|
Apple Safari 6.0 (OS X)
|
A: Supported
|
A: Supported
|
|
Apple Safari 6.0 (iOS) (4)(5)
|
Z: Not supported
|
A: Supported
|
AEM 5.6.1 supported java Content Repositories
|
latform
|
Support Level
|
|
Adobe CRX 2.4
|
A: Supported
|
|
Apache Jackrabbit 2.5.3
|
D: Validated, optional support
available
|
For more information click here
Subscribe to:
Posts (Atom)
-
How to Load TouchUI dialog Specific Clientlibs For touch UI dialog we can load specific client libs by using extraClientlibs property t...
-
Open package manager http://localhost:5632/crx/packmgr/index.jsp Click on the crate packge Enter package name ,versi...
-
AEM 6.4/ AEM 6.5 Clientlib specific Preprocessors AEM allows for pluggable preprocessors and ships with support for YUI Compressor for CS...
-
OSGi component / service Configs String Config @AttributeDefinition( name = "String Property", ...
-
Dialog Editor The dialog editor provides a graphical interface for easily creating and editing dialog boxes and scaffolds. To see how it ...
