SlideShare ist ein Scribd-Unternehmen logo
1 von 37
Downloaden Sie, um offline zu lesen
Globalcode	
  –	
  Open4education
Suportando Aplicações
Multi-tenancy com Java EE
Rodrigo Cândido da Silva
@rcandidosilva
Globalcode	
  –	
  Open4education
Agenda
!   Modelos de Serviço
!   SaaS Market
!   Multi-tenancy
!  Desafios
!  Pros and Cons
!  Tipos de Implementação
!   Java EE + Multi-tenancy
!   Segurança + Multi-tenancy
!   Cloud + Multi-tenancy
!   JVM Multi-tenancy
Globalcode	
  –	
  Open4education
Modelos de Serviço
Globalcode	
  –	
  Open4education
SaaS Market
Globalcode	
  –	
  Open4education
Multi-tenancy
!   Uma única instância
da aplicação
atendendo múltiplos
clientes (tenant)
! Contrário da
arquitetura de
múltiplas instâncias
Globalcode	
  –	
  Open4education
Multi-instances vs. Multi-tenant
Globalcode	
  –	
  Open4education
Cloud != Multi-tenancy
Globalcode	
  –	
  Open4education
Desafios
!   Separação dos dados
!   Personalização
!   Controle de acesso
!   Provisionamento de recursos
!   Integrações
!   Atualização da aplicação
!   Recuperação à falhas
Globalcode	
  –	
  Open4education
Pros and Cons
!   Pros
! Reduz o custo de manutenção
! Único código para todos os clientes
! Aumenta a escalabilidade
! Beneficia compartilhamento recursos entre clientes
!   Cons
! Aumenta a complexidade
! Separação por tenant-id
! Maior risco de falhas
! Quebra da aplicação compartilhada para todos clientes
! Reduz a flexibilidade para os clientes
Globalcode	
  –	
  Open4education
Multi-tenancy
!   4 possíveis níveis implementações
! Nível 1 (Personalizado)
!  [N] aplicações e [N] databases
! Nível 2 (Configurável)
!  [1] aplicação e [N] databases
! Nível 3 (Configurável e eficiente)
!  [N] aplicações e [1] database
! Nível 4 (Escalável, configurável e eficiente)
!  [1] aplicação e [1] database
Globalcode	
  –	
  Open4education
Nível 1 - Personalizado
!   [N] aplicações e [N] databases
Globalcode	
  –	
  Open4education
Nível 2 - Configurável
!   [1] aplicação e [N] databases
Globalcode	
  –	
  Open4education
Nível 3 - Eficiente
!   [N] aplicações e [1] database
Globalcode	
  –	
  Open4education
Nível 4 - Escalável
!   [1] aplicação e [1] database
Globalcode	
  –	
  Open4education
Java EE + Multi-tenancy
!   Database
!  JPA + Multi-tenancy
!   Customização UI
!  JSF + Multi-tenancy
!   Segurança
!   Java EE 8 com suporte Cloud
Globalcode	
  –	
  Open4education
JPA + Multi-tenancy
!   EclipseLink
!  Suporte a multi-tenancy @Multitenant
!  Disponibiliza 3 estratégias
!  @Multitenant(SINGLE_TABLE) – default
!  @Multitenant(TABLE_PER_TENANT)
!  @Multitenant(VPD)
!  Shared Cache by tenant
Globalcode	
  –	
  Open4education
