Tuesday, December 4, 2012

Haproxy fails to reload on Fedora 17

The great load balancer Haproxy has indeed a small but annoying problem on Fedora 17 (64bit in my case). While start and stop works perfect via systemctl, the balancer reload fails without any clear message what is happened.

After few hours of digging in the starter bash script /etc/init.d/haproxy we found that the problem lies outside it, it is seems in Fedora's systemctl at all, in the /etc/init.d/functions include used in the balancer starter.

How to workaround the problem of Haproxy reload? Just remove following line from the end of functions file:
"x$1" = xreload -o \

After removal script code will look like this:
if [ "$_use_systemctl" = "1" ]; then
        if  [ "x$1" = xstart -o \
                "x$1" = xstop -o \
                "x$1" = xrestart -o \
                "x$1" = xtry-restart -o \
                "x$1" = xforce-reload -o \
                "x$1" = xcondrestart ] ; then

                systemctl_redirect $0 $1
                exit $?
        fi
fi
And Haproxy starter script finally is: 
#!/bin/sh
#
# haproxy
#
# chkconfig:   - 85 15
# description:  HAProxy is a free, very fast and reliable solution \
#               offering high availability, load balancing, and \
#               proxying for TCP and  HTTP-based applications
# processname: haproxy
# config:      /etc/haproxy/haproxy.cfg
# pidfile:     /var/run/haproxy.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0

exec="/usr/sbin/haproxy"
prog=$(basename $exec)

[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog

lockfile=/var/lock/subsys/haproxy

check() {
    $exec -c -V -f /etc/$prog/$prog.cfg
}

start() {
    $exec -c -q -f /etc/$prog/$prog.cfg
    if [ $? -ne 0 ]; then
        echo "Errors in configuration file, check with $prog check."
        return 1
    fi

    echo -n $"Starting $prog: "
    # start it up here, usually something like "daemon $exec"
    daemon $exec -D -f /etc/$prog/$prog.cfg -p /var/run/$prog.pid
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}

stop() {
    echo -n $"Stopping $prog: "
    # stop it here, often "killproc $prog"
    killproc $prog
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}

restart() {
    $exec -c -q -f /etc/$prog/$prog.cfg
    if [ $? -ne 0 ]; then
        echo "Errors in configuration file, check with $prog check."
        return 1
    fi
    stop
    start
}

reload() {
    $exec -c -q -f /etc/$prog/$prog.cfg
    if [ $? -ne 0 ]; then
        echo "Errors in configuration file, check with $prog check."
        return 1
    fi
    #echo -n $"Reloading $prog by command: "
    #echo "$exec -V -D -f /etc/$prog/$prog.cfg -p /var/run/$prog.pid -sf $(cat /var/run/$prog.pid)"
    $exec -D -f /etc/$prog/$prog.cfg -p /var/run/$prog.pid -sf $(cat /var/run/$prog.pid)
    retval=$?
    return $retval
}

force_reload() {
    restart
}

fdr_status() {
    status $prog
}

case "$1" in
    start|stop|restart)
        $1
        ;;
    reload)
        reload
        ;;
    force-reload)
        force_reload
        ;;
    check)
        check
        ;;
    status)
        fdr_status
        ;;
    condrestart|try-restart)
      [ ! -f $lockfile ] || restart
    ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
        exit 2
esac
But take in account, applying this workaround we are letting all output (echo ect) from the reload code to be printed out to a console where systemctl reload haproxy.service (or old-style service haproxy reload) will be invoked. The same actual for other services that used /etc/init.d/functions, in Fedora 17 case it's ipsec, network and few else.


Sunday, April 29, 2012

Setup MongoDB on Fedora 14


MongoDB is an open source document-oriented NoSQL database system. It is used in many apps especially when it is a startup what should be cloud ready.

VMware's Cloud Found provides MongoDB out of the box and in time of writing this their Micro Edition proposes version 1.8.

