Foros de discusión

Support for ModeShape JCR repository

thumbnail
Jakub Liska, modificado hace 12 años.

Support for ModeShape JCR repository

Regular Member Mensajes: 187 Fecha de incorporación: 25/03/10 Mensajes recientes
Hey LR community,

I had a free afternoon, so I made Liferay work with ModeShape in addition to JackRabbit. As JCRStore uses javax.jcr API, it's just a matter of additional JCRFactory implementation. Nothing complex.

Modeshape is a JCR implementation with great ideas, architecture, documentation, project lead, learning curve etc. I liked it enough to start using it even though I was satisfied with jackrabbit. Imho it's a very healthy & perspective project.

Additional dependencies needed

modeshape-graph.jar
modeshape-repository.jar
modeshape-cnd.jar
modeshape-jcr-api.jar
modeshape-search-lucene.jar
modeshape-common.jar
modeshape-jcr.jar

lucene-regex.jar & lucene-misc.jar -- might be already part of some LR lucene-* jars, probably not


Changes made :
portal-impl/src/META-INF/jcr-spring.xml - register modeshape JCRFactoryImpl bean - might be one implementation for both modeshape & jackrabbit
JCRFactoryUtil decides which impl to use based on property - might be decided in JCRFactoryImpl if only one for both
new / modified JCRFactoryImpl

I made two alternatives work :

First one with ModeShape 2.4.0, that uses Lucene 3.0.x as Liferay does.
Second one with ModeShape 2.6.0, that uses Lucene 3.1.x -> problem

If you were to commit my patch, I'd rather wait some time utill LR uses 3.1.x Lucene, because modeshape 2.4 has additional dependencies
com.google.collections
jcip-annotations
lucene-snowball

and also the code is a little bit different. And after LR changes from 3.0.x to 3.1.x lucene, it would have to be modified back.

I run liferay tests and they pass with ModeShape except one thing

In DLFolderLocalService line 571
DLStoreUtil.deleteDirectory(companyId, repositoryId, dirName); where dirName is StringPool.BLANK

JackRabbit handles getNode(StringPool.BLANK); modeshape does not.

WDYT ? Anybody have info on Lucene 3.0.x / 3.1.x migration ? It would be worth it anyway, 3.1 release comes with a lot of performance improvements, new analyzers, etc.

Also this is a relevant issue LPS-20556
thumbnail
Ray Augé, modificado hace 12 años.

RE: Support for ModeShape JCR repository

Liferay Legend Mensajes: 1197 Fecha de incorporación: 8/02/05 Mensajes recientes
Hey Jakub,

It's a good idea! We've had our share of issues with the current impl, and so we're interested in this.

Unfortunately it won't be for the 6.1 release.

If you haven't already made a ticket for this, could you as a feature request/improvement?

Also, I would be tempted to go for the 2.6 version since we're likely to go to Lucene 3.1 during the next release anyway!

Also if you can convince some other community members to vote this up, we're trying really hard to make use of the voting mechanism in JIRA to take what the community considers most important.
thumbnail
Mika Koivisto, modificado hace 12 años.

RE: Support for ModeShape JCR repository

Liferay Legend Mensajes: 1519 Fecha de incorporación: 7/08/06 Mensajes recientes
This is a great idea and even if we can't include it in 6.1 OOTB there's nothing preventing from using it in 6.1 as hook plugin. I would really want to see a full JCR repository implementation also. It's much more usable than just binary storage for our internal repository implementation.
thumbnail
Jakub Liska, modificado hace 12 años.

RE: Support for ModeShape JCR repository

Regular Member Mensajes: 187 Fecha de incorporación: 25/03/10 Mensajes recientes
From the long term point of view, modeshape would be a solid backbone for content management in Liferay...I raised the feature request LPS-20767. I'm glad you like it.
thumbnail
Jakub Liska, modificado hace 12 años.

RE: Support for ModeShape JCR repository

Regular Member Mensajes: 187 Fecha de incorporación: 25/03/10 Mensajes recientes
Hi Mika,

there are still changes to JCRFactoryUtil for instance, that couldn't be done via hook, also JCRStore is not fully compatible with Modeshape, because it is adjusted for Jackrabbit.
thumbnail
Mika Koivisto, modificado hace 12 años.

RE: Support for ModeShape JCR repository

Liferay Legend Mensajes: 1519 Fecha de incorporación: 7/08/06 Mensajes recientes
You can implement a new store via hook. The idea was to not replace the existing but add a new one that's implemented on ModeShape. For 6.1 a ModeShape backed JCR repository implementation makes more sense than implementing a store. In 6.1 we already provide a DB backed store implementation for our own repository and that is why most people choose to use JCRHook.
thumbnail
Jakub Liska, modificado hace 12 años.