EclipseLink SINGLE_TABLE
@Entity
@Table(name=“EMP”)
@Multitenant(SINGLE_TABLE)
@TenantDiscriminatorColumn(name = “TENANT_ID”,
contextProperty = “tenant-id”)
public class Employee {
...
}
HashMap properties = new HashMap();
properties.put("tenant.id", "707");
...
EntityManager em = Persistence
.createEntityManagerFactory(
"multi-tenant”,properties)
.createEntityManager();
<persistence-unit name="multi-tenant">
...
<properties>
<property name="tenant.id"
value="707"/>
...
</properties>
</persistence-unit>
Globalcode	
  –	
  Open4education
EclipseLink TABLE_PER_TENANT
<entity class="Employee">
<multitenant type="TABLE_PER_TENANT">
<tenant-table-discriminator type="SCHEMA" context-
property="eclipselink.tenant-id"/>
</multitenant>
<table name="EMP">
...
</entity>
@Entity
@Table(name=“EMP”)
@Multitenant(TABLE_PER_TENANT)
@TenantTableDiscriminator(type=SCHEMA,
contextProperty="eclipselink.tenant-id")
public class Employee {
...
}
Globalcode	
  –	
  Open4education
EclipseLink VPD
@Entity
@Multitenant
@TenantDiscriminatorColumn(name = "USER_ID",
contextProperty = "tenant.id")
@Cacheable(false)
public class Task implements Serializable {
...
CALL DBMS_RLS.ADD_POLICY
('SCOTT', 'TASK', 'todo_list_policy',
'SCOTT', 'ident_func', 'select, update,
delete'));
<properties>
<property name="eclipselink.session.customizer"
value="example.VPDSessionCustomizer" />
<property name="eclipselink.session-event-listener"
value="example.VPDSessionEventAdapter" />
<property
name="eclipselink.jdbc.exclusive-connection.mode"
value="Always" />
</properties>
Globalcode	
  –	
  Open4education
JPA Caching
!   Shared Cache disabled
Globalcode	
  –	
  Open4education
JPA Caching
!   Shared Cache by tenant
Globalcode	
  –	
  Open4education
JSF + Multi-tenancy
!   Arquitetura extensível
!   Artefatos podem ser encapsulados em JARs
!   Composição at runtime
!   Templates
!   Resource library
!   Look-and-feel customization
!   RenderKit
!   Localization
Globalcode	
  –	
  Open4education
JSF Facelets
The Facelets Gazette
Site
Navigation
●Events
●Docs
●Forums
About Contact Site Map
Template File name
_template.html
Insertion points
Resources
css classes, scripts, images
Globalcode	
  –	
  Open4education
JSF Multi-templating
contractA
• Declared Templates
• Declared Insertion Points
• Declared Resources
contractB
• Declared Templates
• Declared Insertion Points
• Declared Resources
contractC
• Declared Templates
• Declared Insertion Points
• Declared Resources
<web-app-root>/contracts
contractD
• Declared Templates
• Declared Insertion Points
• Declared Resources
contractE
• Declared Templates
• Declared Insertion Points
• Declared Resources
contractF
• Declared Templates
• Declared Insertion Points
• Declared Resources
JAR files in WEB-INF/lib
contractA
• Declared Templates
• Declared Insertion Points
• Declared Resources
contractB
• Declared Templates
• Declared Insertion Points
• Declared Resources
contractC
• Declared Templates
• Declared Insertion Points
• Declared Resources
<web-app-root>/contracts
contractD
• Declared Templates
• Declared Insertion Points
• Declared Resources
contractE
• Declared Templates
• Declared Insertion Points
• Declared Resources
contractF
• Declared Templates
• Declared Insertion Points
• Declared Resources
JAR files in WEB-INF/lib
Set of available contracts
Facelet 1 Facelet 3Facelet 2
faces-config.xml
Globalcode	
  –	
  Open4education
JSF Multi-templating
<html xmlns="http://www.w3.org/1999/xhtml”
xmlns:h="http://java.sun.com/jsf/html”
xmlns:ui="http://java.sun.com/jsf/
facelets">
<body>
<ui:composition template="#{template}”>
...
</ui:composition>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<context-param>
<param-name>javax.faces.view.TEMPLATE</param-
name>
<param-value>mybusiness</param-value>
</context-param>
</web-app>
Globalcode	
  –	
  Open4education
Segurança + Multi-tenancy
!   PicketLink
!  Java EE security framework
!  Identity Management (IDM)
!  Federation support (SAML, OAuth2, OpenID)
!  Social Login support
!  Multi-tenancy support
Globalcode	
  –	
  Open4education
Picketlink
Globalcode	
  –	
  Open4education
Picketlink
@Named
public class RealmSelector implements
Serializable {
@Inject
private PartitionManager partitionManager;
private Realm realm;
@Produces
@PicketLink
public Realm select() {
return this.realm;
}
…
}
@RequestScoped
public class LoginController {
@Inject
private Identity identity;
public String login() {
this.identity.login();
…
}
public String logout() {
this.identity.logout();
return "/home.xhtml";
}
}
public class Resources {
public enum REALM {acme, umbrella,
wayne}
@Produces
@Named("supportedRealms")
public Enum[] supportedRealms() {
return REALM.values();
}
Globalcode	
  –	
  Open4education
Cloud + Multi-tenancy
!   Namespace API
! com.google.appengine.api.NamespaceManager
! Suporte aos seguintes serviços
!  Google Datastore
! Memcached
!  Task Queue
!  Search
Globalcode	
  –	
  Open4education
Namespace API
// Filter to set the Google Apps
// domain as the namespace.
public class NamespaceFilter implements javax.servlet.Filter {
@Override
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
// Make sure set() is only called if the current namespace is not
already set.
if (NamespaceManager.get() == null) {
NamespaceManager.set(NamespaceManager.getGoogleAppsNamespace());
}
}
}
// Assuming there is a logged in user.
namespace = UserServiceFactory.getUserService()
.getCurrentUser().getUserId();
NamespaceManager.set(namespace);
<filter>
<filter-name>NamespaceFilter</filter-name>
<filter-class>package.NamespaceFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>NamespaceFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Globalcode	
  –	
  Open4education
Namespace API
!   Search
// Set the current namespace to "aSpace"
NamespaceManager.set("aSpace");
// Create a SearchService with the namespace "aSpace"
SearchService searchService =
SearchServiceFactory.getSearchService();
// Create a MemcacheService that uses the namespace "abc".
MemcacheService explicit =
MemcacheServiceFactory.getMemcacheService("abc");
explicit.put("key", value); // stores value in namespace "abc"
// Increment the count for the current namespace asynchronously.
QueueFactory.getDefaultQueue().add(
TaskOptions.Builder.url("/_ah/update_count")
.param("countName", "SomeRequest"));
!   Memcached
!   Task Queue
Globalcode	
  –	
  Open4education
JVM + Multi-tenancy
!   Multi-tenancy no nível da JVM
!   IBM SDK JVM
!   Static field isolation
!   Controle by tenant
!   CPU time
!   Heap size
!   Thread count
!   File IO, Socket IO
!   Limitações
!   Java Native Interface (JNI)
!   JVMT (Tool interface)
!   GUI Libraries (GWT, Swing, etc)
!   EXPERIMENTAL !!!
Globalcode	
  –	
  Open4education
JVM + Multi-tenancy
Globalcode	
  –	
  Open4education
JVM + Multi-tenancy
Globalcode	
  –	
  Open4education
Perguntas
?
Globalcode	
  –	
  Open4education
Referências
! http://msdn.microsoft.com/en-us/library/aa479086.aspx
! https://developers.google.com/appengine/docs/java/multitenancy/
! http://www.ibm.com/developerworks/java/library/j-multitenant-java/index.html
! http://www.eclipse.org/eclipselink/documentation/2.4/jpa/extensions/
a_multitenant.htm
! http://2012.con-fess.com/sessions/-/details/122/JSF-and-JavaEE-7-for-multi-
tenant-applications
! http://jdevelopment.nl/jsf-22/
! http://picketlink.org
! https://developers.google.com/appengine/docs/java/multitenancy/
! http://www.jboss.org/quickstarts/picketlink/picketlink-authentication-idm-multi-
tenancy/
! http://wiki.eclipse.org/EclipseLink/Examples/MySports
Globalcode	
  –	
  Open4education
Obrigado!
@rcandidosilva
rodrigocandido.me

Weitere ähnliche Inhalte

Andere mochten auch

Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015Innomatic Platform
 
JavaOne LATAM 2015 - Batch Processing: Processamento em Lotes no Mundo Corpor...
JavaOne LATAM 2015 - Batch Processing: Processamento em Lotes no Mundo Corpor...JavaOne LATAM 2015 - Batch Processing: Processamento em Lotes no Mundo Corpor...
JavaOne LATAM 2015 - Batch Processing: Processamento em Lotes no Mundo Corpor...Rodrigo Cândido da Silva
 
JavaOne LATAM 2016 - Combinando AngularJS com Java EE
JavaOne LATAM 2016 - Combinando AngularJS com Java EEJavaOne LATAM 2016 - Combinando AngularJS com Java EE
JavaOne LATAM 2016 - Combinando AngularJS com Java EERodrigo Cândido da Silva
 
JavaOne LATAM 2016 - RESTful Services Simplificado com Spring Data REST
JavaOne LATAM 2016 - RESTful Services Simplificado com Spring Data RESTJavaOne LATAM 2016 - RESTful Services Simplificado com Spring Data REST
JavaOne LATAM 2016 - RESTful Services Simplificado com Spring Data RESTRodrigo Cândido da Silva
 
Batch Processing - Processamento em Lotes no Mundo Corporativo
Batch Processing - Processamento em Lotes no Mundo CorporativoBatch Processing - Processamento em Lotes no Mundo Corporativo
Batch Processing - Processamento em Lotes no Mundo CorporativoRodrigo Cândido da Silva
 
GUJavaSC - Criando Micro-serviços Reativos com Java
GUJavaSC - Criando Micro-serviços Reativos com JavaGUJavaSC - Criando Micro-serviços Reativos com Java
GUJavaSC - Criando Micro-serviços Reativos com JavaRodrigo Cândido da Silva
 
TDC 2015 - Segurança em Recursos RESTful com OAuth2
TDC 2015 - Segurança em Recursos RESTful com OAuth2TDC 2015 - Segurança em Recursos RESTful com OAuth2
TDC 2015 - Segurança em Recursos RESTful com OAuth2Rodrigo Cândido da Silva
 
Multi-Tenancy with Spring Boot
Multi-Tenancy with Spring Boot Multi-Tenancy with Spring Boot
Multi-Tenancy with Spring Boot Stormpath
 
TDC Floripa 2016 - Decolando seus micro-serviços na Spring Cloud
TDC Floripa 2016 - Decolando seus micro-serviços na Spring CloudTDC Floripa 2016 - Decolando seus micro-serviços na Spring Cloud
TDC Floripa 2016 - Decolando seus micro-serviços na Spring CloudRodrigo Cândido da Silva
 
JavaOne 2016 - Reactive Microservices with Java and Java EE
JavaOne 2016 - Reactive Microservices with Java and Java EEJavaOne 2016 - Reactive Microservices with Java and Java EE
JavaOne 2016 - Reactive Microservices with Java and Java EERodrigo Cândido da Silva
 
QCon 2015 - Combinando AngularJS com Java EE
QCon 2015 - Combinando AngularJS com Java EEQCon 2015 - Combinando AngularJS com Java EE
QCon 2015 - Combinando AngularJS com Java EERodrigo Cândido da Silva
 
ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2Rodrigo Cândido da Silva
 
How to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring EditionHow to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring EditionStephan Hochdörfer
 
QCon SP 2016 - Construindo Microservices Auto-curáveis com Spring Cloud e Net...
QCon SP 2016 - Construindo Microservices Auto-curáveis com Spring Cloud e Net...QCon SP 2016 - Construindo Microservices Auto-curáveis com Spring Cloud e Net...
QCon SP 2016 - Construindo Microservices Auto-curáveis com Spring Cloud e Net...Rodrigo Cândido da Silva
 
JavaOne 2014 - Securing RESTful Resources with OAuth2
JavaOne 2014 - Securing RESTful Resources with OAuth2JavaOne 2014 - Securing RESTful Resources with OAuth2
JavaOne 2014 - Securing RESTful Resources with OAuth2Rodrigo Cândido da Silva
 
ConFoo 2015 - Supporting Multi-tenancy Applications with Java EE
ConFoo 2015 - Supporting Multi-tenancy Applications with Java EEConFoo 2015 - Supporting Multi-tenancy Applications with Java EE
ConFoo 2015 - Supporting Multi-tenancy Applications with Java EERodrigo Cândido da Silva
 

Andere mochten auch (19)

GUJavaSC - Mini-curso Java EE
GUJavaSC - Mini-curso Java EEGUJavaSC - Mini-curso Java EE
GUJavaSC - Mini-curso Java EE
 
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
Building Multi-Tenant and SaaS products in PHP - CloudConf 2015
 
GUJavaSC - Java EE 7 In Action
GUJavaSC - Java EE 7 In ActionGUJavaSC - Java EE 7 In Action
GUJavaSC - Java EE 7 In Action
 
JavaOne LATAM 2015 - Batch Processing: Processamento em Lotes no Mundo Corpor...
JavaOne LATAM 2015 - Batch Processing: Processamento em Lotes no Mundo Corpor...JavaOne LATAM 2015 - Batch Processing: Processamento em Lotes no Mundo Corpor...
JavaOne LATAM 2015 - Batch Processing: Processamento em Lotes no Mundo Corpor...
 
JavaOne LATAM 2016 - Combinando AngularJS com Java EE
JavaOne LATAM 2016 - Combinando AngularJS com Java EEJavaOne LATAM 2016 - Combinando AngularJS com Java EE
JavaOne LATAM 2016 - Combinando AngularJS com Java EE
 
JavaOne LATAM 2016 - RESTful Services Simplificado com Spring Data REST
JavaOne LATAM 2016 - RESTful Services Simplificado com Spring Data RESTJavaOne LATAM 2016 - RESTful Services Simplificado com Spring Data REST
JavaOne LATAM 2016 - RESTful Services Simplificado com Spring Data REST
 
Batch Processing - Processamento em Lotes no Mundo Corporativo
Batch Processing - Processamento em Lotes no Mundo CorporativoBatch Processing - Processamento em Lotes no Mundo Corporativo
Batch Processing - Processamento em Lotes no Mundo Corporativo
 
GUJavaSC - Criando Micro-serviços Reativos com Java
GUJavaSC - Criando Micro-serviços Reativos com JavaGUJavaSC - Criando Micro-serviços Reativos com Java
GUJavaSC - Criando Micro-serviços Reativos com Java
 
TDC 2015 - Segurança em Recursos RESTful com OAuth2
TDC 2015 - Segurança em Recursos RESTful com OAuth2TDC 2015 - Segurança em Recursos RESTful com OAuth2
TDC 2015 - Segurança em Recursos RESTful com OAuth2
 
GUJavaSC - Combinando AngularJS com Java EE
GUJavaSC - Combinando AngularJS com Java EEGUJavaSC - Combinando AngularJS com Java EE
GUJavaSC - Combinando AngularJS com Java EE
 
Multi-Tenancy with Spring Boot
Multi-Tenancy with Spring Boot Multi-Tenancy with Spring Boot
Multi-Tenancy with Spring Boot
 
TDC Floripa 2016 - Decolando seus micro-serviços na Spring Cloud
TDC Floripa 2016 - Decolando seus micro-serviços na Spring CloudTDC Floripa 2016 - Decolando seus micro-serviços na Spring Cloud
TDC Floripa 2016 - Decolando seus micro-serviços na Spring Cloud
 
JavaOne 2016 - Reactive Microservices with Java and Java EE
JavaOne 2016 - Reactive Microservices with Java and Java EEJavaOne 2016 - Reactive Microservices with Java and Java EE
JavaOne 2016 - Reactive Microservices with Java and Java EE
 
QCon 2015 - Combinando AngularJS com Java EE
QCon 2015 - Combinando AngularJS com Java EEQCon 2015 - Combinando AngularJS com Java EE
QCon 2015 - Combinando AngularJS com Java EE
 
ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2ConFoo 2015 - Securing RESTful resources with OAuth2
ConFoo 2015 - Securing RESTful resources with OAuth2
 
How to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring EditionHow to build customizable multitenant web applications - IPC11 Spring Edition
How to build customizable multitenant web applications - IPC11 Spring Edition
 
QCon SP 2016 - Construindo Microservices Auto-curáveis com Spring Cloud e Net...
QCon SP 2016 - Construindo Microservices Auto-curáveis com Spring Cloud e Net...QCon SP 2016 - Construindo Microservices Auto-curáveis com Spring Cloud e Net...
QCon SP 2016 - Construindo Microservices Auto-curáveis com Spring Cloud e Net...
 
JavaOne 2014 - Securing RESTful Resources with OAuth2
JavaOne 2014 - Securing RESTful Resources with OAuth2JavaOne 2014 - Securing RESTful Resources with OAuth2
JavaOne 2014 - Securing RESTful Resources with OAuth2
 
ConFoo 2015 - Supporting Multi-tenancy Applications with Java EE
ConFoo 2015 - Supporting Multi-tenancy Applications with Java EEConFoo 2015 - Supporting Multi-tenancy Applications with Java EE
ConFoo 2015 - Supporting Multi-tenancy Applications with Java EE
 

Ähnlich wie Suportando Aplicações Multi-tenancy com Java EE

Android training in mumbai
Android training in mumbaiAndroid training in mumbai
Android training in mumbaiCIBIL
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WAREFermin Galan
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWAREFIWARE
 
New Features of JSR 317 (JPA 2.0)
New Features of JSR 317 (JPA 2.0)New Features of JSR 317 (JPA 2.0)
New Features of JSR 317 (JPA 2.0)Markus Eisele
 
Osiąganie mądrej architektury z Symfony2
Osiąganie mądrej architektury z Symfony2 Osiąganie mądrej architektury z Symfony2
Osiąganie mądrej architektury z Symfony2 3camp
 
Java Technology
Java TechnologyJava Technology
Java Technologyifnu bima
 
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rulesSrijan Technologies
 
Android tutorial (2)
Android tutorial (2)Android tutorial (2)
Android tutorial (2)Kumar
 
Spring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundrySpring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundryJoshua Long
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenchesLukas Smith
 
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...SPTechCon
 
Storage Plug-ins
Storage Plug-ins Storage Plug-ins
Storage Plug-ins buildacloud
 
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexusMicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexusEmily Jiang
 
CloudStack Meetup Santa Clara
CloudStack Meetup Santa Clara CloudStack Meetup Santa Clara
CloudStack Meetup Santa Clara NetApp
 
SOA with C, C++, PHP and more
SOA with C, C++, PHP and moreSOA with C, C++, PHP and more
SOA with C, C++, PHP and moreWSO2
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 

Ähnlich wie Suportando Aplicações Multi-tenancy com Java EE (20)

Android training in mumbai
Android training in mumbaiAndroid training in mumbai
Android training in mumbai
 
Android - Anatomy of android elements & layouts
Android - Anatomy of android elements & layoutsAndroid - Anatomy of android elements & layouts
Android - Anatomy of android elements & layouts
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
 
New Features of JSR 317 (JPA 2.0)
New Features of JSR 317 (JPA 2.0)New Features of JSR 317 (JPA 2.0)
New Features of JSR 317 (JPA 2.0)
 
Osiąganie mądrej architektury z Symfony2
Osiąganie mądrej architektury z Symfony2 Osiąganie mądrej architektury z Symfony2
Osiąganie mądrej architektury z Symfony2
 
Java Technology
Java TechnologyJava Technology
Java Technology
 
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
[Srijan Wednesday Webinars] Ruling Drupal 8 with #d8rules
 
Android tutorial (2)
Android tutorial (2)Android tutorial (2)
Android tutorial (2)
 
Spring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundrySpring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud Foundry
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenches
 
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
 
What is DDD and how could it help you
What is DDD and how could it help youWhat is DDD and how could it help you
What is DDD and how could it help you
 
Storage Plug-ins
Storage Plug-ins Storage Plug-ins
Storage Plug-ins
 
Hexagonal architecture in PHP
Hexagonal architecture in PHPHexagonal architecture in PHP
Hexagonal architecture in PHP
 
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexusMicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
MicroProfile, Docker, Kubernetes, Istio and Open Shift lab @dev nexus
 
CloudStack Meetup Santa Clara
CloudStack Meetup Santa Clara CloudStack Meetup Santa Clara
CloudStack Meetup Santa Clara
 
CDI @javaonehyderabad
CDI @javaonehyderabadCDI @javaonehyderabad
CDI @javaonehyderabad
 
SOA with C, C++, PHP and more
SOA with C, C++, PHP and moreSOA with C, C++, PHP and more
SOA with C, C++, PHP and more
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 

Mehr von Rodrigo Cândido da Silva

Protegendo Microservices: Boas Práticas e Estratégias de Implementação
Protegendo Microservices: Boas Práticas e Estratégias de ImplementaçãoProtegendo Microservices: Boas Práticas e Estratégias de Implementação
Protegendo Microservices: Boas Práticas e Estratégias de ImplementaçãoRodrigo Cândido da Silva
 
Protecting Java Microservices: Best Practices and Strategies
Protecting Java Microservices: Best Practices and StrategiesProtecting Java Microservices: Best Practices and Strategies
Protecting Java Microservices: Best Practices and StrategiesRodrigo Cândido da Silva
 
Workshop Microservices - Distribuindo os Microservices com Docker e Kubernetes
Workshop Microservices - Distribuindo os Microservices com Docker e KubernetesWorkshop Microservices - Distribuindo os Microservices com Docker e Kubernetes
Workshop Microservices - Distribuindo os Microservices com Docker e KubernetesRodrigo Cândido da Silva
 
Workshop Microservices - Microservices com Spring Cloud e Netflix OSS
Workshop Microservices - Microservices com Spring Cloud e Netflix OSSWorkshop Microservices - Microservices com Spring Cloud e Netflix OSS
Workshop Microservices - Microservices com Spring Cloud e Netflix OSSRodrigo Cândido da Silva
 
Workshop Microservices - Construindo APIs RESTful com Spring Boot
Workshop Microservices - Construindo APIs RESTful com Spring BootWorkshop Microservices - Construindo APIs RESTful com Spring Boot
Workshop Microservices - Construindo APIs RESTful com Spring BootRodrigo Cândido da Silva
 
Workshop Microservices - Arquitetura Microservices
Workshop Microservices - Arquitetura MicroservicesWorkshop Microservices - Arquitetura Microservices
Workshop Microservices - Arquitetura MicroservicesRodrigo Cândido da Silva
 
TDC Floripa 2017 - Criando Microservices Reativos com Java
TDC Floripa 2017 - Criando Microservices Reativos com JavaTDC Floripa 2017 - Criando Microservices Reativos com Java
TDC Floripa 2017 - Criando Microservices Reativos com JavaRodrigo Cândido da Silva
 
GUJavaSC - Combinando Micro-serviços com Práticas DevOps
GUJavaSC - Combinando Micro-serviços com Práticas DevOpsGUJavaSC - Combinando Micro-serviços com Práticas DevOps
GUJavaSC - Combinando Micro-serviços com Práticas DevOpsRodrigo Cândido da Silva
 

Mehr von Rodrigo Cândido da Silva (12)

Java 9, 10 e ... 11
Java 9, 10 e ... 11Java 9, 10 e ... 11
Java 9, 10 e ... 11
 
Cloud Native Java EE
Cloud Native Java EECloud Native Java EE
Cloud Native Java EE
 
Protegendo Microservices: Boas Práticas e Estratégias de Implementação
Protegendo Microservices: Boas Práticas e Estratégias de ImplementaçãoProtegendo Microservices: Boas Práticas e Estratégias de Implementação
Protegendo Microservices: Boas Práticas e Estratégias de Implementação
 
Protecting Java Microservices: Best Practices and Strategies
Protecting Java Microservices: Best Practices and StrategiesProtecting Java Microservices: Best Practices and Strategies
Protecting Java Microservices: Best Practices and Strategies
 
As novidades da nova versão do Java 9
As novidades da nova versão do Java 9As novidades da nova versão do Java 9
As novidades da nova versão do Java 9
 
Workshop Microservices - Distribuindo os Microservices com Docker e Kubernetes
Workshop Microservices - Distribuindo os Microservices com Docker e KubernetesWorkshop Microservices - Distribuindo os Microservices com Docker e Kubernetes
Workshop Microservices - Distribuindo os Microservices com Docker e Kubernetes
 
Workshop Microservices - Microservices com Spring Cloud e Netflix OSS
Workshop Microservices - Microservices com Spring Cloud e Netflix OSSWorkshop Microservices - Microservices com Spring Cloud e Netflix OSS
Workshop Microservices - Microservices com Spring Cloud e Netflix OSS
 
Workshop Microservices - Construindo APIs RESTful com Spring Boot
Workshop Microservices - Construindo APIs RESTful com Spring BootWorkshop Microservices - Construindo APIs RESTful com Spring Boot
Workshop Microservices - Construindo APIs RESTful com Spring Boot
 
Workshop Microservices - Arquitetura Microservices
Workshop Microservices - Arquitetura MicroservicesWorkshop Microservices - Arquitetura Microservices
Workshop Microservices - Arquitetura Microservices
 
GUJavaSC - Protegendo Microservices em Java
GUJavaSC - Protegendo Microservices em JavaGUJavaSC - Protegendo Microservices em Java
GUJavaSC - Protegendo Microservices em Java
 
TDC Floripa 2017 - Criando Microservices Reativos com Java
TDC Floripa 2017 - Criando Microservices Reativos com JavaTDC Floripa 2017 - Criando Microservices Reativos com Java
TDC Floripa 2017 - Criando Microservices Reativos com Java
 
GUJavaSC - Combinando Micro-serviços com Práticas DevOps
GUJavaSC - Combinando Micro-serviços com Práticas DevOpsGUJavaSC - Combinando Micro-serviços com Práticas DevOps
GUJavaSC - Combinando Micro-serviços com Práticas DevOps
 

Kürzlich hochgeladen

Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
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
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 

Kürzlich hochgeladen (20)

Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
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
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 

Suportando Aplicações Multi-tenancy com Java EE

  • 1. Globalcode  –  Open4education Suportando Aplicações Multi-tenancy com Java EE Rodrigo Cândido da Silva @rcandidosilva
  • 2. Globalcode  –  Open4education Agenda !   Modelos de Serviço !   SaaS Market !   Multi-tenancy !  Desafios !  Pros and Cons !  Tipos de Implementação !   Java EE + Multi-tenancy !   Segurança + Multi-tenancy !   Cloud + Multi-tenancy !   JVM Multi-tenancy
  • 5. Globalcode  –  Open4education Multi-tenancy !   Uma única instância da aplicação atendendo múltiplos clientes (tenant) ! Contrário da arquitetura de múltiplas instâncias
  • 8. Globalcode  –  Open4education Desafios !   Separação dos dados !   Personalização !   Controle de acesso !   Provisionamento de recursos !   Integrações !   Atualização da aplicação !   Recuperação à falhas
  • 9. Globalcode  –  Open4education Pros and Cons !   Pros ! Reduz o custo de manutenção ! Único código para todos os clientes ! Aumenta a escalabilidade ! Beneficia compartilhamento recursos entre clientes !   Cons ! Aumenta a complexidade ! Separação por tenant-id ! Maior risco de falhas ! Quebra da aplicação compartilhada para todos clientes ! Reduz a flexibilidade para os clientes
  • 10. Globalcode  –  Open4education Multi-tenancy !   4 possíveis níveis implementações ! Nível 1 (Personalizado) !  [N] aplicações e [N] databases ! Nível 2 (Configurável) !  [1] aplicação e [N] databases ! Nível 3 (Configurável e eficiente) !  [N] aplicações e [1] database ! Nível 4 (Escalável, configurável e eficiente) !  [1] aplicação e [1] database
  • 11. Globalcode  –  Open4education Nível 1 - Personalizado !   [N] aplicações e [N] databases
  • 12. Globalcode  –  Open4education Nível 2 - Configurável !   [1] aplicação e [N] databases
  • 13. Globalcode  –  Open4education Nível 3 - Eficiente !   [N] aplicações e [1] database
  • 14. Globalcode  –  Open4education Nível 4 - Escalável !   [1] aplicação e [1] database
  • 15. Globalcode  –  Open4education Java EE + Multi-tenancy !   Database !  JPA + Multi-tenancy !   Customização UI !  JSF + Multi-tenancy !   Segurança !   Java EE 8 com suporte Cloud
  • 16. Globalcode  –  Open4education JPA + Multi-tenancy !   EclipseLink !  Suporte a multi-tenancy @Multitenant !  Disponibiliza 3 estratégias !  @Multitenant(SINGLE_TABLE) – default !  @Multitenant(TABLE_PER_TENANT) !  @Multitenant(VPD) !  Shared Cache by tenant
  • 17. Globalcode  –  Open4education EclipseLink SINGLE_TABLE @Entity @Table(name=“EMP”) @Multitenant(SINGLE_TABLE) @TenantDiscriminatorColumn(name = “TENANT_ID”, contextProperty = “tenant-id”) public class Employee { ... } HashMap properties = new HashMap(); properties.put("tenant.id", "707"); ... EntityManager em = Persistence .createEntityManagerFactory( "multi-tenant”,properties) .createEntityManager(); <persistence-unit name="multi-tenant"> ... <properties> <property name="tenant.id" value="707"/> ... </properties> </persistence-unit>
  • 18. Globalcode  –  Open4education EclipseLink TABLE_PER_TENANT <entity class="Employee"> <multitenant type="TABLE_PER_TENANT"> <tenant-table-discriminator type="SCHEMA" context- property="eclipselink.tenant-id"/> </multitenant> <table name="EMP"> ... </entity> @Entity @Table(name=“EMP”) @Multitenant(TABLE_PER_TENANT) @TenantTableDiscriminator(type=SCHEMA, contextProperty="eclipselink.tenant-id") public class Employee { ... }
  • 19. Globalcode  –  Open4education EclipseLink VPD @Entity @Multitenant @TenantDiscriminatorColumn(name = "USER_ID", contextProperty = "tenant.id") @Cacheable(false) public class Task implements Serializable { ... CALL DBMS_RLS.ADD_POLICY ('SCOTT', 'TASK', 'todo_list_policy', 'SCOTT', 'ident_func', 'select, update, delete')); <properties> <property name="eclipselink.session.customizer" value="example.VPDSessionCustomizer" /> <property name="eclipselink.session-event-listener" value="example.VPDSessionEventAdapter" /> <property name="eclipselink.jdbc.exclusive-connection.mode" value="Always" /> </properties>
  • 20. Globalcode  –  Open4education JPA Caching !   Shared Cache disabled
  • 21. Globalcode  –  Open4education JPA Caching !   Shared Cache by tenant
  • 22. Globalcode  –  Open4education JSF + Multi-tenancy !   Arquitetura extensível !   Artefatos podem ser encapsulados em JARs !   Composição at runtime !   Templates !   Resource library !   Look-and-feel customization !   RenderKit !   Localization
  • 23. Globalcode  –  Open4education JSF Facelets The Facelets Gazette Site Navigation ●Events ●Docs ●Forums About Contact Site Map Template File name _template.html Insertion points Resources css classes, scripts, images
  • 24. Globalcode  –  Open4education JSF Multi-templating contractA • Declared Templates • Declared Insertion Points • Declared Resources contractB • Declared Templates • Declared Insertion Points • Declared Resources contractC • Declared Templates • Declared Insertion Points • Declared Resources <web-app-root>/contracts contractD • Declared Templates • Declared Insertion Points • Declared Resources contractE • Declared Templates • Declared Insertion Points • Declared Resources contractF • Declared Templates • Declared Insertion Points • Declared Resources JAR files in WEB-INF/lib contractA • Declared Templates • Declared Insertion Points • Declared Resources contractB • Declared Templates • Declared Insertion Points • Declared Resources contractC • Declared Templates • Declared Insertion Points • Declared Resources <web-app-root>/contracts contractD • Declared Templates • Declared Insertion Points • Declared Resources contractE • Declared Templates • Declared Insertion Points • Declared Resources contractF • Declared Templates • Declared Insertion Points • Declared Resources JAR files in WEB-INF/lib Set of available contracts Facelet 1 Facelet 3Facelet 2 faces-config.xml
  • 25. Globalcode  –  Open4education JSF Multi-templating <html xmlns="http://www.w3.org/1999/xhtml” xmlns:h="http://java.sun.com/jsf/html” xmlns:ui="http://java.sun.com/jsf/ facelets"> <body> <ui:composition template="#{template}”> ... </ui:composition> </body> </html> <?xml version="1.0" encoding="UTF-8"?> <web-app> <context-param> <param-name>javax.faces.view.TEMPLATE</param- name> <param-value>mybusiness</param-value> </context-param> </web-app>
  • 26. Globalcode  –  Open4education Segurança + Multi-tenancy !   PicketLink !  Java EE security framework !  Identity Management (IDM) !  Federation support (SAML, OAuth2, OpenID) !  Social Login support !  Multi-tenancy support
  • 28. Globalcode  –  Open4education Picketlink @Named public class RealmSelector implements Serializable { @Inject private PartitionManager partitionManager; private Realm realm; @Produces @PicketLink public Realm select() { return this.realm; } … } @RequestScoped public class LoginController { @Inject private Identity identity; public String login() { this.identity.login(); … } public String logout() { this.identity.logout(); return "/home.xhtml"; } } public class Resources { public enum REALM {acme, umbrella, wayne} @Produces @Named("supportedRealms") public Enum[] supportedRealms() { return REALM.values(); }
  • 29. Globalcode  –  Open4education Cloud + Multi-tenancy !   Namespace API ! com.google.appengine.api.NamespaceManager ! Suporte aos seguintes serviços !  Google Datastore ! Memcached !  Task Queue !  Search
  • 30. Globalcode  –  Open4education Namespace API // Filter to set the Google Apps // domain as the namespace. public class NamespaceFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { // Make sure set() is only called if the current namespace is not already set. if (NamespaceManager.get() == null) { NamespaceManager.set(NamespaceManager.getGoogleAppsNamespace()); } } } // Assuming there is a logged in user. namespace = UserServiceFactory.getUserService() .getCurrentUser().getUserId(); NamespaceManager.set(namespace); <filter> <filter-name>NamespaceFilter</filter-name> <filter-class>package.NamespaceFilter</filter-class> </filter> <filter-mapping> <filter-name>NamespaceFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
  • 31. Globalcode  –  Open4education Namespace API !   Search // Set the current namespace to "aSpace" NamespaceManager.set("aSpace"); // Create a SearchService with the namespace "aSpace" SearchService searchService = SearchServiceFactory.getSearchService(); // Create a MemcacheService that uses the namespace "abc". MemcacheService explicit = MemcacheServiceFactory.getMemcacheService("abc"); explicit.put("key", value); // stores value in namespace "abc" // Increment the count for the current namespace asynchronously. QueueFactory.getDefaultQueue().add( TaskOptions.Builder.url("/_ah/update_count") .param("countName", "SomeRequest")); !   Memcached !   Task Queue
  • 32. Globalcode  –  Open4education JVM + Multi-tenancy !   Multi-tenancy no nível da JVM !   IBM SDK JVM !   Static field isolation !   Controle by tenant !   CPU time !   Heap size !   Thread count !   File IO, Socket IO !   Limitações !   Java Native Interface (JNI) !   JVMT (Tool interface) !   GUI Libraries (GWT, Swing, etc) !   EXPERIMENTAL !!!
  • 36. Globalcode  –  Open4education Referências ! http://msdn.microsoft.com/en-us/library/aa479086.aspx ! https://developers.google.com/appengine/docs/java/multitenancy/ ! http://www.ibm.com/developerworks/java/library/j-multitenant-java/index.html ! http://www.eclipse.org/eclipselink/documentation/2.4/jpa/extensions/ a_multitenant.htm ! http://2012.con-fess.com/sessions/-/details/122/JSF-and-JavaEE-7-for-multi- tenant-applications ! http://jdevelopment.nl/jsf-22/ ! http://picketlink.org ! https://developers.google.com/appengine/docs/java/multitenancy/ ! http://www.jboss.org/quickstarts/picketlink/picketlink-authentication-idm-multi- tenancy/ ! http://wiki.eclipse.org/EclipseLink/Examples/MySports