To start develop with Cloud Foundry we need (it's recommended) to have the same versions of the services as on the cloud but locally.

Unfortunately Fedora 14 can propose only MongoDB 1.6, so we have to do the installation for the version 1.8 manually and there is a good description of steps we need - Use MongoDB to Store Application Data on Fedora 14 - but file locations will differ.

First ensure our system is up to date: yum update.

MongoDB will be installed in /opt/mongodb folder and data with logs will be in /var/lib/mongodb:
mkdir -p /var/lib/mongodb
mkdir data1
mkdir logs
touch /var/lib/mongodb/logs/data1.log

Create user mongodb with its home dir in our server folder:
useradd -M -r --home-dir /opt/mongodb mongodb
And make it able to access our data folder:
chown -R mongodb:mongodb /var/lib/mongodb

Download and unarchive MongoDB:
cd /opt/
wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-1.8.0.tgz
tar xvf mongodb-linux-x86_64-1.8.0.tgz
ln -s ./mongodb-linux-x86_64-1.8.0 ./mongodb

We linking actual directory to /opt/mongodb this will let us to switch between versions of MongoDB in case of a need in future.

Basic configuration of MongoDB is very simple. Need point to a listening address and set data and logs folders. Our configuration will be in /opt/mongodb/config/mongod.conf file:
# Configuration Options for MongoDB
#
# For More Information, Consider:
# - Configuration Parameters: http://www.mongodb.org/display/DOCS/Command+Line+Parameters
# - File Based Configuration: http://www.mongodb.org/display/DOCS/File+Based+Configuration

dbpath = /var/lib/mongodb/data1
logpath = /var/lib/mongodb/logs/data1.log
logappend = true

bind_ip = 127.0.0.1
port = 27017
fork = true

auth = true
# noauth = true

Create service control script /etc/rc.d/init.d/mongodb:
#! /bin/sh
#
# mongodb – this script starts and stops the mongodb daemon
#
# chkconfig: - 85 15
# description: MongoDB is a non-relational database storage system.
# processname: mongodb
# config: /optg/mongodb/config/mongod.conf
# pidfile: /opt/mongodb/mongo.pid

# Source function library
. /etc/rc.d/init.d/functions

user=mongodb
prog="mongod"
mongod="/opt/mongodb/bin/$prog --fork --config /opt/mongodb/config/mongod.conf"

RETVAL=0

start() {
  echo -n "Starting MongoDB... "
  daemon --user "$user" $mongod
  RETVAL=$?
  echo
  [ $RETVAL -eq 0 ] && touch /opt/mongodb/$prog.lock
}

stop() {
  echo -n "Stopping MongoDB"
  killproc $prog
  RETVAL=$?
  echo
  [ $RETVAL -eq 0 ] && rm -f /opt/mongodb/$prog.lock
}

restart() {
  stop
  start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload|force-reload)
        restart
        ;;
  status)
        status $mongod
        RETVAL=$?
        ;;
      *)
        echo "Usage: $0 {start|stop|status|restart|reload|force-reload}"
        RETVAL=1
esac

exit $RETVAL
After this we can start MongoDB:
service mongodb start

And checking if it works
cd /opt/mongodb/bin
./mongo
MongoDB shell version: 1.8.0
connecting to: test
> 

MongoDB is up and running.


Sunday, March 14, 2010

eXo JCR 1.12 is out

This week we have released a next step of eXoJCR evolution.

What is new and major in version 1.12?

First of all eXoJCR it's an open-source implementation of JCR specification (JSR-170) and now it's under LGPL license (was AGPL). LGPL means freedom for use in closed (commercial, private etc) projects. Doing this step we want to get more feedback about JCR technology in real world usecases. At other hand lesser license opens us an opportunity to work with many JBoss teams and especially with Portal guys. GateIn portal it's a web face of a Content Repositories actually... as well as many other tasty features :).

But eXoJCR 1.12 is very interesting technically also.

Our new, big and #1 feature today - clustering.

It's not a very new option and we had a replication in 1.11. But it was designed for data synchronization between sites over Internet in on-line peer-to-peer mode (available since version 1.10). And then used by several our customers for a clustering in Intranet solutions. We gathered lot of feedback and real usecases and decided to re-implement it from the scratch in 1.12.

The new clustering goals mean intensively loaded Repository work in corporate network or a cloud. At same time a main look made on read operations scalability what is general for Web applications.
Technically the new cluster uses the same JGroups transport well known to us by 1.11 replication (and still used in asynchronous replication). But now the clustering work fully based on JBossCache. We rely on JBoss experience in this field. And we have implemented not trivial task - hierarchical JCR data caching over the JBossCache keeping a compatibility with existing persistence. We also reimplemented JCR indexer and locks support on JBossCache.
A complex work done and we're on a next iteration there.

Other main features of eXoJCR 1.12.0-GA since 1.11.2
- Lazy-load option for child nodes and properties read, improved items
dataflow for read/write operations
- Alternative data container optimized for read operations (consuming
less database queries). It's enabled by default.
- Support of Java6 and Java5 runtimes and JDK
- Database dialect can be autodetected (if not pointed in the configuration)
- Support for Values large of 2GiB
- Portal container configuration supports default definitions,
links and externally loaded parameters
- Support of MySQL/InnoDB database for multilingual content
- Concurrency improvements for Session registry and Values storage
- Concurrency improvements for XA transactions support (Repository
login and logout are faster now)
- Improved search based on Lucene 2.4
- Standalone container can use configuration stored in JBoss application server
configuration directory by default
- WebDAV server update-policy can be configured to different
versioning behaviour
- Two new REST services introduced:
* HTTP (RESTful) Backup agent with console client
* HTTP (RESTful) Repository management service