RE: Support for ModeShape JCR repository

Regular Member Mensajes: 187 Fecha de incorporación: 25/03/10 Mensajes recientes
It seems to me that none of us here is able to explain himself...And I don't feel like doing things when their purpose is not quite clear and I might be told that it was not what you were expected after I do it emoticon

FACTS :
I thought it made a good sense to have swappable JCR implementation, because the JCRStore interface is JCR impl independent

From what you say it is not clear whether you want to :

a) override JCRStore only (via Hook) with Modeshape JCRStore impl ( using Modeshape via LiferayRepository) - I'm not sure that having such a hook would make much sense...just a hook with code duplication that nobody will probably use

b) implement a new ModeshapeRepository ( not using Modeshape in form of a JCRStore via LiferayRepository) - again, I'm not sure what is the benefit of having it - it makes a good sense for CMIS but not so much sense if you need to manage the files via DL, use workflows, have them indexed. etc....
thumbnail
Mika Koivisto, modificado hace 12 años.

RE: Support for ModeShape JCR repository

Liferay Legend Mensajes: 1519 Fecha de incorporación: 7/08/06 Mensajes recientes
The reason I'm suggesting the use of hooks is because we are trying to minimize dependencies in the core. Most people use JCR store to cluster the doclib through DB but I think we will have a better alternative to that in 6.1. Then there are some people that want to use JCR so that their other apps can use it too but with the store it doesn't make sense because all metadata is stored in Liferay DB instead of JCR. Having a JCR repository implementation makes a lot of sense where you might want to read/write it from somewhere else other that Liferay doclib.
thumbnail
Jakub Liska, modificado hace 12 años.

RE: Support for ModeShape JCR repository

Regular Member Mensajes: 187 Fecha de incorporación: 25/03/10 Mensajes recientes
Sorry for the delay, vacation time... I would really like to create a Hook. In fact its a 7 minutes thing. Just let me say that there are 2 ways :

1.
new custom com.liferay.portlet.documentlibrary.store.JCRStore - which would be exactly the same except for obtaining a jcr session JCRFactoryUtil.createSession();

- imho it is not reasonable, abstract class BaseStore changes a little and hook wont compile + code duplication etc...

2.
liferay-hook.xml
<service>
		<service-type>com.liferay.portal.jcr.JCRFactory</service-type>
		<service-impl>com.liferay.portal.jcr.[b]modeshape[/b].JCRFactoryImpl</service-impl>
</service>

which practically changes what session (Jackrabbit / Modeshape) you get from JCRFactoryUtil.createSession(); from the same JCRStore

- this is imho reasonable way, but unfortunately JCRFactory interface is from portal-impl -> not reachable in hook

Do you think that you would be willing to make it part of portal-service ? For third parties to be able to make own implementations of it ? Like Modeshape JCRFactoryImpl
thumbnail
Jakub Liska, modificado hace 12 años.

RE: Support for ModeShape JCR repository

Regular Member Mensajes: 187 Fecha de incorporación: 25/03/10 Mensajes recientes
thumbnail
Jignesh Thakkar, modificado hace 10 años.

RE: Support for ModeShape JCR repository

Junior Member Mensajes: 26 Fecha de incorporación: 10/05/10 Mensajes recientes
Hi Jakub

its a nice forum that you shared information about JBoss ModeShape Integration with Liferay.

Actually I started to integration JBoss ModeShape 2.8.0 final version with Liferay 6.1.0 CE ga1-20120106155615760.

I followed your steps but its gives me compilation error as you are using some of java class which are dependendent on portal-impl.jar.

So, To resolve this,I use ext approach to do the same task.

I performed following steps to integrate ModeShape with Liferay

1) Create a new ext
2) Added the following properties in portal-ext

dl.store.impl=com.liferay.portal.jcr.modeshape.JCRStore

jcr.modeshape.repository.name=jpaRepo

jcr.modeshape.repository.root=${liferay.home}/data/modeshape
jcr.modeshape.config.file.path=${jcr.modeshape.repository.root}/repository.xml
jcr.modeshape.repository.home=${jcr.modeshape.repository.root}/home
jcr.modeshape.credentials.username=none
jcr.modeshape.credentials.password=none

