SlideShare a Scribd company logo
1 of 25
SYNTHETIC MODELS 
by Zoran Nikolovski
RESOURCE RESOLUTION
• Traditional web frameworks 
– Resolve a Controller based on the data type 
– Elaborate mechanics to load the data 
• Sling 
– A web framework based entirely on REST principals 
– The data is at the center or the process 
– Everything is a Resource
• Sling maintains a virtual tree of resources 
• Each Resource type has a ResourceProvider which provides the root of its 
resolution path 
• Resource types in the tree 
– JCR nodes 
– File System 
– Bundles 
– Servlets 
– Other (Non-JCR) Resources 
System provided
• Resolving a Resource is simple 
The 
ResourceResolver 
takes in the resource 
path
• Resolving a Resource is simple 
It identifies a 
suitable 
ResourceProvider 
The 
ResourceResolver 
takes in the resource 
path
Which calls it’s 
getResource 
method 
• Resolving a Resource is simple 
It identifies a 
suitable 
ResourceProvider 
The 
ResourceResolver 
will take in the 
resource path
And provide us 
with the right 
Resource 
Which calls it’s 
getResource 
method 
• Resolving a Resource is simple 
It identifies a 
suitable 
ResourceProvider 
The 
ResourceResolver 
takes in the resource 
path
• Resource is a central concept to Sling 
• Has a number of essential properties 
– Including a reference to the rendering script 
• Can be adapted to other compatible types 
• It’s the starting point in any domain modelling in Sling
DOMAIN MODELLING
• With Sling, domain modelling should be done against resources 
• Each Resource is a collection of properties 
– Entirely defined in the repository 
– Uniquely identified by it’s sling:resourceType 
• The domain model thus is a representation of the type and properties
• There are MANY ways to implement your domain model 
– Direct access to resource properties from the view 
– A custom mapping framework 
– Cognifide’s Slice framework 
– Sling Models (available in AEM6 as a standard) 
– Neba.io My new favorite!
What if your domain is NOT uniquely defined in the repository? 
• Legacy Apps 
• 3rd party services 
• CRMs 
• ERPs
Ask yourselves: 
• How do we bring this data into our application? 
• How do we expose it to the UI? 
• How do we maintain Sling’s RESTful principles? 
question mark on road: image via Flickr/ milos 
milosevic
SYNTHETIC MODELS
• Synthetic Models 
– Define domain objects where the domain is not exclusive to the content 
repository 
– Their property collection is defined against all data sources 
– Must be resolvable by Sling’s resource resolution mechanism 
– Leverage the Presentation Model design pattern 
– Name is inspired by SyntheticResource
• Synthetic Model 
– They inherently rely on Sling’s resource resolution mechanism 
– A ResourceProvider is required for each external domain object 
• Think of this as writing a service to expose the external data 
– These ResourceProviders will return either an instance of SyntheticResource or 
a custom Resource implementation 
• I’d advise caution when deciding on a custom Resource implementation
Writing your Synthetic Models with Neba.io 
• Using Neba.io makes it easy! 
– In reality you can achieve this with most of the mapping frameworks especially 
Sling Models 
• Annotation driven 
• Integrates the Spring Framework in Sling 
• Main features 
– Resource Models 
– Spring MVC
@ResourceModel(types = "/apps/synthetic-models/components/book") 
public class Book { 
@This 
private Resource resource; 
@Path("/content/book-store/bookinfo/${isbn}") 
private Resource bookInfo; 
private String isbn; 
private String imagePath; 
private String title; 
private String description; 
private String genre; 
private String author; 
The Synthetic Model 
A JCR resource reference 
External resource reference 
Synthetic Model Example
ResourceProvider example 
@Component(metatype = false) 
@Service 
@Properties({ 
@Property(name="service.description", value="A DB backed Book Resource"), 
@Property(name="service.vendor", value="Odecee Pty Ltd"), 
@Property(name=ResourceProvider.ROOTS, value="/content/book-store/bookinfo"), 
@Property(name=SlingConstants.PROPERTY_RESOURCE_TYPE, value="/apps/synthetic-models/ 
components/book/book.jsp") 
}) 
public class BookResourceProviderImpl implements BookResourceProvider {
DEMO
QUESTIONS?
THANK YOU! 
• Code: http://bit.ly/1tWgSbg 
• Presentation: SlideShare
Synthetic models

More Related Content

What's hot

Lucene for Solr Developers
Lucene for Solr DevelopersLucene for Solr Developers
Lucene for Solr DevelopersErik Hatcher
 
Owner - Java properties reinvented.
Owner - Java properties reinvented.Owner - Java properties reinvented.
Owner - Java properties reinvented.Luigi Viggiano
 
Battle of the giants: Apache Solr vs ElasticSearch
Battle of the giants: Apache Solr vs ElasticSearchBattle of the giants: Apache Solr vs ElasticSearch
Battle of the giants: Apache Solr vs ElasticSearchRafał Kuć
 
070517 Jena
070517 Jena070517 Jena
070517 Jenayuhana
 
From zero to hero - Easy log centralization with Logstash and Elasticsearch
From zero to hero - Easy log centralization with Logstash and ElasticsearchFrom zero to hero - Easy log centralization with Logstash and Elasticsearch
From zero to hero - Easy log centralization with Logstash and ElasticsearchRafał Kuć
 
Solr Black Belt Pre-conference
Solr Black Belt Pre-conferenceSolr Black Belt Pre-conference
Solr Black Belt Pre-conferenceErik Hatcher
 
A first Draft to Java Configuration
A first Draft to Java ConfigurationA first Draft to Java Configuration
A first Draft to Java ConfigurationAnatole Tresch
 
Lucene for Solr Developers
Lucene for Solr DevelopersLucene for Solr Developers
Lucene for Solr DevelopersErik Hatcher
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with SolrErik Hatcher
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with SolrErik Hatcher
 
Resource Routing in ExpressionEngine
Resource Routing in ExpressionEngineResource Routing in ExpressionEngine
Resource Routing in ExpressionEngineMichaelRog
 
Configure Your Projects with Apache Tamaya
Configure Your Projects with Apache TamayaConfigure Your Projects with Apache Tamaya
Configure Your Projects with Apache TamayaAnatole Tresch
 
Apache Solr Workshop
Apache Solr WorkshopApache Solr Workshop
Apache Solr WorkshopJSGB
 
Creating Dynamic Charts With JFreeChart
Creating Dynamic Charts With JFreeChartCreating Dynamic Charts With JFreeChart
Creating Dynamic Charts With JFreeChartDavid Keener
 
Solr Recipes Workshop
Solr Recipes WorkshopSolr Recipes Workshop
Solr Recipes WorkshopErik Hatcher
 
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)Erik Hatcher
 

What's hot (20)

Lucene for Solr Developers
Lucene for Solr DevelopersLucene for Solr Developers
Lucene for Solr Developers
 
Owner - Java properties reinvented.
Owner - Java properties reinvented.Owner - Java properties reinvented.
Owner - Java properties reinvented.
 
Jena
JenaJena
Jena
 
Battle of the giants: Apache Solr vs ElasticSearch
Battle of the giants: Apache Solr vs ElasticSearchBattle of the giants: Apache Solr vs ElasticSearch
Battle of the giants: Apache Solr vs ElasticSearch
 
070517 Jena
070517 Jena070517 Jena
070517 Jena
 
From zero to hero - Easy log centralization with Logstash and Elasticsearch
From zero to hero - Easy log centralization with Logstash and ElasticsearchFrom zero to hero - Easy log centralization with Logstash and Elasticsearch
From zero to hero - Easy log centralization with Logstash and Elasticsearch
 
Solr Black Belt Pre-conference
Solr Black Belt Pre-conferenceSolr Black Belt Pre-conference
Solr Black Belt Pre-conference
 
A first Draft to Java Configuration
A first Draft to Java ConfigurationA first Draft to Java Configuration
A first Draft to Java Configuration
 
Oak Lucene Indexes
Oak Lucene IndexesOak Lucene Indexes
Oak Lucene Indexes
 
Lucene for Solr Developers
Lucene for Solr DevelopersLucene for Solr Developers
Lucene for Solr Developers
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with Solr
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with Solr
 
Resource Routing in ExpressionEngine
Resource Routing in ExpressionEngineResource Routing in ExpressionEngine
Resource Routing in ExpressionEngine
 
Content Modeling Behavior
Content Modeling BehaviorContent Modeling Behavior
Content Modeling Behavior
 
Configure Your Projects with Apache Tamaya
Configure Your Projects with Apache TamayaConfigure Your Projects with Apache Tamaya
Configure Your Projects with Apache Tamaya
 
Apache Solr Workshop
Apache Solr WorkshopApache Solr Workshop
Apache Solr Workshop
 
Practical JRuby
Practical JRubyPractical JRuby
Practical JRuby
 
Creating Dynamic Charts With JFreeChart
Creating Dynamic Charts With JFreeChartCreating Dynamic Charts With JFreeChart
Creating Dynamic Charts With JFreeChart
 
Solr Recipes Workshop
Solr Recipes WorkshopSolr Recipes Workshop
Solr Recipes Workshop
 
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)code4lib 2011 preconference: What's New in Solr (since 1.4.1)
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
 

Similar to Synthetic models

RecSys 2015 Tutorial - Scalable Recommender Systems: Where Machine Learning m...
RecSys 2015 Tutorial - Scalable Recommender Systems: Where Machine Learning m...RecSys 2015 Tutorial - Scalable Recommender Systems: Where Machine Learning m...
RecSys 2015 Tutorial - Scalable Recommender Systems: Where Machine Learning m...Joaquin Delgado PhD.
 
RecSys 2015 Tutorial – Scalable Recommender Systems: Where Machine Learning...
 RecSys 2015 Tutorial – Scalable Recommender Systems: Where Machine Learning... RecSys 2015 Tutorial – Scalable Recommender Systems: Where Machine Learning...
RecSys 2015 Tutorial – Scalable Recommender Systems: Where Machine Learning...S. Diana Hu
 
How to Build Deep Learning Models
How to Build Deep Learning ModelsHow to Build Deep Learning Models
How to Build Deep Learning ModelsJosh Patterson
 
(ATS4-DEV02) Accelrys Query Service: Technology and Tools
(ATS4-DEV02) Accelrys Query Service: Technology and Tools(ATS4-DEV02) Accelrys Query Service: Technology and Tools
(ATS4-DEV02) Accelrys Query Service: Technology and ToolsBIOVIA
 
The Rise of NoSQL and Polyglot Persistence
The Rise of NoSQL and Polyglot PersistenceThe Rise of NoSQL and Polyglot Persistence
The Rise of NoSQL and Polyglot PersistenceAbdelmonaim Remani
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Railsiradarji
 
Tutorial Mahout - Recommendation
Tutorial Mahout - RecommendationTutorial Mahout - Recommendation
Tutorial Mahout - RecommendationCataldo Musto
 
Tag based recommender system
Tag based recommender systemTag based recommender system
Tag based recommender systemKaren Li
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine LearningRahul Jain
 
Where Search Meets Machine Learning: Presented by Diana Hu & Joaquin Delgado,...
Where Search Meets Machine Learning: Presented by Diana Hu & Joaquin Delgado,...Where Search Meets Machine Learning: Presented by Diana Hu & Joaquin Delgado,...
Where Search Meets Machine Learning: Presented by Diana Hu & Joaquin Delgado,...Lucidworks
 
Lucene/Solr Revolution 2015: Where Search Meets Machine Learning
Lucene/Solr Revolution 2015: Where Search Meets Machine LearningLucene/Solr Revolution 2015: Where Search Meets Machine Learning
Lucene/Solr Revolution 2015: Where Search Meets Machine LearningJoaquin Delgado PhD.
 
Lucene/Solr Revolution 2015: Where Search Meets Machine Learning
Lucene/Solr Revolution 2015: Where Search Meets Machine LearningLucene/Solr Revolution 2015: Where Search Meets Machine Learning
Lucene/Solr Revolution 2015: Where Search Meets Machine LearningS. Diana Hu
 
Hide the Stack: Toward Usable Linked Data
Hide the Stack:Toward Usable Linked DataHide the Stack:Toward Usable Linked Data
Hide the Stack: Toward Usable Linked Dataaba-sah
 
Apache Con 2021 Structured Data Streaming
Apache Con 2021 Structured Data StreamingApache Con 2021 Structured Data Streaming
Apache Con 2021 Structured Data StreamingShivji Kumar Jha
 
Mahout Tutorial and Hands-on (version 2015)
Mahout Tutorial and Hands-on (version 2015)Mahout Tutorial and Hands-on (version 2015)
Mahout Tutorial and Hands-on (version 2015)Cataldo Musto
 
Produce and consume_linked_data_with_drupal
Produce and consume_linked_data_with_drupalProduce and consume_linked_data_with_drupal
Produce and consume_linked_data_with_drupalSTIinnsbruck
 
Rdap12 wrap up reagan moore
Rdap12 wrap up reagan mooreRdap12 wrap up reagan moore
Rdap12 wrap up reagan mooreASIS&T
 
DOXLON November 2016 - Data Democratization Using Splunk
DOXLON November 2016 - Data Democratization Using SplunkDOXLON November 2016 - Data Democratization Using Splunk
DOXLON November 2016 - Data Democratization Using SplunkOutlyer
 
JCR - Java Content Repositories
JCR - Java Content RepositoriesJCR - Java Content Repositories
JCR - Java Content RepositoriesCarsten Ziegeler
 

Similar to Synthetic models (20)

RecSys 2015 Tutorial - Scalable Recommender Systems: Where Machine Learning m...
RecSys 2015 Tutorial - Scalable Recommender Systems: Where Machine Learning m...RecSys 2015 Tutorial - Scalable Recommender Systems: Where Machine Learning m...
RecSys 2015 Tutorial - Scalable Recommender Systems: Where Machine Learning m...
 
RecSys 2015 Tutorial – Scalable Recommender Systems: Where Machine Learning...
 RecSys 2015 Tutorial – Scalable Recommender Systems: Where Machine Learning... RecSys 2015 Tutorial – Scalable Recommender Systems: Where Machine Learning...
RecSys 2015 Tutorial – Scalable Recommender Systems: Where Machine Learning...
 
How to Build Deep Learning Models
How to Build Deep Learning ModelsHow to Build Deep Learning Models
How to Build Deep Learning Models
 
(ATS4-DEV02) Accelrys Query Service: Technology and Tools
(ATS4-DEV02) Accelrys Query Service: Technology and Tools(ATS4-DEV02) Accelrys Query Service: Technology and Tools
(ATS4-DEV02) Accelrys Query Service: Technology and Tools
 
The Rise of NoSQL and Polyglot Persistence
The Rise of NoSQL and Polyglot PersistenceThe Rise of NoSQL and Polyglot Persistence
The Rise of NoSQL and Polyglot Persistence
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Tutorial Mahout - Recommendation
Tutorial Mahout - RecommendationTutorial Mahout - Recommendation
Tutorial Mahout - Recommendation
 
Tag based recommender system
Tag based recommender systemTag based recommender system
Tag based recommender system
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine Learning
 
Where Search Meets Machine Learning: Presented by Diana Hu & Joaquin Delgado,...
Where Search Meets Machine Learning: Presented by Diana Hu & Joaquin Delgado,...Where Search Meets Machine Learning: Presented by Diana Hu & Joaquin Delgado,...
Where Search Meets Machine Learning: Presented by Diana Hu & Joaquin Delgado,...
 
Lucene/Solr Revolution 2015: Where Search Meets Machine Learning
Lucene/Solr Revolution 2015: Where Search Meets Machine LearningLucene/Solr Revolution 2015: Where Search Meets Machine Learning
Lucene/Solr Revolution 2015: Where Search Meets Machine Learning
 
Lucene/Solr Revolution 2015: Where Search Meets Machine Learning
Lucene/Solr Revolution 2015: Where Search Meets Machine LearningLucene/Solr Revolution 2015: Where Search Meets Machine Learning
Lucene/Solr Revolution 2015: Where Search Meets Machine Learning
 
Hide the Stack: Toward Usable Linked Data
Hide the Stack:Toward Usable Linked DataHide the Stack:Toward Usable Linked Data
Hide the Stack: Toward Usable Linked Data
 
Apache Con 2021 Structured Data Streaming
Apache Con 2021 Structured Data StreamingApache Con 2021 Structured Data Streaming
Apache Con 2021 Structured Data Streaming
 
Echoes Project
Echoes ProjectEchoes Project
Echoes Project
 
Mahout Tutorial and Hands-on (version 2015)
Mahout Tutorial and Hands-on (version 2015)Mahout Tutorial and Hands-on (version 2015)
Mahout Tutorial and Hands-on (version 2015)
 
Produce and consume_linked_data_with_drupal
Produce and consume_linked_data_with_drupalProduce and consume_linked_data_with_drupal
Produce and consume_linked_data_with_drupal
 
Rdap12 wrap up reagan moore
Rdap12 wrap up reagan mooreRdap12 wrap up reagan moore
Rdap12 wrap up reagan moore
 
DOXLON November 2016 - Data Democratization Using Splunk
DOXLON November 2016 - Data Democratization Using SplunkDOXLON November 2016 - Data Democratization Using Splunk
DOXLON November 2016 - Data Democratization Using Splunk
 
JCR - Java Content Repositories
JCR - Java Content RepositoriesJCR - Java Content Repositories
JCR - Java Content Repositories
 

Recently uploaded

What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutionsmonugehlot87
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 

Recently uploaded (20)

What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutions
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 

Synthetic models

