SlideShare a Scribd company logo
1 of 27
INTEGRATION 
PATTERNS IN AEM 
Yuval Ararat
• Basics 
• Sling 
• Integration 
• Sample 
• Other resources 
• Sling Models
• What do we integrate with? 
– Backend API layer 
• SAP PI, Oracle Fusion or other middleware layer. 
• Bespoke API 
– DB 
– File System 
– Forms Engine
• First questions when arriving to the scene. 
– Is it exposed to WWW? 
– What authentication does the layer require? 
– What can I cache? 
– Protocol and output formats.
• Exposed to WWW? 
– Client side integration 
– Mixed integration 
• Not exposed to the WWW 
– Server Side 
– Tunneled through
• SlingMainServlet 
– Outermost Request Handler 
– Starts Request Processing 
• ResourceResolver 
– Resolves the URL to a Resource 
• ServletResolver 
– Resolve the Resource Type to a Servlet/Script
• Resolve the Resource 
– Source: Request URI 
• Resolve Servlet or Script 
– Source: Resource Type 
• sling:resourceType 
• sling:resourceSuperType 
• Call Servlet Filters 
• Call Servlet or Script 
protocol host path selector extension 
http:// myhost/ tools/spy .print.a4 .html / 
suffix 
a/b ? 
param(s) 
x=12
• ResourceProvider 
• Sling Filter 
• Custom SlingServlet 
• OSGi HTTP Service
• Provides access to resources from different locations 
through a single ResourceResolver 
• Registered to a path in the virtual resource tree 
• The last fallback is always the JCR repository
• PlanetResourceProvider Sample 
• Respond with a relevant planet resource when calling 
“/planets/<planet>” 
https://svn.apache.org/repos/asf/sling/trunk/launchpad/test-services/ 
src/main/java/org/apache/sling/launchpad/testservices/resourceprovider/
@Component 
@Service 
@Properties({ 
@Property(name=ResourceProvider.ROOTS, value=PlanetsResourceProvider.ROOT) 
}) 
public class PlanetsResourceProvider implements ResourceProvider { 
private static final Map<String, ValueMap> PLANETS = new HashMap<String, ValueMap>(); 
/** This can be configurable of course */ 
public static final String ROOT = "planets"; 
public static final String ABS_ROOT = "/" + ROOT; 
static { 
definePlanet("Mercury", 57910); 
definePlanet("Venus", 108200); 
definePlanet("Earth", 149600).put("comment", "Resources can have different sets of properties"); 
definePlanet("Mars", 227940); 
definePlanet("Jupiter", 4332); 
definePlanet("Saturn", 10759); 
definePlanet("Uranus", 30685); 
definePlanet("Neptune", 60190); 
// Add the moon to test a two-level hierarchy 
final String moonPath = ABS_ROOT + "/earth/moon"; 
PLANETS.put(moonPath, new PlanetResource.PlanetValueMap("Moon", 384)); 
}
public Resource getResource(ResourceResolver resolver, HttpServletRequest req, String path) { 
// Synthetic resource for our root, so that /planets works 
if((ABS_ROOT).equals(path)) { 
return new SyntheticResource(resolver, path, PlanetResource.RESOURCE_TYPE); 
} 
// Not root, return a Planet if we have one 
final ValueMap data = PLANETS.get(path); 
return data == null ? null : new PlanetResource(resolver, path, data); 
}
public Iterator<Resource> listChildren(Resource parent) { 
if(parent.getPath().startsWith(ABS_ROOT)) { 
// Not the most efficient thing...good enough for this example 
final List<Resource> kids = new ArrayList<Resource>(); 
for(Map.Entry<String, ValueMap> e : PLANETS.entrySet()) { 
if(parent.getPath().equals(parentPath(e.getKey()))) { 
kids.add(new PlanetResource(parent.getResourceResolver(), e.getKey(), e.getValue())); 
} 
} 
return kids.iterator(); 
} else { 
return null; 
} 
}
@Adaptable(adaptableClass=Resource.class, adapters={ 
@Adapter({ValueMap.class}) 
}) 
public class PlanetResource extends AbstractResource implements Resource { 
private final String path; 
private final ResourceMetadata metadata; 
private final ValueMap valueMap; 
private final ResourceResolver resolver; 
public static final String RESOURCE_TYPE = "sling/test-services/planet"; 
PlanetResource(ResourceResolver resolver, String path, ValueMap valueMap) { 
this.path = path; 
this.valueMap = valueMap; 
this.resolver = resolver; 
metadata = new ResourceMetadata(); 
metadata.setResolutionPath(path); 
}
– BundleResourceProvider provides access to files and directories 
contained in an OSGi bundle 
– The BundleResourceProvider is responsible for mapping the 
directory tree into the resource tree 
– It‘s most conveniently configured as instruction in the maven-bundle- 
plugin: 
<configuration> 
<instructions> 
<Sling-Bundle-Resources>/resource/tree;path:=/bundle/tree</Sling-Bundle-Resources> 
</instructions> 
</configuration>
– FsResourceProvider, which is part of org.apache.sling.fsresource, 
maps file system paths as resources. 
– Requires installation. 
– Configuration through fsresource.xml: 
• provider.roots 
• Provider.files 
– http://sling.apache.org/documentation/bundles/accessing-filesystem-resources-extensions- 
fsresource.html
• Sling Models 
– Creating an adaptable class from a POJO by annotations 
• Blueprints 
– Dependency injection framework for OSGi 
– Implementations include SpringDM (Historical) and Neba.io 
• Cognifide Slice framework 
– God’s speed…
• Creat ing an adaptable class from a POJO by annotat ions 
– Resource resource = getResource(); 
– Return resource.adaptTo(YourCustom.class); 
– @Model(adaptables = Resource.class) 
– public class YourCustom { 
– ... 
– } 
• Use Sling Models for Controller or Business Logic that is 
“context-aware” 
• Use Value Map to read resource data 
• http://sling.apache.org/documentation/bundles/models.html
• Use Sling Models for Dependency 
Injection 
– Inject Sling Context Objects via @SlingObject 
– Inject AEM Context Objects via @AemObject 
– Inject Business Classes via @Self 
– Inject Resource Data or Parameters 
• Dependencies can be mocked with tools like 
Mockito@InjectMocks
• Injecting 
@Model(adaptables= Resource.class) public class YourCustom{ 
@Inject // we expected always an email-property 
private String email; 
@Inject @Optional // first name can be empty 
private String firstName; 
// read property “surname” if empty use “empty” 
@Inject @Named(“surname“) @Default(values=“empty“) 
private String lastName; 
}
@Model(adaptables= Resource.class) 
Public class YourCustom{ 
@Inject// OSGiService 
private Externalizer externalizer; 
@PostConstruct 
Protected void init() { 
// gets executed after the class is created 
// set to protected, so it can be unit-tested 
} 
}
@Model(adaptables= Resource.class) 
Public class YourCustom{ 
//option1 
@Self 
private Resource resource; 
//option2 
public YourCustom(Resource resource) { 
// to get access to the adaptor 
this.resource= resource; 
} 
}
• Available for AEM6 
– Can be installed in CQ5.6.1 
– Sling Models Content Packages 
– https://github.com/Adobe-Consulting- 
Services/com.adobe.acs.bundles.sling-models/ 
releases 
• What’s new in Sling Models 1.1 
– http://adapt.to/2014/en/schedule/whats-new-in-sling-models- 
11.html
• Recommended pattern: Controller per concern, 
not per component! 
• Controllers are Sling Models 
• Component/View can re-use multiple controllers
• Sling Models Documentation 
– http://sling.apache.org/documentation/bundles/model 
s.html 
• Sling Models 1.0.x Introduction by Justin Edelson 
– http://slideshare.net/justinedelson/sling-models-overview 
• AEM Object Injector Implementations 
– http://wcm.io/sling/models/ 
– http://adobe-consulting-services.github.io/acs-aem-commons/ 
features/aem-sling-models-injectors.html

More Related Content

What's hot

마이크로 서비스를 위한 AWS Cloud Map & App Mesh - Saeho Kim (AWS Solutions Architect)
마이크로 서비스를 위한 AWS Cloud Map & App Mesh - Saeho Kim (AWS Solutions Architect)마이크로 서비스를 위한 AWS Cloud Map & App Mesh - Saeho Kim (AWS Solutions Architect)
마이크로 서비스를 위한 AWS Cloud Map & App Mesh - Saeho Kim (AWS Solutions Architect)Amazon Web Services Korea
 
AWS Black Belt Techシリーズ Amazon Elastic Compute Cloud (Amazon EC2)
AWS Black Belt Techシリーズ Amazon Elastic Compute Cloud (Amazon EC2)AWS Black Belt Techシリーズ Amazon Elastic Compute Cloud (Amazon EC2)
AWS Black Belt Techシリーズ Amazon Elastic Compute Cloud (Amazon EC2)Amazon Web Services Japan
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeMartin Schütte
 
20180704(20190520 Renewed) AWS Black Belt Online Seminar Amazon Elastic File ...
20180704(20190520 Renewed) AWS Black Belt Online Seminar Amazon Elastic File ...20180704(20190520 Renewed) AWS Black Belt Online Seminar Amazon Elastic File ...
20180704(20190520 Renewed) AWS Black Belt Online Seminar Amazon Elastic File ...Amazon Web Services Japan
 
20190730 AWS Black Belt Online Seminar Amazon CloudFrontの概要
20190730 AWS Black Belt Online Seminar Amazon CloudFrontの概要20190730 AWS Black Belt Online Seminar Amazon CloudFrontの概要
20190730 AWS Black Belt Online Seminar Amazon CloudFrontの概要Amazon Web Services Japan
 
20190319 AWS Black Belt Online Seminar Amazon FSx for Windows Server
20190319 AWS Black Belt Online Seminar Amazon FSx for Windows Server20190319 AWS Black Belt Online Seminar Amazon FSx for Windows Server
20190319 AWS Black Belt Online Seminar Amazon FSx for Windows ServerAmazon Web Services Japan
 
20180328 AWS Black Belt Online Seminar Amazon Kinesis Video Streams
20180328 AWS Black Belt Online Seminar Amazon Kinesis Video Streams20180328 AWS Black Belt Online Seminar Amazon Kinesis Video Streams
20180328 AWS Black Belt Online Seminar Amazon Kinesis Video StreamsAmazon Web Services Japan
 
AWS Cloud 환경으로​ DB Migration 전략 수립하기
AWS Cloud 환경으로​ DB Migration 전략 수립하기AWS Cloud 환경으로​ DB Migration 전략 수립하기
AWS Cloud 환경으로​ DB Migration 전략 수립하기BESPIN GLOBAL
 
Microservices Architecture for AEM
Microservices Architecture for AEMMicroservices Architecture for AEM
Microservices Architecture for AEMMaciej Majchrzak
 
Introduction to AWS Secrets Manager
Introduction to AWS Secrets ManagerIntroduction to AWS Secrets Manager
Introduction to AWS Secrets ManagerAmazon Web Services
 
Architecture of Hadoop
Architecture of HadoopArchitecture of Hadoop
Architecture of HadoopKnoldus Inc.
 
IBM DS8880 and IBM Z - Integrated by Design
IBM DS8880 and IBM Z - Integrated by DesignIBM DS8880 and IBM Z - Integrated by Design
IBM DS8880 and IBM Z - Integrated by DesignStefan Lein
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introductionJason Vance
 
Amazon EFS (Elastic File System) 이해하고사용하기
Amazon EFS (Elastic File System) 이해하고사용하기Amazon EFS (Elastic File System) 이해하고사용하기
Amazon EFS (Elastic File System) 이해하고사용하기Amazon Web Services Korea
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructuredAmi Mahloof
 
20190731 Black Belt Online Seminar Amazon ECS Deep Dive
20190731 Black Belt Online Seminar Amazon ECS Deep Dive20190731 Black Belt Online Seminar Amazon ECS Deep Dive
20190731 Black Belt Online Seminar Amazon ECS Deep DiveAmazon Web Services Japan
 
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...Amazon Web Services
 
Introduction to microservices
Introduction to microservicesIntroduction to microservices
Introduction to microservicesAnil Allewar
 

What's hot (20)

마이크로 서비스를 위한 AWS Cloud Map & App Mesh - Saeho Kim (AWS Solutions Architect)
마이크로 서비스를 위한 AWS Cloud Map & App Mesh - Saeho Kim (AWS Solutions Architect)마이크로 서비스를 위한 AWS Cloud Map & App Mesh - Saeho Kim (AWS Solutions Architect)
마이크로 서비스를 위한 AWS Cloud Map & App Mesh - Saeho Kim (AWS Solutions Architect)
 
AWS Black Belt Techシリーズ Amazon Elastic Compute Cloud (Amazon EC2)
AWS Black Belt Techシリーズ Amazon Elastic Compute Cloud (Amazon EC2)AWS Black Belt Techシリーズ Amazon Elastic Compute Cloud (Amazon EC2)
AWS Black Belt Techシリーズ Amazon Elastic Compute Cloud (Amazon EC2)
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as Code
 
はじめよう DynamoDB ハンズオン
はじめよう DynamoDB ハンズオンはじめよう DynamoDB ハンズオン
はじめよう DynamoDB ハンズオン
 
20180704(20190520 Renewed) AWS Black Belt Online Seminar Amazon Elastic File ...
20180704(20190520 Renewed) AWS Black Belt Online Seminar Amazon Elastic File ...20180704(20190520 Renewed) AWS Black Belt Online Seminar Amazon Elastic File ...
20180704(20190520 Renewed) AWS Black Belt Online Seminar Amazon Elastic File ...
 
20190730 AWS Black Belt Online Seminar Amazon CloudFrontの概要
20190730 AWS Black Belt Online Seminar Amazon CloudFrontの概要20190730 AWS Black Belt Online Seminar Amazon CloudFrontの概要
20190730 AWS Black Belt Online Seminar Amazon CloudFrontの概要
 
20190319 AWS Black Belt Online Seminar Amazon FSx for Windows Server
20190319 AWS Black Belt Online Seminar Amazon FSx for Windows Server20190319 AWS Black Belt Online Seminar Amazon FSx for Windows Server
20190319 AWS Black Belt Online Seminar Amazon FSx for Windows Server
 
Content migration to AEM
Content migration to AEMContent migration to AEM
Content migration to AEM
 
20180328 AWS Black Belt Online Seminar Amazon Kinesis Video Streams
20180328 AWS Black Belt Online Seminar Amazon Kinesis Video Streams20180328 AWS Black Belt Online Seminar Amazon Kinesis Video Streams
20180328 AWS Black Belt Online Seminar Amazon Kinesis Video Streams
 
AWS Cloud 환경으로​ DB Migration 전략 수립하기
AWS Cloud 환경으로​ DB Migration 전략 수립하기AWS Cloud 환경으로​ DB Migration 전략 수립하기
AWS Cloud 환경으로​ DB Migration 전략 수립하기
 
Microservices Architecture for AEM
Microservices Architecture for AEMMicroservices Architecture for AEM
Microservices Architecture for AEM
 
Introduction to AWS Secrets Manager
Introduction to AWS Secrets ManagerIntroduction to AWS Secrets Manager
Introduction to AWS Secrets Manager
 
Architecture of Hadoop
Architecture of HadoopArchitecture of Hadoop
Architecture of Hadoop
 
IBM DS8880 and IBM Z - Integrated by Design
IBM DS8880 and IBM Z - Integrated by DesignIBM DS8880 and IBM Z - Integrated by Design
IBM DS8880 and IBM Z - Integrated by Design
 
Terraform introduction
Terraform introductionTerraform introduction
Terraform introduction
 
Amazon EFS (Elastic File System) 이해하고사용하기
Amazon EFS (Elastic File System) 이해하고사용하기Amazon EFS (Elastic File System) 이해하고사용하기
Amazon EFS (Elastic File System) 이해하고사용하기
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
 
20190731 Black Belt Online Seminar Amazon ECS Deep Dive
20190731 Black Belt Online Seminar Amazon ECS Deep Dive20190731 Black Belt Online Seminar Amazon ECS Deep Dive
20190731 Black Belt Online Seminar Amazon ECS Deep Dive
 
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
 
Introduction to microservices
Introduction to microservicesIntroduction to microservices
Introduction to microservices
 

Viewers also liked

Four approaches to integrate aem with external systems by Jan Kuzniak
Four approaches to integrate aem with external systems by Jan KuzniakFour approaches to integrate aem with external systems by Jan Kuzniak
Four approaches to integrate aem with external systems by Jan KuzniakAEM HUB
 
JCR, Sling or AEM? Which API should I use and when?
JCR, Sling or AEM? Which API should I use and when?JCR, Sling or AEM? Which API should I use and when?
JCR, Sling or AEM? Which API should I use and when?connectwebex
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMconnectwebex
 
The six key steps to AEM architecture
The six key steps to AEM architectureThe six key steps to AEM architecture
The six key steps to AEM architectureAshokkumar T A
 
Vimeo Integration with aem
Vimeo Integration with aemVimeo Integration with aem
Vimeo Integration with aemManisha Bano
 
Sling models by Justin Edelson
Sling models by Justin Edelson Sling models by Justin Edelson
Sling models by Justin Edelson AEM HUB
 
Understanding Sling Models in AEM
Understanding Sling Models in AEMUnderstanding Sling Models in AEM
Understanding Sling Models in AEMAccunity Software
 
Apache SOLR in AEM 6
Apache SOLR in AEM 6Apache SOLR in AEM 6
Apache SOLR in AEM 6Yash Mody
 
Introduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsIntroduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsStefano Celentano
 
AEM & eCommerce integration
AEM & eCommerce integrationAEM & eCommerce integration
AEM & eCommerce integrationLokesh BS
 
Basics of Solr and Solr Integration with AEM6
Basics of Solr and Solr Integration with AEM6Basics of Solr and Solr Integration with AEM6
Basics of Solr and Solr Integration with AEM6DEEPAK KHETAWAT
 
Sling Models Using Sightly and JSP by Deepak Khetawat
Sling Models Using Sightly and JSP by Deepak KhetawatSling Models Using Sightly and JSP by Deepak Khetawat
Sling Models Using Sightly and JSP by Deepak KhetawatAEM HUB
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and SlingLo Ki
 
Adobe AEM for Business Heads
Adobe AEM for Business HeadsAdobe AEM for Business Heads
Adobe AEM for Business HeadsYash Mody
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMAdobeMarketingCloud
 
You wanna crypto in AEM
You wanna crypto in AEMYou wanna crypto in AEM
You wanna crypto in AEMDamien Antipa
 
Creating Real-Time Data Mashups with Node.js and Adobe CQ by Josh Miller
Creating Real-Time Data Mashups with Node.js and Adobe CQ by Josh MillerCreating Real-Time Data Mashups with Node.js and Adobe CQ by Josh Miller
Creating Real-Time Data Mashups with Node.js and Adobe CQ by Josh Millerrtpaem
 
UI Customization in AEM 6.0
UI Customization in AEM 6.0UI Customization in AEM 6.0
UI Customization in AEM 6.0Gilles Knobloch
 
Shooting rabbits with sling
Shooting rabbits with slingShooting rabbits with sling
Shooting rabbits with slingTomasz Rękawek
 

Viewers also liked (20)

Four approaches to integrate aem with external systems by Jan Kuzniak
Four approaches to integrate aem with external systems by Jan KuzniakFour approaches to integrate aem with external systems by Jan Kuzniak
Four approaches to integrate aem with external systems by Jan Kuzniak
 
JCR, Sling or AEM? Which API should I use and when?
JCR, Sling or AEM? Which API should I use and when?JCR, Sling or AEM? Which API should I use and when?
JCR, Sling or AEM? Which API should I use and when?
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
The six key steps to AEM architecture
The six key steps to AEM architectureThe six key steps to AEM architecture
The six key steps to AEM architecture
 
Vimeo Integration with aem
Vimeo Integration with aemVimeo Integration with aem
Vimeo Integration with aem
 
Sling models by Justin Edelson
Sling models by Justin Edelson Sling models by Justin Edelson
Sling models by Justin Edelson
 
Sling Models Overview
Sling Models OverviewSling Models Overview
Sling Models Overview
 
Understanding Sling Models in AEM
Understanding Sling Models in AEMUnderstanding Sling Models in AEM
Understanding Sling Models in AEM
 
Apache SOLR in AEM 6
Apache SOLR in AEM 6Apache SOLR in AEM 6
Apache SOLR in AEM 6
 
Introduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsIntroduction to Sightly and Sling Models
Introduction to Sightly and Sling Models
 
AEM & eCommerce integration
AEM & eCommerce integrationAEM & eCommerce integration
AEM & eCommerce integration
 
Basics of Solr and Solr Integration with AEM6
Basics of Solr and Solr Integration with AEM6Basics of Solr and Solr Integration with AEM6
Basics of Solr and Solr Integration with AEM6
 
Sling Models Using Sightly and JSP by Deepak Khetawat
Sling Models Using Sightly and JSP by Deepak KhetawatSling Models Using Sightly and JSP by Deepak Khetawat
Sling Models Using Sightly and JSP by Deepak Khetawat
 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
 
Adobe AEM for Business Heads
Adobe AEM for Business HeadsAdobe AEM for Business Heads
Adobe AEM for Business Heads
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
You wanna crypto in AEM
You wanna crypto in AEMYou wanna crypto in AEM
You wanna crypto in AEM
 
Creating Real-Time Data Mashups with Node.js and Adobe CQ by Josh Miller
Creating Real-Time Data Mashups with Node.js and Adobe CQ by Josh MillerCreating Real-Time Data Mashups with Node.js and Adobe CQ by Josh Miller
Creating Real-Time Data Mashups with Node.js and Adobe CQ by Josh Miller
 
UI Customization in AEM 6.0
UI Customization in AEM 6.0UI Customization in AEM 6.0
UI Customization in AEM 6.0
 
Shooting rabbits with sling
Shooting rabbits with slingShooting rabbits with sling
Shooting rabbits with sling
 

Similar to AEM INTEGRATION PATTERNS

Decoupled Libraries for PHP
Decoupled Libraries for PHPDecoupled Libraries for PHP
Decoupled Libraries for PHPPaul Jones
 
JAX-RS Creating RESTFul services
JAX-RS Creating RESTFul servicesJAX-RS Creating RESTFul services
JAX-RS Creating RESTFul servicesLudovic Champenois
 
RESTful Web services using JAX-RS
RESTful Web services using JAX-RSRESTful Web services using JAX-RS
RESTful Web services using JAX-RSArun Gupta
 
Java colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsJava colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsSagara Gunathunga
 
FFW Gabrovo PMG - PHP OOP Part 3
FFW Gabrovo PMG - PHP OOP Part 3FFW Gabrovo PMG - PHP OOP Part 3
FFW Gabrovo PMG - PHP OOP Part 3Toni Kolev
 
RESTful Web Services with Jersey
RESTful Web Services with JerseyRESTful Web Services with Jersey
RESTful Web Services with JerseyScott Leberknight
 
Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Adam Tomat
 
Spark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RSSpark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RSArun Gupta
 
CDI, Seam & RESTEasy: You haven't seen REST yet!
CDI, Seam & RESTEasy: You haven't seen REST yet!CDI, Seam & RESTEasy: You haven't seen REST yet!
CDI, Seam & RESTEasy: You haven't seen REST yet!Dan Allen
 
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Arun Gupta
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web servicesnbuddharaju
 
JAX-RS 2.0 and OData
JAX-RS 2.0 and ODataJAX-RS 2.0 and OData
JAX-RS 2.0 and ODataAnil Allewar
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jerseyb_kathir
 
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010Arun Gupta
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony TechniquesKris Wallsmith
 
04 darwino concepts and utility classes
04   darwino concepts and utility classes04   darwino concepts and utility classes
04 darwino concepts and utility classesdarwinodb
 

Similar to AEM INTEGRATION PATTERNS (20)

L04 base patterns
L04 base patternsL04 base patterns
L04 base patterns
 
Decoupled Libraries for PHP
Decoupled Libraries for PHPDecoupled Libraries for PHP
Decoupled Libraries for PHP
 
JAX-RS Creating RESTFul services
JAX-RS Creating RESTFul servicesJAX-RS Creating RESTFul services
JAX-RS Creating RESTFul services
 
RESTful Web services using JAX-RS
RESTful Web services using JAX-RSRESTful Web services using JAX-RS
RESTful Web services using JAX-RS
 
Android Data Persistence
Android Data PersistenceAndroid Data Persistence
Android Data Persistence
 
Java colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsJava colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rs
 
FFW Gabrovo PMG - PHP OOP Part 3
FFW Gabrovo PMG - PHP OOP Part 3FFW Gabrovo PMG - PHP OOP Part 3
FFW Gabrovo PMG - PHP OOP Part 3
 
RESTful Web Services with Jersey
RESTful Web Services with JerseyRESTful Web Services with Jersey
RESTful Web Services with Jersey
 
Jersey
JerseyJersey
Jersey
 
Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018
 
Spark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RSSpark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RS
 
CDI, Seam & RESTEasy: You haven't seen REST yet!
CDI, Seam & RESTEasy: You haven't seen REST yet!CDI, Seam & RESTEasy: You haven't seen REST yet!
CDI, Seam & RESTEasy: You haven't seen REST yet!
 
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
Servlets 3.0 - Asynchronous, Extensibility, Ease-of-use @ JavaOne Brazil 2010
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
 
JAX-RS 2.0 and OData
JAX-RS 2.0 and ODataJAX-RS 2.0 and OData
JAX-RS 2.0 and OData
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
S313265 - Advanced Java API for RESTful Web Services at JavaOne Brazil 2010
 
Lab swe-2013intro jax-rs
Lab swe-2013intro jax-rsLab swe-2013intro jax-rs
Lab swe-2013intro jax-rs
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony Techniques
 
04 darwino concepts and utility classes
04   darwino concepts and utility classes04   darwino concepts and utility classes
04 darwino concepts and utility classes
 

Recently uploaded

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Recently uploaded (20)

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

AEM INTEGRATION PATTERNS

