Transcript

Deep Dive – Alfresco Core Repository

Credits:  h+p://www.redbullstratos.com/  

… embedded in a micro-services style architecture!

Jan Vonka London, October 2014

Intro Jan Vonka!•  Senior Software Engineer @ Alfresco •  Core Repo’ Services •  Cloud & Hybrid Platform

•  Fly balloons

Deep Dive: Core Repository !•  Repository Architecture!•  Diving in to the core …

•  Micro-Services overview !•  Intelligent Process App example …

Alfresco …

Context Content

Collaborate

Control

Customise Connect

Cloud

Configure

Why should you dive in ? •  Spectrum of solutions!•  Out-Of-The-Box => Configure => Integrate •  Extend => Customise => Embed (“modular”)

Gain deeper understanding!•  Develop, test & contribute •  Troubleshoot issues – functional, perf’, …

Caveat •  Use the Alfresco APIs & SDKs!•  Well-defined, supported, On-Premise & Cloud •  CMIS 1.1 & REST •  Alfresco SDK 2.0 (Maven + Java) •  Mobile SDK (iOS & Android)

•  Custom (JavaScript or Java)!•  Repo extensions – WebScripts + (new) Services •  Content Models - Policies & Behaviours

Repository Architecture - overview

Repo Architecture Overview

CMIS  REST  /  WebScripts  

Protocols  

Web  Apps   Desktop  Apps  Mobile  Apps  

Sync  

Mobile  SDK  Share  

Alfresco  Office  Services  (AOS)  

Anatomy of the Repo !

Alfresco Repository

DB Storage (Tables)

Core Foundation Services

Subsystems Content Models + Behaviours

Collaborative Services

ThirdParty Libraries & Frameworks: including Spring Framework+Security / MyBatis (JDBC) / Solr+Lucene / Hazelcast

Remote APIs (CMIS & WebScripts)

Content/Object Storage (Binary Files)

Search Storage (Indexes)

Transactions + Security

Protocols (WebDAV, SPP, IMAP, FTP, CIFS, SMTP, LDAP…)

Diving in …

Alfresco *Services (some)

Content  &  Mimetype  

FileFolder  

Script  &  Template  (eg.  JS  &  FM)  

DicOonary  &  Namespace  

Permission,  AuthenOcaOon  &  Authority  

Node  &  Version  

WebScript   CMIS   Protocols  (WebDAV,  SPP,  IMAP,  FTP,  CIFS,  SMTP,  LDAP…)  

Site  

Copy  CheckOutCheckIn  &  Lock  

Thumbnail  &  RendiOon   Transform  (+  Metadata  Extract  &  Embed)  

Rule  &  AcOon  

AcOvity  &  SubscripOon  

Workflow  (AcOviO  or  JBPM)  

Person  &  Ownable  

TransacOon  

Import  &  Export  

Tagging  QuickShare  

Audit  &  A+ribute  

Category  

Search  (Index  &  Query)  

ContentUsage  

Tenant  &  RepoAdmin  

Artifacts & Projects

•  Maven SDK!•  Eclipse Projects!•  …. •  Remote-API •  Repository •  Data-Model •  Core

Java Services •  Refer to:!•  Service Registry (ServiceRegistry.java) •  Spring Configuration (*-context.xml)

•  public-services-context.xml •  core-context.xml

•  Foundation services include:!•  NodeService •  ContentService •  SearchService •  ….

Spring config: *-context.xml core-context.xml

<bean id="checkOutCheckInService" class="org.alfresco.repo.coci.CheckOutCheckInServiceImpl" init-

method="init”>

<property name="nodeService" ref="nodeService" />

<property name="versionService" ref="versionService" />

<property name="ruleService" ref="ruleService" />

<property name="lockService" ref="LockService" />

<property name="ownableService" ref="OwnableService" />

<property name="copyService" ref="CopyService" />

<property name="authenticationService" ref="authenticationService" />

<property name="fileFolderService" ref="fileFolderService" />

<property name="policyComponent" ref="policyComponent" />

<property name="behaviourFilter" ref="policyBehaviourFilter" />

…….

model-specific-services-context.xml

<bean name="fileFolderService" class="org.alfresco.repo.model.filefolder.FileFolderServiceImpl" init-

method="init" parent="abstractBaseCopyService">

<property name="namespaceService"><ref bean="namespaceService" /></property>

<property name="dictionaryService"><ref bean="dictionaryService" /></property>

<property name="nodeService"><ref bean="nodeService" /></property>

<property name="copyService"><ref bean="copyService" /></property>

<property name="searchService"><ref bean="admSearchService" /></property>

<property name="contentService"><ref bean="contentService" /></property>

<property name="mimetypeService"><ref bean="mimetypeService" /></property>