More info about inherited features from the previous versions 1.11.2 here.

eXoJCR 1.12 was tested on databases/JDBC drivers:
MySQL 5.1 MYSQL Connector/J 5.1.8
Oracle DB 10g (10.2.0.1) Oracle 10g (10.2.0.1)
PostgresSQL 8.3.7 JDBC4 Driver, Version 8.3-605
DB2 9,7 IBM Data Server Driver for JDBC and SQLJ (JCC Driver)
Version: 9.1 (fixpack 3a)
MS SQL Server 2005 SP3 JDBC Driver 2.0
MS SQL Server 2008 SP1 JDBC Driver 2.0
Sybase 15.0.2 JConnect v6.0.5 (Build 26564 / 11 Jun 2009)

Downloads of a standalone eXoJCR bundles available now.
Tomcat or EAR provides a network ready content server with several plain samples. It provides WebDAV and FTP (port 2121) services on the board.

eXoJCR 1.12.0-GA jars are on JBoss maven2 repo also.
There are short intro how to setup dev environment for eXoJCR 1.12.

Where you can see eXoJCR in action (soon):
eXoJCR 1.12 is a database of GateIn portal.
eXoJCR 1.12 also used in xCMIS - eXo's CMIS implementation.
And our services...

Lot of stuff... stay connected. Details more interesting.

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!

Monday, July 27, 2009

eXo JCR 1.11.2: overview

eXo JCR 1.11.2 is out - What are inside.

This is a new version of our JCR 1.x product line.
It will be a "database" for a next version of eXo Portal.

eXo JBoss JCR project will be based on this release codebase also.

With many features listed below eXo JCR is ready to content-oriented-architecture. Check them here in short or visit eXo JCR wiki for a full list of capabilities.

Try eXo JCR in action via bundled samples - read after the features.

Main features

eXo JCR it’s an implementation of Java Content Repository API (JSR-170). Java Content Repository provides common programmatic interface to stores of hierarchical and unstructured data, content versioning, locking, observation, search (including full-text search), content export/import and many more.

In addition to JSR-170 features we provide Extension Actions API which allow use of programmatic actions triggering on content update or access. Actions can be configured via filters.

Plus you can find set of useful Extensions out of the box:

eXo JCR supports RMI, WebDAV and FTP network access to a repository.

Repository implementation uses database as a persistent storage for a content. We support Oracle, DB2, MySQL, PostgreSQL, MSSQL, Ingres, Derby and HSQLDB backends.

It’s possible to store content using External Value storage. Our implementation comes with several file-system storages. External Value storage API allows develop custom storages e.g. for store data on type or in customer databases.

Additionally we’re supporting Amazon Web Services as a backend:


Samples

To see the JCR in action download eXo JCR Tomcat bundle, extract it in empty folder and run eXo.bat (eXo.sh for Unixes) fron bin folder. Bundle contains full JCR with dependencies - it's ready base for eXo & JCR development.
There are two very simple visual applications: JCR browser and JCR FCKeditor. After the Tomcat started open the url: http://localhost:8080/browser

Sample bundles comes with enabled WebDAV and FTP JCR servers also. So you can surf Repository from external, e.g. via Windows Web-folders or any FTP-client (port 2121).

Open WebDAV view http://localhost:8080/rest/jcr/repository/production/ (for Windows Web-folders open vie InternetExplorer: Ctrl+O, enter the view url and enable "Open as Web-folder").

We provide Samples as EAR also. Deploy procedure described in the readme.txt of the bundle. EAR contains full JCR with dependencies and same samples as Tomcat bundle.

RMI bundle contains RMI Server and sample client binaries, it's useful example to start JCR-RMI coding.

All eXo JCR Samples runs in StandaloneContainer, so it's ready to embedding to another applications or can be used as standalone application (web or via main class).

eXo JCR can be used in PortalContainer also, eXo Portal uses it in that way.


Main changes of eXo JCR 1.11.2
  • JCR Core Binary Values improved processing: use of input stream with only on-demand spooling of big Binary Values.
  • Asynchronous and Synchronous replication Binary Values processing improved: changes storage for replication use less amount of files
  • Lot of Asynchronous replication improvements: merger, subscriber lifecycle, connection and local storage consistency etc.
  • Synchronous Replication Proxy mode simple configuration. Proxy Replication allows several running servers on the same physical host (useful for development).
  • Support of Values large of 2GiB in External Value Storage.
  • JCR Core Node.gatProperties() bugfix of duplicate Properties returned for unsaved Node when changes occurs in another Session.
  • Lot of minor Backup Service bugs fixed. Asynchronous restore support added.
  • HTTP Backup agent improvements of API.
  • WeBDAV codestyle refactoring and bugfixes of PROPPATCH and DELETE calls
  • Version history Import/Export utility bugfix of Items import.
