Tech Mastery: Deep Dives into AEM, Cloud Technologies, AI Innovations, and Advanced Marketing Strate
Welcome to Tech Mastery, your expert source for insights into technology and digital strategy. Explore topics like Adobe Experience Manager, AWS, Azure, generative AI, and advanced marketing strategies. Delve into MACH architecture, Jamstack, modern software practices, DevOps, and SEO. Our blog is ideal for tech professionals and enthusiasts eager to stay ahead in digital innovations, from Content Management to Digital Asset Management and beyond.
Thursday, May 7, 2015
Invalidate dispatcher cache after successfull jenkins build - AEM/Adobe CQ5
Invalidate dispatcher cache after successful Jenkins build - AEM/Adobe CQ5
This post will explain how to invalidate the cache in Adobe Experience Manager after successful Jenkins build.Login to Jenkins console
Open the job and click on configuration
Add post-build step of type “Execute Shell” and select “Run only if build
succeeds”
Enter the below script and click on - Change the dispatcher host name
accordingly.
/usr/bin/curl -H "CQ-Action: DELETE" -H "CQ-Handle:/"
-H "Content-Length: 0" -H "Content-Type:
application/octet-stream" --noproxy .com http://<<dispatcher
host name>>/dispatcher/invalidate.cache
If multiple dispatcher are configured then configure the
dispatchers as shown below in the script.
/usr/bin/curl -H "CQ-Action: DELETE" -H
"CQ-Handle:/" -H "Content-Length: 0" -H "Content-Type:
application/octet-stream" --noproxy .com http://{dispatcher1, dispatcher2,
dispatcher3, dispatcher4}.com/dispatcher/invalidate.cache
Thursday, April 30, 2015
Dispatcher caching issue while displaying the image renditions in Adobe Experience Manager(AEM)
We are using the image renditions to display the images for different devices in Adobe Experience Manager(AEM).
The HTML5 Adaptive image is used as shown below to display the images for different devices.
<img src="/content/dam/Albin/Untitled.jpg" srcset="/content/dam/Albin/Untitled.jpg/jcr:content/renditions/cq5dam.thumbnail.319.319.png 1x,/content/dam/Albin/Untitled.jpg" alt="Sample Image">
/content/dam/Albin/Untitled.jpg - Original image
/content/dam/Albin/Untitled.jpg/jcr:content/renditions/cq5dam.thumbnail.319.319.png - Rendition for 1x devices.
If the image is first accessed from the mobile devices then Untitled.jpg folder is created to cache the renditions image(rendition images will be matched for mobile devices) - /content/dam/Albin/Untitled.jpg/jcr:content/renditions/cq5dam.thumbnail.319.319.png
While the image is getting accessed from desktop browsers then dispatcher will try to return the folder Untitled.jpg as image(/content/dam/Albin/Untitled.jpg - original image will be matched for desktop browsers) so the image link will be broken in browser.
In other hand, if the image is first accessed from desktop browser then dispatcher caches Untitled.jpg as image. The subsequent request to the renditions image will not find the images in dispatcher cache so the image will be retrieved from publisher for rendering(rendition images will not be cached in this scenario as untitled.jpg is created as a image).
Refer the following post To resolve the issue
https://www.albinsblog.com/2015/04/how-to-use-html5-adaptive-image-in-AdobeCQ5.html
The HTML5 Adaptive image is used as shown below to display the images for different devices.
<img src="/content/dam/Albin/Untitled.jpg" srcset="/content/dam/Albin/Untitled.jpg/jcr:content/renditions/cq5dam.thumbnail.319.319.png 1x,/content/dam/Albin/Untitled.jpg" alt="Sample Image">
/content/dam/Albin/Untitled.jpg - Original image
/content/dam/Albin/Untitled.jpg/jcr:content/renditions/cq5dam.thumbnail.319.319.png - Rendition for 1x devices.
If the image is first accessed from the mobile devices then Untitled.jpg folder is created to cache the renditions image(rendition images will be matched for mobile devices) - /content/dam/Albin/Untitled.jpg/jcr:content/renditions/cq5dam.thumbnail.319.319.png
While the image is getting accessed from desktop browsers then dispatcher will try to return the folder Untitled.jpg as image(/content/dam/Albin/Untitled.jpg - original image will be matched for desktop browsers) so the image link will be broken in browser.
In other hand, if the image is first accessed from desktop browser then dispatcher caches Untitled.jpg as image. The subsequent request to the renditions image will not find the images in dispatcher cache so the image will be retrieved from publisher for rendering(rendition images will not be cached in this scenario as untitled.jpg is created as a image).
Refer the following post To resolve the issue
https://www.albinsblog.com/2015/04/how-to-use-html5-adaptive-image-in-AdobeCQ5.html
Wednesday, April 29, 2015
How to get the audit level settings of a Composite through Java - Oracle SOA Suite
How to get the audit level settings of a Composite through Java - Oracle SOA Suite
This blog will explain how to get the audit level settings of a Composite through Java in Oracle SOA Suiteimport java.util.Hashtable;
import java.util.Set;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeDataSupport;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.naming.Context;
import oracle.fabric.composite.model.CompositeNameModel;
public class GetCompositeAuditLevel {
static MBeanServerConnection m_connection = null;
public static String getCompositeAuditLevel(String compositeName,String version) throws Exception {
String auditLevel = "";
String mBeanName = "*:j2eeType=SCAComposite,revision=" + version + ",*,name=\"" + compositeName + "\"";
Set<ObjectName> mbeans = m_connection.queryNames(new ObjectName(mBeanName), null);
System.out.println(mbeans);
ObjectName mbean = (ObjectName)mbeans.iterator().next();
javax.management.openmbean.CompositeData[] properties =(javax.management.openmbean.CompositeData[])m_connection.getAttribute(mbean,"Properties");
if (properties.length > 0) {
for (int i = 0; i < properties.length; i++) {
CompositeDataSupport cds = (CompositeDataSupport)properties[i];
if (cds.get("name").equals("auditLevel")) {
auditLevel = (String)cds.get("value");
break;
}
auditLevel = "Inherit";
}
}
if (auditLevel.equals("Inherit")) {
auditLevel = getSOAINFRAAuditLevel();
}
return auditLevel;
}
public static String getSOAINFRAAuditLevel() throws Exception {
String auditLevel = "";
String mBeanName ="*:*,name=soa-infra,type=SoaInfraConfig,Application=soa-infra";
Set<ObjectName> mbeans = m_connection.queryNames(new ObjectName(mBeanName), null);
ObjectName mbean = (ObjectName)mbeans.iterator().next();
auditLevel = (String)m_connection.getAttribute(mbean, "AuditLevel");
return auditLevel;
}
public static String getDefaultCompositeRevision(String partiitionName,
String compositeName) throws Exception {
ObjectName compositeLifeCycleMBean = null;
Set queryResult = m_connection.queryNames(new ObjectName("*:j2eeType=CompositeLifecycleConfig,*"), null);
if (!queryResult.isEmpty()) {
compositeLifeCycleMBean =(ObjectName)queryResult.iterator().next();
}
//CompositeDN - DomainName/CompositeName
String compositeDN = partiitionName + '/' + compositeName;
String revision = null;
CompositeData deployedComposite =(CompositeData)m_connection.invoke(compositeLifeCycleMBean, "getDefaultComposite",
new Object[] { compositeDN },
new String[] { String.class.getName() });
if (deployedComposite != null) {
CompositeNameModel cm = CompositeNameModel.parseDN((String)deployedComposite.get("DN"));
revision = cm.getRevision();
}
return revision;
}
public static MBeanServerConnection getMbeanServerConnection(String host,int port,String userName,
String password) throws Exception {
String jndiroot = "/jndi/";
MBeanServerConnection m_connection = null;
try {
Hashtable jndiProps = new Hashtable();
jndiProps.put(Context.SECURITY_PRINCIPAL, userName);
jndiProps.put(Context.SECURITY_CREDENTIALS, password);
jndiProps.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote");
JMXServiceURL serviceURL =new JMXServiceURL("t3", host, port, jndiroot +"weblogic.management.mbeanservers.runtime");
JMXConnector m_connector =JMXConnectorFactory.newJMXConnector(serviceURL, jndiProps);
m_connector.connect();
m_connection = m_connector.getMBeanServerConnection();
} catch (Exception e) {
e.printStackTrace();
}
return m_connection;
}
public static void main(String[] args) {
try {
m_connection =getMbeanServerConnection("localhost", 7001,"weblogic", "welcome1");
String defaultVersion =getDefaultCompositeRevision("default", "TestComposite");
String auditLevel=getCompositeAuditLevel("TestComposite", defaultVersion);
System.out.println("auditLevel:"+auditLevel);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Jar files required in the class path:
- SOA Runtime jars
- weblogic.jar
Tuesday, April 28, 2015
Multipart Message Support in Oracle BPEL
Multipart Message Support in Oracle SOA Suite BPEL component.
Multipart_Message_Support_OracleBPEL.pdf
Monday, April 27, 2015
Different approaches to define vanity URL in Adobe Experience Manager(AEM)
Different approaches to define vanity URL in Adobe Experience Manager(AEM)
Sunday, April 19, 2015
How to send the HTML email using Velocity template in AEM/Adobe CQ5
How to send the HTML email using Velocity template in Adobe CQ5
This post will explain the steps required to send HTML email in Adobe CQ5 using Velocity template.Configure mail service:
Go to the Felix Console - http://localhost:4502/system/console/configMgr
Search for Day CQ Mail Service
Enter the email server details as shown below and Save the data (Here I am using Gmail server details).
Email Template:
Create the email template as html file and store it in repository - /etc/email/template/emailTemplate.html (change the path accordingly)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<body>
Hi ${firstName} ${lastName}</br>
This is the sample mail.
<ul>
#foreach( $data in $dataList )
<li>$data</li>
#end
</ul>
</body>
</html>
Maven dependencies to the POM.xml:
<dependency>
<groupId>com.day.cq</groupId>
<artifactId>cq-mailer</artifactId>
<version>5.4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.6.2</version>
</dependency>
Import-Package configuration in POM.xml bundle plugin:
*,
org.apache.xerces.dom;resolution:=optional,org.apache.xerces.parsers;resolution:=optional,
oracle.xml.parser;resolution:=optional, oracle.xml.parser.v2;resolution:=optional,
org.jaxen;resolution:=optional, org.jaxen.jdom;resolution:=optional,
org.apache.xml.resolver;resolution:=optional,org.apache.xml.resolver.helpers;resolution:=optional,
org.apache.xml.resolver.tools;resolution:=optional,org.apache.tools.ant.launch;resolution:=optional,
org.apache.tools.ant.taskdefs.optional;resolution:=optional,org.apache.tools.ant.util.optional;resolution:=optional,
org.apache.avalon.framework.logger;resolution:=optional,sun.misc;resolution:=optional,
sun.rmi.rmic;resolution:=optional,sun.tools.javac;resolution:=optional,org.apache.bsf;resolution:=optional,
org.apache.env;resolution:=optional,org.apache.bcel.classfile;resolution:=optional,kaffe.rmi.rmic;resolution:=optional,
com.sun.jdmk.comm;resolution:=optional,com.sun.tools.javac;resolution:=optional,javax.jms;resolution:=optional,
antlr;resolution:=optional,antlr.collections.impl;resolution:=optional,org.jdom;resolution:=optional,
org.jdom.input;resolution:=optional,org.jdom.output;resolution:=optional,com.werken.xpath;resolution:=optional,
org.apache.tools.ant;resolution:=optional,org.apache.tools.ant.taskdefs;resolution:=optional,
org.apache.log;resolution:=optional,org.apache.log.format;resolution:=optional,org.apache.log.output.io;resolution:=optional,
Subscribe to:
Posts (Atom)