  • 1. INTEGRATION PATTERNS IN AEM Yuval Ararat
  • 2. • Basics • Sling • Integration • Sample • Other resources • Sling Models
  • 3. • What do we integrate with? – Backend API layer • SAP PI, Oracle Fusion or other middleware layer. • Bespoke API – DB – File System – Forms Engine
  • 4. • First questions when arriving to the scene. – Is it exposed to WWW? – What authentication does the layer require? – What can I cache? – Protocol and output formats.
  • 5. • Exposed to WWW? – Client side integration – Mixed integration • Not exposed to the WWW – Server Side – Tunneled through
  • 6.
  • 7. • SlingMainServlet – Outermost Request Handler – Starts Request Processing • ResourceResolver – Resolves the URL to a Resource • ServletResolver – Resolve the Resource Type to a Servlet/Script
  • 8. • Resolve the Resource – Source: Request URI • Resolve Servlet or Script – Source: Resource Type • sling:resourceType • sling:resourceSuperType • Call Servlet Filters • Call Servlet or Script protocol host path selector extension http:// myhost/ tools/spy .print.a4 .html / suffix a/b ? param(s) x=12
  • 9. • ResourceProvider • Sling Filter • Custom SlingServlet • OSGi HTTP Service
  • 10.
  • 11. • Provides access to resources from different locations through a single ResourceResolver • Registered to a path in the virtual resource tree • The last fallback is always the JCR repository
  • 12. • PlanetResourceProvider Sample • Respond with a relevant planet resource when calling “/planets/<planet>” https://svn.apache.org/repos/asf/sling/trunk/launchpad/test-services/ src/main/java/org/apache/sling/launchpad/testservices/resourceprovider/
  • 13. @Component @Service @Properties({ @Property(name=ResourceProvider.ROOTS, value=PlanetsResourceProvider.ROOT) }) public class PlanetsResourceProvider implements ResourceProvider { private static final Map<String, ValueMap> PLANETS = new HashMap<String, ValueMap>(); /** This can be configurable of course */ public static final String ROOT = "planets"; public static final String ABS_ROOT = "/" + ROOT; static { definePlanet("Mercury", 57910); definePlanet("Venus", 108200); definePlanet("Earth", 149600).put("comment", "Resources can have different sets of properties"); definePlanet("Mars", 227940); definePlanet("Jupiter", 4332); definePlanet("Saturn", 10759); definePlanet("Uranus", 30685); definePlanet("Neptune", 60190); // Add the moon to test a two-level hierarchy final String moonPath = ABS_ROOT + "/earth/moon"; PLANETS.put(moonPath, new PlanetResource.PlanetValueMap("Moon", 384)); }
  • 14. public Resource getResource(ResourceResolver resolver, HttpServletRequest req, String path) { // Synthetic resource for our root, so that /planets works if((ABS_ROOT).equals(path)) { return new SyntheticResource(resolver, path, PlanetResource.RESOURCE_TYPE); } // Not root, return a Planet if we have one final ValueMap data = PLANETS.get(path); return data == null ? null : new PlanetResource(resolver, path, data); }
  • 15. public Iterator<Resource> listChildren(Resource parent) { if(parent.getPath().startsWith(ABS_ROOT)) { // Not the most efficient thing...good enough for this example final List<Resource> kids = new ArrayList<Resource>(); for(Map.Entry<String, ValueMap> e : PLANETS.entrySet()) { if(parent.getPath().equals(parentPath(e.getKey()))) { kids.add(new PlanetResource(parent.getResourceResolver(), e.getKey(), e.getValue())); } } return kids.iterator(); } else { return null; } }
  • 16. @Adaptable(adaptableClass=Resource.class, adapters={ @Adapter({ValueMap.class}) }) public class PlanetResource extends AbstractResource implements Resource { private final String path; private final ResourceMetadata metadata; private final ValueMap valueMap; private final ResourceResolver resolver; public static final String RESOURCE_TYPE = "sling/test-services/planet"; PlanetResource(ResourceResolver resolver, String path, ValueMap valueMap) { this.path = path; this.valueMap = valueMap; this.resolver = resolver; metadata = new ResourceMetadata(); metadata.setResolutionPath(path); }
  • 17. – BundleResourceProvider provides access to files and directories contained in an OSGi bundle – The BundleResourceProvider is responsible for mapping the directory tree into the resource tree – It‘s most conveniently configured as instruction in the maven-bundle- plugin: <configuration> <instructions> <Sling-Bundle-Resources>/resource/tree;path:=/bundle/tree</Sling-Bundle-Resources> </instructions> </configuration>
  • 18. – FsResourceProvider, which is part of org.apache.sling.fsresource, maps file system paths as resources. – Requires installation. – Configuration through fsresource.xml: • provider.roots • Provider.files – http://sling.apache.org/documentation/bundles/accessing-filesystem-resources-extensions- fsresource.html
  • 19. • Sling Models – Creating an adaptable class from a POJO by annotations • Blueprints – Dependency injection framework for OSGi – Implementations include SpringDM (Historical) and Neba.io • Cognifide Slice framework – God’s speed…
  • 20. • Creat ing an adaptable class from a POJO by annotat ions – Resource resource = getResource(); – Return resource.adaptTo(YourCustom.class); – @Model(adaptables = Resource.class) – public class YourCustom { – ... – } • Use Sling Models for Controller or Business Logic that is “context-aware” • Use Value Map to read resource data • http://sling.apache.org/documentation/bundles/models.html
  • 21. • Use Sling Models for Dependency Injection – Inject Sling Context Objects via @SlingObject – Inject AEM Context Objects via @AemObject – Inject Business Classes via @Self – Inject Resource Data or Parameters • Dependencies can be mocked with tools like Mockito@InjectMocks
  • 22. • Injecting @Model(adaptables= Resource.class) public class YourCustom{ @Inject // we expected always an email-property private String email; @Inject @Optional // first name can be empty private String firstName; // read property “surname” if empty use “empty” @Inject @Named(“surname“) @Default(values=“empty“) private String lastName; }
  • 23. @Model(adaptables= Resource.class) Public class YourCustom{ @Inject// OSGiService private Externalizer externalizer; @PostConstruct Protected void init() { // gets executed after the class is created // set to protected, so it can be unit-tested } }
  • 24. @Model(adaptables= Resource.class) Public class YourCustom{ //option1 @Self private Resource resource; //option2 public YourCustom(Resource resource) { // to get access to the adaptor this.resource= resource; } }
  • 25. • Available for AEM6 – Can be installed in CQ5.6.1 – Sling Models Content Packages – https://github.com/Adobe-Consulting- Services/com.adobe.acs.bundles.sling-models/ releases • What’s new in Sling Models 1.1 – http://adapt.to/2014/en/schedule/whats-new-in-sling-models- 11.html
  • 26. • Recommended pattern: Controller per concern, not per component! • Controllers are Sling Models • Component/View can re-use multiple controllers
  • 27. • Sling Models Documentation – http://sling.apache.org/documentation/bundles/model s.html • Sling Models 1.0.x Introduction by Justin Edelson – http://slideshare.net/justinedelson/sling-models-overview • AEM Object Injector Implementations – http://wcm.io/sling/models/ – http://adobe-consulting-services.github.io/acs-aem-commons/ features/aem-sling-models-injectors.html

Editor's Notes

  1. Basic – what is an integration Sling – some sling architecture and request processing Integration – ResourceProvider integration and overview Sample – A code walkthrough of a custom resource provider