……

Models & Definitions … •  Content Models!•  contentModel.xml •  dictionaryModel.xml •  … *Model.xml

•  Security & Permissions!•  public-services-security.xml •  permissionDefinitions.xml

Data Access Objects (DAOs) •  Java Interfaces & Implementations!•  Package: org.alfresco.repo.domain •  *DAO.java, *DAOImpl.java

•  MyBatis SQL mapper!•  (fully) since 3.2.x - also used by Activiti •  mostly common ANSI SQL •  dialect-specific SQL (extended config builder) •  see *SqlMap.xml

•  DomainTestSuite!•  see DAO unit tests

DB types !!!!!!!

Enterprise Community

(*) subject to change - refer to certified stacks (**) dev/test only - see for example Alfresco SDK 2.0 (Maven-based) or Activiti

(**)

Alf_* DB schema (partial)

!

Node  Store  Node_ProperOes  

Node_Aspects  

Child_Assoc  (parent/child)  

Node_Assoc  (source/target)  

Qname   Namespace  

TransacOon   Server  

Locale  

Encoding  

Mimetype  

Content_Data  

Content_Url  

Alf_* DB schema

Micro-Services - overview

Micro-services overview •  Architectural style!•  suite of “small” independently deployable services •  each is simple & specific – do “one” thing well

•  Distributed services & data!•  separate loosely-coupled process •  collaborate - (light-weight) communication

•  In theory, can be …!•  independently: develop, deploy, scale, manage •  heterogeneous teams, languages, stacks, protocols

Micro-services overview (cont)

•  Benefits & drawbacks!•  Dev-QA-Ops spectrum •  people, ownership, process, automation •  Continuous: Integration, QA, Deployment, Monitoring •  Encourages modular structure •  API contracts & versioning •  more moving parts, network hops (latency), …

Repo -> “micro” services

Core  Repository  Services  

Remote  APIs  

Search  Server  (eg.  Solr)   TransformaOon  Server   Process  Server  

Search   Transform   Workflow  

Micro-service – Java example •  HTTP+JSON, Java, RESTful, !•  JAX-RS •  Content + Context (Nodes & Metadata)

•  Dropwizard + Metrics!•  Jetty, Jersey, Jackson

•  Spring Boot / MVC / Framework!•  Jetty (or Tomcat), Jackson, Metrics …

Repo Core – Hello World #1

GET http://localhost:9080/alfresco/stores!![!{"storeRef":"archive://SpacesStore", "nodeRefId":"0add797f-9145-43e4-80d5-ba7b5fc254fa"},!{"storeRef":"system://system","nodeRefId":"aab26f2c-8bdd-465e-90ab-396d9187caa4"},!{"storeRef":"user://alfrescoUserStore","nodeRefId":"0227c38d-77b7-4a31-922f-6040e8d39d1a"},!{"storeRef":"workspace://lightWeightVersionStore","nodeRefId":"7688b848-ba24-4a03-bb45-75ea6c7e51c5"},!{"storeRef":"workspace://SpacesStore","nodeRefId":"79fd9404-1f12-4999-8d92-58df9309558b"},!{"storeRef":"workspace://version2Store","nodeRefId":"7cefae72-7809-4869-94cc-d65e37a762f1"}!]!

List stores & root nodes

Repo Core – Hello World #2 Repo Node Browser

Micro-service articles •  Some examples ….!

•  http://martinfowler.com/articles/microservices.html

•  http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html

•  http://highscalability.com/blog/2014/7/28/the-great-microservices-vs-monolithic-apps-twitter-melee.html

•  ….

Smart Process Apps – example

Smart (Intelligent) Process Apps •  Process-centric, Task-based!•  Collaborative & Social !•  Case Management - Adaptable & Dynamic!•  Context, Content, Control …!•  Configurable (eg. per-tenant, per-app)!•  Simple + Smart J !

SPA Platform Services (example)

!

Content / Metadata Workflow (Process / Task)

Transform Search (Index / Query)

Case/Review APIs + Services

Identity Mgmt (Auth)

App Def (Config)

Streaming Services

Content Storage

Metadata DB

Workflow DB

Search Indexes

Other DBs (RDBMS, NoSQL, …)

App1

App3

App2

App4

Smart Process App (example)

!

Recap + Q&A

Recap •  Repository Architecture!•  Diving in deeper to the core!•  Micro-services overview!•  Intelligent Process App example!•  Further details …!

Questions & Feedback •  Thank you J !!

Further details

•  Source (SVN)!•  Test code – unit & system!•  http://docs.alfresco.com!•  Add-Ons & Extensions!•  Wiki, Forums, Blogs, JIRA!•  Developer books!•  Training courses!


Top Related