gatein frameworks
Post on 11-Nov-2014
4.518 Views
Preview:
DESCRIPTION
TRANSCRIPT
Copyright © 2010. All rights Reserved, eXo Platform SAS
Julien VietEsprit 19th of June 2010
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• …
Copyright © 2010. All rights Reserved, eXo Platform SAS
• JBoss Application Server• JBoss Portal• eXo Portal• GateIn• Chromattic• Reflext• Wikbook• CRaSH
Open Source experience
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
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
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)
Copyright © 2010. All rights Reserved, eXo Platform SAS
Content aggregation
• Based on standards and specifications– Portlet 2.0/ GateIn Portlet Container– OpenSocial Gadgets / Shindig
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
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
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
Copyright © 2010. All rights Reserved, eXo Platform SAS
Java Content Repository
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); }}
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); }}
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); } }
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
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
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
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>>
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
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();
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
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()
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();}
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> {}
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); } }
…}
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
Copyright © 2010. All rights Reserved, eXo Platform SAS
CRaSH
• Considers the JCR tree as its file system
• Basic adminisration• Test JCR queries
Copyright © 2010. All rights Reserved, eXo Platform SAS
CRaSH components
Shell EngineShell
Engine
CommandsCommands
ConnectorsConnectors
TelnetTelnet
Args4jArgs4j GroovyGroovy
JCRConnector
JCRConnectorSSHSSH
SCPSCP
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
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’];
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’];
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
top related