spring.configs=\
META-INF/base-spring.xml,\
\
META-INF/hibernate-spring.xml,\
META-INF/infrastructure-spring.xml,\
META-INF/management-spring.xml,\
\
META-INF/util-spring.xml,\
\
META-INF/jpa-spring.xml,\
\
META-INF/audit-spring.xml,\
META-INF/cluster-spring.xml,\
META-INF/editor-spring.xml,\
META-INF/executor-spring.xml,\
META-INF/jcr-spring.xml,\
META-INF/modeshape-spring.xml,\
META-INF/ldap-spring.xml,\
META-INF/messaging-core-spring.xml,\
META-INF/messaging-misc-spring.xml,\
META-INF/mobile-device-spring.xml,\
META-INF/notifications-spring.xml,\
META-INF/poller-spring.xml,\
META-INF/rules-spring.xml,\
META-INF/scheduler-spring.xml,\
META-INF/scripting-spring.xml,\
META-INF/search-spring.xml,\
META-INF/workflow-spring.xml,\
\
META-INF/counter-spring.xml,\
META-INF/mail-spring.xml,\
META-INF/portal-spring.xml,\
META-INF/portlet-container-spring.xml,\
META-INF/staging-spring.xml,\
META-INF/virtual-layouts-spring.xml,\
\
#META-INF/dynamic-data-source-spring.xml,\
#META-INF/shard-data-source-spring.xml,\
#META-INF/memcached-spring.xml,\
#META-INF/monitoring-spring.xml,\
\
META-INF/ext-spring.xml

3) Created modeshape-spring.xml, under META-INF , I attached the same file for your reference
4) use the same code that you given in modeshape-hook and put it under proper path in ext-impl
5) Added the following jars under ext-lib/portal

modeshape-classloader-maven-2.8.0.Final
modeshape-client-2.8.0.Final
modeshape-clustering-2.8.0.Final
modeshape-cnd-2.8.0.Final
modeshape-common-2.8.0.Final
modeshape-connector-disk-2.8.0.Final
modeshape-connector-filesystem-2.8.0.Final
modeshape-connector-infinispan-2.8.0.Final
modeshape-connector-infinispan-5-2.8.0.Final
modeshape-connector-jbosscache-2.8.0.Final
modeshape-connector-jcr-2.8.0.Final
modeshape-connector-jdbc-metadata-2.8.0.Final
modeshape-connector-store-jpa-2.8.0.Final
modeshape-connector-svn-2.8.0.Final
modeshape-distribution-2.8.0.Final
modeshape-example-repositories-2.8.0.Final
modeshape-example-sequencers-2.8.0.Final
modeshape-extractor-tika-2.8.0.Final
modeshape-graph-2.8.0.Final
modeshape-integration-tests-2.8.0.Final
modeshape-jcr-2.8.0.Final
modeshape-jcr-api-2.8.0.Final
modeshape-jdbc-2.8.0.Final
modeshape-jdbc-local-2.8.0.Final
modeshape-jpa-ddl-gen-2.8.0.Final
modeshape-mimetype-detector-aperture-2.8.0.Final
modeshape-repository-2.8.0.Final
modeshape-search-lucene-2.8.0.Final
modeshape-sequencer-classfile-2.8.0.Final
modeshape-sequencer-cnd-2.8.0.Final
modeshape-sequencer-ddl-2.8.0.Final
modeshape-sequencer-images-2.8.0.Final
modeshape-sequencer-java-2.8.0.Final
modeshape-sequencer-jbpm-jpdl-2.8.0.Final
modeshape-sequencer-mp3-2.8.0.Final
modeshape-sequencer-msoffice-2.8.0.Final
modeshape-sequencer-sramp-2.8.0.Final
modeshape-sequencer-teiid-2.8.0.Final
modeshape-sequencer-text-2.8.0.Final
modeshape-sequencer-wsdl-2.8.0.Final
modeshape-sequencer-xml-2.8.0.Final

6 ) Deploy the ext and debug the code


Problem Statement : At the time of server startup, it goes to our JCRFactoryImpl class and call its constructor, but from there its gives Repository Exception.
Please find the attached exception.txt file for more reference.

Please suggest me that the flow that I taken was correct?
Please help me to resolve the error. It shows that jpaRepo is not a repository then please let me know where should I create this repository.

I am new to JCR and doing a modeshape first time.

Please help me to resolve the issue and my basic requirement is that ModeShape Integration with Liferay.

I also checked this url : http://issues.liferay.com/browse/LPS-20767 and found that there is problem with Liferay version 6.1.0 CE GA1. But I don't know whether it affects me or not

Please provide me your valuable inputs on this.