  • 1. SYNTHETIC MODELS by Zoran Nikolovski
  • 3. • Traditional web frameworks – Resolve a Controller based on the data type – Elaborate mechanics to load the data • Sling – A web framework based entirely on REST principals – The data is at the center or the process – Everything is a Resource
  • 4. • Sling maintains a virtual tree of resources • Each Resource type has a ResourceProvider which provides the root of its resolution path • Resource types in the tree – JCR nodes – File System – Bundles – Servlets – Other (Non-JCR) Resources System provided
  • 5. • Resolving a Resource is simple The ResourceResolver takes in the resource path
  • 6. • Resolving a Resource is simple It identifies a suitable ResourceProvider The ResourceResolver takes in the resource path
  • 7. Which calls it’s getResource method • Resolving a Resource is simple It identifies a suitable ResourceProvider The ResourceResolver will take in the resource path
  • 8. And provide us with the right Resource Which calls it’s getResource method • Resolving a Resource is simple It identifies a suitable ResourceProvider The ResourceResolver takes in the resource path
  • 9. • Resource is a central concept to Sling • Has a number of essential properties – Including a reference to the rendering script • Can be adapted to other compatible types • It’s the starting point in any domain modelling in Sling
  • 11. • With Sling, domain modelling should be done against resources • Each Resource is a collection of properties – Entirely defined in the repository – Uniquely identified by it’s sling:resourceType • The domain model thus is a representation of the type and properties
  • 12. • There are MANY ways to implement your domain model – Direct access to resource properties from the view – A custom mapping framework – Cognifide’s Slice framework – Sling Models (available in AEM6 as a standard) – Neba.io My new favorite!
  • 13. What if your domain is NOT uniquely defined in the repository? • Legacy Apps • 3rd party services • CRMs • ERPs
  • 14. Ask yourselves: • How do we bring this data into our application? • How do we expose it to the UI? • How do we maintain Sling’s RESTful principles? question mark on road: image via Flickr/ milos milosevic
  • 16. • Synthetic Models – Define domain objects where the domain is not exclusive to the content repository – Their property collection is defined against all data sources – Must be resolvable by Sling’s resource resolution mechanism – Leverage the Presentation Model design pattern – Name is inspired by SyntheticResource
  • 17.
  • 18. • Synthetic Model – They inherently rely on Sling’s resource resolution mechanism – A ResourceProvider is required for each external domain object • Think of this as writing a service to expose the external data – These ResourceProviders will return either an instance of SyntheticResource or a custom Resource implementation • I’d advise caution when deciding on a custom Resource implementation
  • 19. Writing your Synthetic Models with Neba.io • Using Neba.io makes it easy! – In reality you can achieve this with most of the mapping frameworks especially Sling Models • Annotation driven • Integrates the Spring Framework in Sling • Main features – Resource Models – Spring MVC
  • 20. @ResourceModel(types = "/apps/synthetic-models/components/book") public class Book { @This private Resource resource; @Path("/content/book-store/bookinfo/${isbn}") private Resource bookInfo; private String isbn; private String imagePath; private String title; private String description; private String genre; private String author; The Synthetic Model A JCR resource reference External resource reference Synthetic Model Example
  • 21. ResourceProvider example @Component(metatype = false) @Service @Properties({ @Property(name="service.description", value="A DB backed Book Resource"), @Property(name="service.vendor", value="Odecee Pty Ltd"), @Property(name=ResourceProvider.ROOTS, value="/content/book-store/bookinfo"), @Property(name=SlingConstants.PROPERTY_RESOURCE_TYPE, value="/apps/synthetic-models/ components/book/book.jsp") }) public class BookResourceProviderImpl implements BookResourceProvider {
  • 22. DEMO
  • 24. THANK YOU! • Code: http://bit.ly/1tWgSbg • Presentation: SlideShare

Editor's Notes

  1. Ever since the first time I installed AEM or CQ5 two things stood out for me: it took 5 minutes to get it going especially considering that I was also trying to setup Oracle’s WebCenter sites for an ongoing project for two days and it’s resource resolution.   While everyone appreciates a system that’s this easy to stand up, it’s the resource resolution that was the main attraction foe me. You see, the first project I ever worked on as a developer was a custom built CMS that, as any other Java web application 10 years ago, relied on Tomcat, a database and XML. And at the heart of it was a class called DummyXMLCapable. This class was responsible for parsing through the stored XML object, resolving each component and transforming it to it’s HTML form. And it was complex beyond anything I’ve seen until then but truly remarkable! It made our work, which was to enhance the available components portfolio, significantly easier. All we needed to do was write the component code and the system knew how to interpret and resolve it. This is exactly what I saw in Sling’s resource resolution and what initially drew my attention to the “Everything is content” paradigm.
  2. So why is resource resolution so important? Traditional Web Application frameworks employ fairly elaborate methods to select a Servlet or Controller based on the data type identified from the request, which in turn tries to load some data (usually from a database) to act upon and finally to somehow render the result. Sling turns this process around in that it places the data to act upon at the center by using the request URL to first resolve it before identifying the script that will render it. This data is internally represented as an instance of the Resource API. Based on the resolved resource type as well as it’s properties Sling select a script or servlet that will handle the processing or rendering. Hence in Sling “Everything is a Resource”.
  3. Sling maps the content repository as a virtual tree of resources based on their path. This concept revolves around two API’s – the ResourceResolver which is used to resolve Resources and the ResourceProvider that is used by the ResourceResolver to transparently access resources across different locations. There are four system provided types of resources: JCR nodes File system resources Bundles Servlets Sling allows for non-JCR resources to be mapped in the tree
  4. This slide: First instruct the ResourceResolver to find a resource based on it’s path Next slide: The resolver finds the ResourceProvider whose root path matches closest to the path provided The resource provider provides the resource by calling it’s own getResource method Which will provide the right Resource
  5. First instruct the ResourceResolver to find a resource based on it’s path This slide: The resolver finds the ResourceProvider whose root path matches closest to the path provided Next slide: The resource provider provides the resource by calling it’s own getResource method Which will provide the right Resource
  6. First instruct the ResourceResolver to find a resource based on it’s path The resolver finds the ResourceProvider whose root path matches closest to the path provided This slide: The resource provider provides the resource by calling it’s own getResource method Next slide: Which will provide the right Resource
  7. First instruct the ResourceResolver to find a resource based on it’s path The resolver finds the ResourceProvider whose root path matches closest to the path provided The resource provider provides the resource by calling it’s own getResource method This slide: Which will provide the right Resource
  8. Given resource resolution is one of the main features of Sling, the Resource API is definitely one of it’s core concepts The Resource API provides several essential properties including the type of the resource, the path or the location in the virtual tree, it’s name, the super type or the type of the parent if applicable (where is this used?), and resource metadata which we will leverage in the demo. The Resource API follows the adapter pattern defined in Sling by providing an adaptTo method which allows for a Resource object to be adapted to an instance of any compatible class. It is also the starting point in any domain modelling or domain mapping concept in Sling
  9. So what happens when you want to define a domain model using the Resource API in Sling?
  10. A colleague of mine wrote an exceptionally lightweight and functional mapping framework that we’ve successfully used in many projects. We used Slice in a project for a major client but I personally found it a bit bloated and sluggish. Sling Models is also available as a standalone bundle that you can retrofit in older versions of AEM (5.6+)
  11. Today’s enterprise solutions are more often than not realised through multiple systems which from a business perspective are expected to work as a single entity, which means that information from one system should be “seamlessly” available in other systems. Sometimes this is easy to achieve, for example, synchronising your product data from Hybris into AEM or customer information between AEM and Salesforce as there are built in adapters that make it possible. But what about legacy apps or 3rd party services that your clients can use to “enhance” the product information they provide? These require development efforts that can be significant to make available.
  12. Usually, when our data is located in a system that’s not directly accessible by our AEM package via a ready-made adapter, the way to solve this problem is by implementing a service that will wrap around the data source endpoint and a separate domain model that maps to the expected output of the data source. Now, while this is perfectly fine as a solution it does have some drawbacks in the AEM world and it’s technology stack. The service calls would need to be mapped in the dispatcher and allowed through, the data brought in this way won’t be content authorable (should that be a requirement), the UI will be tightly coupled to the service you just wrote. Synthetic models are a simpler and cleaner way to not only bring in this external data into your domain but also expose it to AEM in such a way that’s easy for it’s technology stack to understand and action it.
  13. Synthetic Models are not a new concept – but the concept is rarely used when developing in AEM/Sling/JCR. They Define domain objects where the domain is not exclusive to the content repository Their property collection is defined against the data from each data source Must be orchestrated by Sling’s resource resolution mechanism Leverage the Presentation Model design pattern Name is inspired by the SyntheticResource class This definition came out of several past experiences where data from external sources was required to be brought into AEM and exposed to the presentation layer as if it was content. Also through research on the problem I cam upon the SyntheticResource class. Think of it as the lesser-known cousin of Resource. It is often used to define resource objects that don’t exist in the JCR content tree or resources that are created at run-time
  14. Lets say that we need to display information about a book. The information is partially in the JCR and partially in an external data source, in this case a database. We define our BookSyntheticModel as the model of our component. The component is aware of the properties the model provides but not where they are coming from so they are completely encapsulated by our Synthetic Model. The BookSyntheticModel interacts with both the JCRBook and the DBBook Resource to provide a single properties collection to the component.
  15. Custom Resource implementations should be achieved by extending the ResourceWrapper or the AbstractResource classes to ensure that all methods of the Resource interface are implemented even when the API gets updated
  16. NEBA integrates the Spring Framework into Sling. It makes available all of Spring's features to allow using mature, best-practice solutions for the majority of system-level concerns common to Sling-based applications. NEBA does so in full compliance with the open core philosophy - using exclusively mature, standardized open source software - gemini blueprint - for the integration into OSGi. All Spring and Sling features are accessible to developers using a lightweight, well documented API that does not couple the domain -specific implementation code to any implementation details of Sling, Spring or NEBA. Principles: Zero interference: Do not alter any Sling or system behavior Zero coupling: Software using NEBA must not depend on NEBA implementation code and vice-versa. Further composition: Allow transparently using NEBA from standard Sling components and vice-versa. Further best practices: Guide users towards using REST and adapter factories, leverage the Sling resource type system Semantics first: Users shall express intent using @Semantic annotations instead of implementing or providing configuration. Be optional: Users may or may not decide to use NEBA
  17. So lets combine all the pieces and see how a Synthetic model would look like. As you can see from the code it doesn’t look much different from any other model. The only difference is the extra Resource that we’re bringing into our class that represents the external book data source.
  18. So lets combine all the pieces and see how a Synthetic model would look like. As you can see from the code it doesn’t look much different from any other model. The only difference is the extra Resource that we’re bringing into our class that represents the external book data source.