gatein frameworks
DESCRIPTION
TRANSCRIPT
![Page 1: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/1.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Julien VietEsprit 19th of June 2010
![Page 2: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/2.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
About me
• 1974 / Born• 1980 / Basic (Apple IIe) • 1987 / STOS (Atari 520 ST)• 1989 / MC 68000 (Amiga 500)• 1994 / Saturn (HP48)• 1996 / C (PC)• 1997 / Java 1.1.4• 2002 / Joined JBoss• 2005 / JBoss Portal 2.0• 2006 / Red Hat buys JBoss $350M• 2008 / Joined eXo• 2009 / eXo + JBoss• 2010 / GateIn 3.0• …
![Page 3: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/3.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
• JBoss Application Server• JBoss Portal• eXo Portal• GateIn• Chromattic• Reflext• Wikbook• CRaSH
Open Source experience
![Page 4: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/4.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
GateIn and above
• GateIn 3.0 released in March 2010• GateIn 3.1 scheduled for June 2010• eXo Social 1.0• eXo WCM 2.0• eXo KS 2.0• eXo Platform 1.0
![Page 5: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/5.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Standards, features and technologies
Standards & Features
GateIn Portal
JBoss eXo
Identity integratio
nWSRP
Model Object
for Portal
Gadget Server
Portlet Container
JBoss Identity
eXo JCR / WebDAV
Chromattic (JCR / Object)
JBoss WS
WebUI
JSR 286 Portlet
Java Content
Repository
Remote Portlets
Rich UI Portal / Portlet
Opensocial
Gadgets
Portlet Bridge /
Richfaces
Rest / JAX-RS
![Page 6: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/6.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Major features
• Aggregation via Portlet and Gadget• Rich User Interface• Java Content Repository • Internationalization / RTL• Management• Identity integration (Database, LDAP)• SSO integration (SSO, CAS,
OpenSSO)
![Page 7: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/7.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Content aggregation
• Based on standards and specifications– Portlet 2.0/ GateIn Portlet Container– OpenSocial Gadgets / Shindig
![Page 8: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/8.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Portal development
• Portlet bridges– JSF (JSR 301)– Struts 1 & Struts 2– Apache Tapestry– Apache Wicket
• Portlet frameworks– Spring MVC Portlet– Grails Portlet
![Page 9: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/9.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Portal model
Users
Admins
Classic Root
John
Mary
Demo
GroupSite
Portal Site
UserSite
GateIn
Executive Board
Home
Nav
SiteMaphomepag
e
Pages
sitemap
![Page 10: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/10.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
GateIn Tools and Frameworks
• Chromattic– An advanced Java Content Repository to
Object mapping framework
• CRaSH– A shell for Java Content Repository
• Open source under the LGPL license• Hosted on Google Code
![Page 11: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/11.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Java Content Repository
![Page 12: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/12.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
What’s wrong with?public void print(Node node) throws RepositoryException { String typeName = node.getPrimaryType().getName(); if (typeName.equals(“nt:file”)) { Node content = node.getNode(“jcr:content”); String mimeType = “”; if (content.hasProperty(“mimeType”) mimeType = content.getProperty(“mimeType”).getString(); System.out.println(“File” + node.getName() + “:” + mimeType); } else if (typeName.equals(“nt:folder)) { System.out.println(“Folder “ + node.getName()); Iterator i = node.getNodes(); while (i.hasNext()) { Node child = (Node)i.next(); print(node); } else { throw new IllegalArgumentException(“print should not be called with
the node type ” + typeName); }}
![Page 13: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/13.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
JCR by nature is not type safepublic void print(Node node) throws RepositoryException { String typeName = node.getPrimaryType().getName(); if (typeName.equals(“nt:file”)) { Node content = node.getNode(“jcr:content”); String mimeType = “”; if (content.hasProperty(“mimeType”) mimeType = content.getProperty(“mimeType”).getString(); System.out.println(“File” + node.getName() + “:” + mimeType); } else if (typeName.equals(“nt:folder)) { System.out.println(“Folder “ + node.getName()); Iterator<?> i = node.getNodes(); while (i.hasNext()) { Node child = (Node)i.next(); print(node); } else { throw new IllegalArgumentException(“print should not be called with
the node type ” + typeName); }}
![Page 14: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/14.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
OO progtamming provides type safety
public void print(File file) { if (file instanceof Document) { String mimeType = file.getContent().getMimeType(); System.out.println(“File “ + file.getName() + “ “ +
mimeType; else { Folder folder = (Folder)file; System.out.println(“Folder “ + folder.getName(); for (File child : folder.getChildren()) print(child); } }
![Page 15: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/15.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Chromattic
• Provides a type safe object model for JCR • Use Java 5 annotation• Enable development of rich models• Integrates well with Java language with
the use of Java Collection and Generics• Advanced features like support for JCR
multiple inheritance• Integrates at the Java compiler level via
the Java Annotation Processor Tools (APT)• Generation of node type definitions
![Page 16: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/16.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Chromattic concepts
Chromattic Session
Chromattic Session
build()Chromattic Builder
Chromattic Builder ChromatticChromattic
Chromattic classesChromattic classes
Meta ModelMeta
ModelObjectsObjects
open()
JCRJCRNode type defs
Node type defs
Javaclasses
Javaclasses
![Page 17: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/17.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Entity life cycle
TransientTransient PersistentPersistent RemovedRemoved
Chromattic Session
Chromattic Session
create()
destroy()
persist()
insert()
• ChromatticSession provides support for interacting with objects life cycle
![Page 18: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/18.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Class loadingClass loading
CompilerCompiler
Chromattic classes generation based on APT
File.javaFile.java File_Chromattic.java
File_Chromattic.java
File.classFile.class File_Chromattic.class
File_Chromattic.class
Class<File>Class<File> Class<File_Chromattic>
Class<File_Chromattic>
APT
<<extends>>
![Page 19: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/19.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Property mapping
• Java types are mapped to JCR property types– String as JCR String– Integer/int/Long/long as JCR Long–Boolean/boolean as JCR Boolean– Float/float/Double/double as JCR Double– java.util.Date as JCR Calendar– InputStream as JCR Binary
• Java enum type mapped to JCR String type
![Page 20: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/20.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Multivalued property mapping
• JCR types can be multivalued and are mapped either to native array type and java.util.List java type
@Property int[] getIntArray(); @Property Integer[] getIntegerArray(); @Property List<Integer> getIntegerList();
![Page 21: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/21.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Relationship types
• Four kinds of relationship– Hierarchic: the default one– Reference and path provides support for
JCR references– Embedded enable mapping for super
type and mixin
![Page 22: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/22.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Collection mapping
• Unordered collection– Collection<File> getChildren()
• Ordered collection based on JCR node order– List<File> getChildren()
• Associative collection–Map<String, File> getChildren()
![Page 23: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/23.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
JCR multiple inheritance support
@MixinType(name=“votes”)public abstract class Votes { public abstract int getVoteCount(); public abstract void setVoteCount(int count);}
@PrimaryType(name=“nt:file”)public abstract class Document { @OneToOne(type = RelationshipType.EMBEDDED) @Owner public abstract Votes getVotes();}
![Page 24: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/24.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Parameter type and generics inheritance
public abstract class Container<T> { @OneToMany public abstract Collection<T> getChildren();}
@PrimaryType(name=“nt:folder”)public abstract class Directory extends Container<File> {}
@PrimaryType(name=“identities”)public abstract class IdentityContainer<I extends
IdentityObject> extends Container<I> {}
![Page 25: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/25.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Eventing
• The session provides eventing for state changes– Entity life cycle changes– State changes (properties)
• Enables dependency injection integrationpublic class InjectingListener implements LifeCycleListener {
public created(Object o) { if (o instanceof FrameworkObject) { ((FrameworkObject)o).setFramework(framework); } }
…}
![Page 26: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/26.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Roadmap
• Detached/attached entities• Type safe query builder• Bean validation integration• Object versioning• Property map filtering–Map<String, Integer> getIntProperties();
• More flexible enum mapping
![Page 27: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/27.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
CRaSH
• Considers the JCR tree as its file system
• Basic adminisration• Test JCR queries
![Page 28: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/28.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
CRaSH components
Shell EngineShell
Engine
CommandsCommands
ConnectorsConnectors
TelnetTelnet
Args4jArgs4j GroovyGroovy
JCRConnector
JCRConnectorSSHSSH
SCPSCP
![Page 29: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/29.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Command
• Written as a Groovy script– Easy to add new commands– Found in WEB-INF/groovy/commands
• Annotated with Args4j– Describe switches and arguments
![Page 30: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/30.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Groovy integration: property access
// Iterate over the propertiesNode.eachProperty({ property ->
out.print(property.name);};
// This codedef foo = null;if (node.hasProperty(‘foo)) { foo = node.getProperty(‘foo’).getString();}// Can be replaced byfoo = node.foo;//foo = node[‘foo’];
![Page 31: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/31.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Groovy integration: node child access
// Iterates over the childrendef count = 0;node.each({ node -> count++; })
// This codedef foo = null;If (node.hasNode(‘foo’) { foo = node.getNode(‘foo);}// can be replaced byfoo = node.foo;// Orfoo = node[‘foo’];
![Page 32: GateIn Frameworks](https://reader034.vdocuments.mx/reader034/viewer/2022051312/5461aa79af79592e408b5cef/html5/thumbnails/32.jpg)
Copyright © 2010. All rights Reserved, eXo Platform SAS
GateIn Frameworks
• Chromattic and CRaSH are powerful tools for building applications on top of GateIn
• http://www.gatein.org• http://chromattic .googlecode.com• http://crsh.googlecode.com