Find more about eXo JCR on wiki.

Ask about JCR on the Community forum.

Download eXo JCR 1.11.2 from OW2 Forge page.

Sources repository here.


Friday, October 24, 2008

New eXo Platform JCR v.1.10

Today we have released eXo Platform JCR v.1.10.

This is a improvement version of 1.x JCR family
which comming with set of new features.

JCR 1.10 contains such new features as
- JCR based Organization Service
- Amazon SimpleDB
support for Workspace storage
- Repositoy management with ONLINE, READ-ONLY and OFFLINE states
- Content Addressable External Values Storage
- New authentication policy mechanism
- FCKeditor uses REST based access to JCR resources

Main improvements are
- Cache optimization for Items access and modification
- Replication members connection recovery and priority mechanism
- Replication BLOBs processing mechanism
- SessionProvider multithreading usage
- Item Move and Remove operations optimization
- ACL and Permissions logic upgraded

In this release we work on
quality and performance of JCR core.
You will meet better speed of Items Move, Copy, Clone and Remove
operations.
Versioning and Locking operations are faster now too.
Be in touch with eXo JCR performance & QA process here.

We have modernized our Replication service.
The service new features such as Members priority and
Member 'heart-beat' mechanism will help implement more realistic
JCR Cluster.
Replication BLOBs operations were tested again and some issues fixed.
New articles about Replication/Cluster configuration published on eXo wiki.
We have reviewed set of validation aspects according the JSR-170
specification in our JCR core. JCR Path validation more strict now.
Security level and JCR Permissions upgraded using new eXo Core
Security service.

But lets talk about new features of the eXo JCR 1.10.

We start eXo
Organization Service API implementation on JCR storage.
The service actually transparent for other applications having use
Organization Service API, sure as eXoPlatform Portal or ECM.
Only simple component should be configured.
All existing listeners and initializers can be used with the service.

We step on to SaaS path these days :)
eXo JCR storage in Amazon SimpleDB and S3 are beta now.
Yes as the Amazon services.
Today you can setup eXo JCR (Portal, ECM) on SimpleDB (and S3),
put the application on EC2 and you got it.
It's beta now. Beta status mostly thanks to Amazon... the stuff thanks
to Amazon.
But we run it on demo EC2. Ask us if you are interested!

External Values Storage now can be CASasble.
We are supporting Content-Addressable-Storage.
The feature most useful for usecases where same content may be
stored (duplicated) in different locations.
With the Value storage the Value will stored once (one file)
and will be shared between multiple JCR Properties.

So... add Repository state management, new authentication policy,
WebDAV improvements and REST based access to a JCR content.
Would it be tasty for Web2.0, 3.0?

Find more details on JIRA.

Try it! Adopt it!

Ask me ;)

Saturday, July 26, 2008

Manage content with Java Content Repository

Very useful technology for Java developers, and not only

Technology specification

http://jcp.org/en/jsr/detail?id=170

Implementations
Usage

It's similar to a File System we use everyday. But has more features and advantages.

You have to obtain a Repository instance to start. It's implementation specific and simple for most JCRs.

Each Repository presents a list of workspaces. Let us imagine it's drives in file system.

To begin the work with a content you have to login into Repository with selected Workspace.

InitialContext ctx = ...
Repository repository = (Repository)ctx.lookup("myrepo");
// Get a Credentials object
Credentials credentials = new SimpleCredentials("MyName", "MyPassword".toCharArray());
// Get a Session
Session mySession = repository.login(credentials, "MyWorkspace");

After the login you have the Session. So, you have a tool which gives access to a content storage.

Add 'file'

Node myFile = mySession.getRootNode().addNode("my-first-file");

Node it's only object which handles 'file' entity... say handler. Node may contains Property(es). The Property it's a content. String, Integer, Float, Binary, Path etc.

You will use Property to read/write data.

Write
myFile.setProperty("creator_name", "John");
myFile.setProperty("create_date", Calendar.getInstance());
myFile.setProperty("file_content", source.getInputStream());
Read
myFile.getProperty("creator_name").getSTring();
myFile.getProperty("create_date").getDate();
myFile.getProperty("file_content").getStream();

So, not so complicated.

Node can include sub-nodes also. It's only managed by NodeType (like file type, but richer).
myFile.addNode("sub-file");

You may get Node or Property by path, relative from other Node or Property or via Session.

// relative
Node ssFile = myFile.getNode("sub-file/sub-sub-file");
// or by abs path
Node ssFile = (
Node) mySession.getItem("/my-first-file/sub-file/sub-sub-file");

Simple? I hope - yes.

It's a good alternative to a databases in content-oriented applications and makes development process close to a task. A developer should know at least the specification, but it's simple than JDBC anyway.