Saturday, February 6, 2010

Setup of development on eXoJCR 1.12

Short intro in preparations to eXo JCR development.
(repost of setup, adopted to eXoJCR 1.12)

eXo and GateIn products development based on Maven2 project management. Easiest way to start the development it's to setup right Maven2 project (POM) and its dependencies.

Prerequisites
  • Java 5 (add JDK executables to the PATH on your system)
  • Maven2 (add Maven2 2.2.1 or higher executable to the PATH on your system, )
  • Eclipse (optional)
Creating project (POM)

We say that our project name is my-jcrapp (use your name instead of this dummy one).

In empty folder run Maven command:

For Java project:
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DgroupId=com.mycompany.exojcr -DartifactId=my-jcrapp
For Groovy enabled project:
mvn archetype:generate -DarchetypeGroupId=org.codehaus.groovy.maven.archetypes -DarchetypeArtifactId=gmaven-archetype-basic -DgroupId=com.mycompany.exojcr -DartifactId=my-jcrapp

The commend ask for a project version Define value for version: 1.0-SNAPSHOT: :
Press Enter or type your version, it then ask for confirmation - press Enter to agree.

This command creates the project folder named my-jcrapp with ready to use files structure. There are pom.xml, src folder with place for application code and tests. Project model (pom.xml) contains dependencies declaration, here is JUnit only (and Groovy runtime if you're groovy :) ).

eXo JCR dependency

Next, add eXo JCR dependency to the POM.
eXoJCR jar files lives on JBoss Maven2 repository. Add JBoss repo to Maven2 local repositories list: or into settings.xml or directly in the your project POM (add repositories element after the dependencies).
<repositories>
<repository>
<id>exo-int</id>
<name>jboss.org repository</name>
<url>http://repository.jboss.com/maven2 </url>
<layout>default</layout>
</repository>
</repositories>
Now add the JCR core dependency:
<dependency>
<groupid>org.exoplatform.jcr</groupid>
<artifactid>exo.jcr.component.core</artifactid>
<version>1.12.0-GA</version>
<scope>compile</scope>
</dependency>
If you need JCR Ext features then add this dependency (in fact you need only Ext one, it will points JCR core itself):
<dependency>
<groupid>org.exoplatform.jcr</groupid>
<artifactid>exo.jcr.component.ext</artifactid>
<version>1.12.0-GA</version>
<scope>compile</scope>
</dependency>
And it's ready to build!

Build project

Run given command and wait till eXo JCR with its dependencies will be downloaded to your local Maven2 repo (~25Mb):
mvn clean compile
and be sure you see BUILD SUCCESSFUL at the end of this execution.

If something goes wrong with the build check all step from the begin and proxy.

Successful? Voi-la, you're ready to eXo JCR development!


Eclipse IDE setup read there.

Several notes about Groovy support in Eclipse.
I have used Groovy-Eclipse plugin of version 2.0.0 (update site). After generation from maven2 project (via mvn eclipse:eclipse) and import into Eclipse I found that Groovy-Eclipse doesn't recognize the project as a Groovy project and as a result the plugin has no sense for development.
Trouble can be fixed by Eclipse project file (.project) manual editing. Add the next line to natures element

<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>

and refresh the project.
Another issue with the plugin it's switch to Groovy 1.6.x compiler. Why 1.6? eXoJCR 1.12 bundled with Groovy 1.6.5, it's better to use closer version in IDE.

Enjoy!

Sunday, October 11, 2009

About team truths and business

How personal truth and business can go together?

I'm very excited by the voice on the subject: "Facilitating: the skill of multiple partiality".

Thank you, Yves Hanoulle!

I as a Scrum Master and Super Scrum Master see fights between the truths on every sprint, especially on retrospectives. It is really hard to do not judge the side when his/her position makes (or can) the team commitments lower or causes team failures during the sprint. But he/she has its own truth...

Usually I try to fulfill the company needs, keeping the team interests how it is possible. But so, I risk to do not fulfill the needs how the Product Owner (PMs etc) see them. At other hand there is a risk of team overkill as SM have to protect the developers . So in such case it would be simple to be neutral... yes, it's impossible actually. And yes - coaching might help to investigate and solve such problem.

It is important to respect truths of all parties... but it is much important to make truths of all parties are right to the business.
How to do that? Many tools: sociology, negotiations, leadership, common idea, shared responsibility... And run forming-storming-norming-performing.

Thank you Yves again!

I'm glad to find real-life questions and answers on your blog.
How to grow a self-organizing team…
The power of the junior on the team
How to work with a whiteboard with a distributed team?

Wednesday, September 23, 2009

JCR based Content Management

Why JCR is good for Content Management?

JCR standard (Java Content Repository, JSR-170) prescribed several best-practices already existing in content-management. Versioning, locking, content types, observation XML export/import and search - all of them were already implemented and sold to customers. But each one in "a bit" different, proprietary way.

Application developers and custom solution integrators will be able to avoid the costs associated with learning the particular API of each repository vendor. Instead, programmers will be able to develop content-based application logic independently of the underlying repository architecture or physical storage.
Customers will also benefit by being able to exchange their underlying repositories without touching any of the applications built on top of them

Sounds good! It is good actually!

JCR it is a software developers API not a content writers tool. But can be used pretty (and should) to create amazing content-oriented products and concentrate on goals.

In addition to mentioned features (versions, locks etc) JCR gives high-level abstraction on actual data storage. Content developer doesn't care about a content storage location (files, database, S3) and creates features on top of JCR Repositories.
Each Repository consists at least one Workspace. But when you can have several it will be naturally to implement workflow like "draft", "acceptance", "production" and "backup".
Workspaces support Corresponding Nodes (4.10.2), so content branching and update between workspaces are native to JCR. Lot of opportunities with it...

Discussing is One Repository Even an Option? It's interesting to apply JCR features for such question.
The question is wide and a business related but in some sense it can be satisfied for both sides.
JCR Repository can contains several Workspaces with data from very different sources (databases, files and even in-cloud like Amazon S3). Each workspace connects via configuration and actual data location is fully transparent for content users.

JCR implementation can supports many persistent backends actually.
While SQL database connected Workspaces for a production, we on eXo have SimpleDB experimental support also. eXo JCR persistent layer has CRUD API and can be implemented independently on other features.

On other hand JCR specification might seem not complete as it doesn't cover network access to a content. But shouldn't. It's the Java API only.
Here JCR vendors make the game. For example eXo JCR and Jackrabbit have such option as WebDAV access to a Repository. That gives a great opportunity to use JCR hosted content in web-pages without coding.

Real example of JCR based CMS

eXo WCM 1.2. Distro comes with lot of cool options and it runs fully on JCR storage and brings many JCR features to a content users.

eXoPlatform Web Content Management solution is emerging to help webmasters who handle all tasks needed to run a website, including development, deployment, design, content publication and monitoring. WCM facilitates managing website easily. In addition, the Webmasters are no more the only actors in the spotlight. Each member in the community is welcome to collaborate and contribute depending on his/her rights. All these features contribute to make the website management agile and less onerous.

Interesting? Find more in the wiki.

I'll show here how eXo WCM leverages JCR features for Content creation and sharing.

Usecase: one Repository... distributed worldwide.
Our virtual European company will provide information from one of its partners in United States on the company's site Home page.

Download and install eXo WCM on virtual company host. Run it and open Home page http://localhost:8080/portal. (user: root, password:exo)


This is a default eXo WCM Home page. Let's customize company Home page with the partner content. Partner company runs similar WCM instance and both WCMs are configured in multi-db JCR mode.
We configure dedicated workspace "exo-partner1" on both WCMs. This workspace will be connected to a one physical database (e.g. on partner side).


In addition to a JCR's Workspaces the eXo WCM introduces concept of Drive. Drive it is a sub-tree of Nodes or whole Workspace. Drive provides additional logical layer to a content management and allows to create different UI presentations dedicated to tasks.

Connect "exp-partner1" workspace as a new Drive (Groups->Sites Administrator->Content Presentation->Manage Drives->Add Drive) with rights to administrative group (*:/platform/administrators).


Now data can be simple shared between the company and the partner in one Repository. Users can read/write this workspace content, e.g. in WCM SitesExplorer or via WebDAV. And they can don't know where and how actual data is located at all.


Customizing the company Home page. Another cool feature of eXo WCM it's switcher from Live to Edit mode makes this task pretty simple. Switch to Edit mode.


Now we can edit each page part just in few clicks. Let's change the Test part.
Go to Image Properties of the existing image and fix its link to a partner's image. WCM uses "collaboration" workspace for a content. But we have market investigation report in "exo-partner1" workspace. JCR path to the file in the workspace /reports-09-2009/web2.0-techs-fall2009.jpg. And Repository content available via WebDAV. So, we can point the file from the page with the URL http://localhost:18080/rest/private/jcr/repository/exo-partner1/reports-09-2009/web2.0-techs-fall2009.jpg


Fix background color of CSS in Advanced tab and the customization is done. Click save and see the Home page.
Cool! How simple we can do such work with eXo WCM and JCR.


In the example I have used eXo WCM features out of the box.
But the product is open for extensions and many custom needs can be added simple. E.g. the example can be improved with JCR Corresponding Nodes (4.10.2) feature. Then content from "exo-partner1" workspace will be cloned to "business" workspace with enabled versioning; additional operations on the content also can be implemented via Observation (8.3) or Action Extensions.

Conclusion

JCR spec designed as Java API but when it is used deeply in a CMS tool, all those features becomes available to users making a content development better. It is open specification and there are several open-source implementations of it. That gives a freedom of choose of CM product to a content providers. At other hand developers can create content-oriented applications independently on Repository implementation and work on features but not on storages. Useful!

Next version of JCR comes (JSR-283) , it was approved and it's time of implementation now.
On other side there are several projects of JCR integration/implementation in non-Java environments, e.g. Typo3 CR or Jackalope.

JCR standard is useful for CMS, that is about it actually.

Thursday, July 30, 2009

Setup eXo JCR development environment

Short intro in preparations to eXo JCR development.

All eXo products development based on Maven2 project management. So, easiest way to start the development with eXo it's to setup right Maven2 project and its dependencies.

eXo Portal (and ECM, DMS, WCM, CS, KS etc) developers can find lot of useful resources on eXo wiki:
All thing from there are actual for eXo JCR development also... but there is easiest way - just setup a right POM.

Prerequisites
  • Java 5 (add JDK executables to the PATH on your system)
  • Maven2 (add Maven2 executables to the PATH on your system, )
  • Eclipse (optional)
Creating project (POM)

We say that our project name is my-jcrapp (use your name instead of this dummy one).

In empty folder run Maven command:
mvn archetype:create -DgroupId=com.mycompany.exojcr -DartifactId=my-jcrapp
This command creates the project folder named my-jcrapp with ready to use files structure. There are pom.xml, src folder with place for application code and tests. Project model (pom.xml) contains dependencies declaration, here is only JUnit now.

eXo JCR dependency

So, you have to add eXo JCR dependency to the POM...

but... eXo JCR jar files don't live on central Maven2 repository, they are on eXoPlatform one.
Add eXo repo to Maven2 local repositories list: or into settings.xml or directly in the your project POM (add repositories element after the dependencies).
<repositories>
<repository>
<id>exo-int</id>
<name>exoplatform.org repository</name>
<url>http://maven2.exoplatform.org/rest/maven2 </url>
<layout>default</layout>
</repository>
</repositories>
Now add the JCR core dependency:
<dependency>
<groupid>org.exoplatform.jcr</groupid>
<artifactid>exo.jcr.component.core</artifactid>
<version>1.11.2</version>
<scope>compile</scope>
</dependency>
If you need JCR Ext features then add this dependency (in fact you need only Ext one, it will points JCR core itself):
<dependency>
<groupid>org.exoplatform.jcr</groupid>
<artifactid>exo.jcr.component.ext</artifactid>
<version>1.11.2</version>
<scope>compile</scope>
</dependency>
And it's ready to build!

Build project

Run given command and wait till eXo JCR with its dependencies will be downloaded to your local Maven2 repo (~25Mb):
mvn clean compile
and be sure you see BUILD SUCCESSFUL at the end of this execution.

If something goes wrong with the build check all step from the begin and proxy.

Successful? Voi-la, you're ready to eXo JCR development!

IDE

To write real code you need any of good Java IDE.
We're using Eclipse, the best one :). But NetBeans or Intellij Idea so good also.
Those short instructions are actual for any IDE, but I assumed that the IDE supports import of existing sources.

The best way it's to load just created my-jcrapp Maven2 project to the IDE.
Maven2 helps great with this task. Create Eclipse project files by the command:
mvn eclipse:eclipse
Then open Eclipse and Import the project as an existing project.


Add local Maven2 repo path variable M2_REPO to Java build classpath:


Now the project is ready to development in Eclipse:


Good luck!