Your SlideShare is downloading. ×
Chromattic usage in eXo Social
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Chromattic usage in eXo Social

857
views

Published on

A presentation made by eXo Platform SEA. We introduce Chromatic usage in eXo Social with several key features. Hope you enjoy it!

A presentation made by eXo Platform SEA. We introduce Chromatic usage in eXo Social with several key features. Hope you enjoy it!

Published in: Technology, Education

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
857
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Chromattic how to use Vu Cong Thanh & Le Van Vien Social Team 18/08/2011
  • 2. Agenda
    • What & why Chromattic?
    • Annotation APIs
    • APT in Chromattic.
    • Config & dependency
    • Example
  • 3. What is Chromattic?
    • Is an object mapper framework that uses Java Content Repository as back end storage.
    • Open source under the LGPL license.
    • Hosted in Google code:
    • http://code.google.com/p/chromattic/
  • 4. JCR
    • JCR by nature is not type safe.
    • Work with nodes.
    • Manage session by myself.
  • 5. Chromattic
    • Provide a type safe object model for JCR.
    • Use Java 5 annotation.
    • Integrate at Java compiler level via the Annotation Processor Tool.
    • Efficient lazy loading.
  • 6. Annotation APIs
  • 7. Annotation APIs
    • Chromattic supports 2 types
    • PrimaryType: Mapping between a node type and a java class.
    • MixinType: When a class declares a mixin annotation without being bound to a node mapping, this class can be involved in a one to one relationship with the EMBEDDED type. The mixin is added to a node when a one to one relationship of type mixin is created.
  • 8. Annotation APIs
    • Id: annotates a bean property getter to return the current identifier of the related jcr node
    • Path: annotates a bean property getter to return the current path of the related jcr node
  • 9. Annotation APIs
    • MappedBy: defines the name of the property that is used to maintain one to many relationship with path or reference.
    • Name: annotates a bean property to map it against the current name of the related jcr node.
    • Property: defines the mapping between the property of a node type and a java bean property of the annotated class.
  • 10. State Of Chromattic Entity
  • 11. Annotation APIs
    • Create: define a creator method to create transient instances of a Chromattic entity
    • FormattedBy: BaseEncodingObjectFormatter implements ObjectFormatter
    • DefaultValue: define the default value of a property
    • OneToMany: defines the one side in a one to many relationship
  • 12. Annotation APIs
    • RelationshipType
    • HIERARCHIC: a hierarchic relationship uses the natural parent child relationship to associate nodes. It is valid either for one to one or one to many relationship.
    • REFERENCE: a reference relationship uses reference a typed property to associate nodes. It is only valid for one to many relationships.
    • PATH: a path relationship uses path a typed property to associate nodes. It is only valid for one to many relationships.
    • EMBEDDED
  • 13. Config & dependency
  • 14. Config & dependency Config: in file configuration.xml with plugin RepositoryService
  • 15. Config & dependency Config phase <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.1</version> … </plugin>
  • 16. Config & dependency Config phase <executions> <execution> <id>default-compile</id> <goals> <goal>compile</goal> </goals> <phase>compile</phase> <configuration> <compilerArgument>-proc:none</compilerArgument> </configuration> </execution> </executions>
  • 17. Config & dependency
    • Config
    • Generate implementation when compile
  • 18. Config & dependency Dependency <dependency> <groupId>org.chromattic</groupId> <artifactId>chromattic.api</artifactId> <version>1.1.0-beta6</version> <scope>provided</scope> </dependency> Annotations, event, format, query
  • 19. Config & dependency Dependency <dependency> <groupId>org.chromattic</groupId> <artifactId>chromattic.core</artifactId> <version>1.1.0-beta6</version> <scope>provided</scope> </dependency>
  • 20. Config & dependency Dependency <dependency> <groupId>org.chromattic</groupId> <artifactId>chromattic.metamodel</artifactId> <version>1.1.0-beta6</version> <scope>provided</scope> </dependency>
  • 21. Config & dependency Dependency <dependency> <groupId>org.chromattic</groupId> <artifactId>chromattic.apt</artifactId> <version>1.1.0-beta6</version> <scope>provided</scope> </dependency>
  • 22. Config & dependency Dependency <dependency> <groupId>org.chromattic</groupId> <artifactId>chromattic.spi</artifactId> <version>1.1.0-beta6</version> <scope>provided</scope> </dependency>
  • 23. Config & dependency Dependency <dependency> <groupId>org.chromattic</groupId> <artifactId>chromattic.exo</artifactId> <version>1.1.0-beta6</version> <scope>test</scope> </dependency>
  • 24. APT in Chromattic
  • 25. APT in Chromattic
    • ChromatticBuilder
    • The builder configures and creates a Chromattic at runtime.
      • SESSION_LIFECYCLE_CLASSNAME: The JCR session life cycle class name.
      • ROOT_NODE_PATH: The path of the root node. The default value is the path of the JCR workspace root node.
      • CREATE_ROOT_NODE: A boolean option that creates the root node designated by the ROOT_NODE_PATH when it does not exist.
  • 26. APT in Chromattic
    • Chromattic
    • The Chromattic object provides the entry point for runtime interactions.
  • 27. APT in Chromattic
    • ChromatticSession
    • The session manages Chromattic objects at runtime, its is obtained from a Chromattic instance. A session is meant to be used by one thread and not shared among threads.
  • 28. APT in Chromattic
    • ChromatticLifeCycle
    • The chromattic life cycle object is a plugin allows to bootstrap a chromattic builder and make it managed either locally or globally.
    • Some parameters:
      • domain-name: the life cycle domain name.
      • workspace-name: the repository workspace name associated with this life cycle.
      • entities: list value that contains the list of chromattic entities that will be registered against the builder chromattic builder.
  • 29. APT in Chromattic Proxy generation based on APT
  • 30. Example