掲示板

Using JCR in Liferay

14年前 に Nadine R によって更新されました。

Using JCR in Liferay

Junior Member 投稿: 26 参加年月日: 09/07/30 最新の投稿
Dear all,

Liferay enables us to use JCR for document storage. May I use the same JCR database to store documents of my own.

Thanks in advance,
Nadine
thumbnail
14年前 に Jonas Yuan によって更新されました。

RE: Using JCR in Liferay

Liferay Master 投稿: 993 参加年月日: 07/04/27 最新の投稿
Hi Nadine,

Yes, you can use JCR hook (file system or database) for document storage.

But be noticed one related bug - JCR

http://issues.liferay.com/browse/LPS-5202

Thanks

Jonas Yuan
-----------------
The Author of Liferay Books:
Liferay Portal 5.2 Systems Development
Liferay Portal Enterprise Intranets
14年前 に Nadine R によって更新されました。

RE: Using JCR in Liferay

Junior Member 投稿: 26 参加年月日: 09/07/30 最新の投稿
Hi Jonas,

May I know in my JCR database which table contains the documents uploaded by JCRHook?

Nadine
14年前 に Nadine R によって更新されました。

RE: Using JCR in Liferay

Junior Member 投稿: 26 参加年月日: 09/07/30 最新の投稿
Hi all,

I need help!

i'm trying to use JCRHook for storing my documents in the JCR database:

Hook hook = HookFactory.getInstance();

... hook.getFileAsStream(...);

However, when deploying my SDK portlet, the server cannot find the class com.liferay.documentlibrary.util.Hook. This class is found in the portal-impl.jar which I don't know how to use! Where should I copy this jar file?

The other thing is that when I use the class com.liferay.documentlibrary.service.DLLocalService, my SDK portlet works fine since the jar used is the portal-service.jar.

Anyone can help me please?

Nadine
thumbnail
14年前 に Jonas Yuan によって更新されました。

RE: Using JCR in Liferay

Liferay Master 投稿: 993 参加年月日: 07/04/27 最新の投稿
Hi Nadine,

You may refer to this post:

Move FileSystemHook and JCRHook from portal-impl to portal-service?

Thanks

Jonas Yuan
-----------------
The Author of Liferay Books:
Liferay Portal 5.2 Systems Development
Liferay Portal Enterprise Intranets
14年前 に Nadine R によって更新されました。

RE: Using JCR in Liferay

Junior Member 投稿: 26 参加年月日: 09/07/30 最新の投稿
Hi Jonas,

thanks for the hint. I'd rather not touch the jar files so I will keep using the dlLocalService for saving my documents.



Cheers,
Nadine
thumbnail
13年前 に Jakub Liska によって更新されました。

RE: Using JCR in Liferay

Regular Member 投稿: 187 参加年月日: 10/03/25 最新の投稿
Hey,

If I look at the trunk of Liferay, there are some key classes :

Hooks (JCRHook, FileSystemHook, CMISHook, s3Hook) that are employed from within DLLocalServiceImpl.

Another alternative is using DLAppLocalServiceImpl that is employing LiferayLocalRepository or BaseLocalRepositoryImpl and the files are persisted in Database...

I don't understand much how to use the Liferay DL API properly to persist files into JCR repository, filesystem, database etc. It has changed a lot and there is not much information about that in general.

Could please anybody collaborate on this one please ? Thank you
thumbnail
13年前 に Jonas Yuan によって更新されました。

RE: Using JCR in Liferay

Liferay Master 投稿: 993 参加年月日: 07/04/27 最新の投稿
Hi Jakub,

Repository migration is provided as default function. Thus Hooks (JCRHook, FileSystemHook, CMISHook, s3Hook) are OK to stay in portal-impl.

Do you agree with me?

Thanks

Jonas Yuan
thumbnail
13年前 に Jakub Liska によって更新されました。

RE: Using JCR in Liferay

Regular Member 投稿: 187 参加年月日: 10/03/25 最新の投稿
Hi Jonas,

I'm not sure, it depends on a lot of questions ...

For instance,

Do we prefer lower usability and possibility to extend document management or guarantee that we can always easily migrate our repository ?

As far as one expect that all CRUD to be done via UI of document library or alfresco UI or DLLocalService, it is fine....

But to be honest, I see the solution as it is now a little "closed" for extensions.

What would you do, if you had following scenario :

Portlet with html form that users upload documents ( ODF, MS office docs, PDF ) to and you would have to do some further analysis ( like Metadata extraction or parsing content using Apache tika, language detection, counting words etc), possibly some event handling.

Possibly one would create an extension to alfresco that has already a light abstraction as to metadata and content extraction and it stores metadata into DB and document on filesystem. Or the same thing using Jackrabbit, which would be a little more complicated.

Now what to do in Liferay where I need to use the metadata ? I'm talking about the Dublin core type of metadata + additional metadata that results from the "further analysis".

You see ? Now, as it is, it is perfectly suitable for simple document management. CMIS is great, but what if I had a repository in alfresco with additional metadata, it wouldn't be of much use right ?

I just can't seem to find a suitable way for this. :-)
thumbnail
13年前 に Alexander Chow によって更新されました。

RE: Using JCR in Liferay

Liferay Master 投稿: 518 参加年月日: 05/07/20 最新の投稿
Hi Jakub,

The changes in the 6.1 DLAppService was fundamentally a merger of the DLFolderService and DLFileEntry service in order to make it easier to build out third-party repositories. The documentation for this will come but, honestly, we are still a few months away from 6.1 release. Perhaps I will have a chance in the next few weeks to write a blog about this to explain what has happened.

You are correct in saying that at present, there is no exposing the metadata from your third-party repository to Liferay. And, while you are able to add custom properties to the Liferay DL, it is not something that would be passed down to the repository either. These are both things we are trying to figure out in terms of how to expose the information to the various parties. The fundamental problem is that CMIS right now does not have a means to specify how this is done. There is currently a proposal out about this in the specification committee, but it has yet to make it into an official version of CMIS. Today, if you want an Alfresco aspect, you use Alfresco. If you want Liferay custom properties, you use that.

Hope that helps to clarify a few things. Unfortunately, I don't think it satisfies your concerns.

Alex
thumbnail
13年前 に Jakub Liska によって更新されました。

RE: Using JCR in Liferay

Regular Member 投稿: 187 参加年月日: 10/03/25 最新の投稿
Thank you Alex, I'm getting a better grasp of it after all. It is quite a complex thing to worry about :-)

Could you please tell me what do you mean by this :
And, while you are able to add custom properties to the Liferay DL .....

Either this String properties
hook.addFile(companyId, portletId, groupId, repositoryId, fileName, fileEntryId, [b]properties[/b], modifiedDate, serviceContext, is);
......
......
document.addText(Field.PROPERTIES, properties);

Or creating expando for fileEntry ?

For many use cases, it would be enough having something like the hook.addFile( ) method with Map properties; ... If you know what I mean.
thumbnail
13年前 に Jakub Liska によって更新されました。

RE: Using JCR in Liferay

Regular Member 投稿: 187 参加年月日: 10/03/25 最新の投稿
Hi Alex,

is BaseRepository supposed, in addition to mounting repos via CMIS , also for establishing a unified access layer to a repository ? For instance, if I have a use case like this one, for which I would have to use jackrabbit directly. And now I'm wondering if the best way how to do it is to implement/extend BaseRepository. So that it could be plugged into DL for document browsing and basic operations.

As my requirement is to add custom properties into a JCR repo, I could implement the interface and additionally I'd add methods like
addFile( Map<string, string> properties, JcrMixinType type, ........) </string,>
where mixinType would be JCR mixin that my own JcrHook implementation would added like this : content.addMixin("custom:metadata"); and populated that with with properties supplied.

My requirement is just using jackrabbit for documents and their metadata management, but also I'd like those documents accessible via Document Library, documents only.

Or is it possible use the same jackrabbit repository with direct access and at the same time have it as a jcrHook repository for Document Library ??

I would very appreciate your conception of this.
thumbnail
13年前 に Jakub Liska によって更新されました。

RE: Using JCR in Liferay

Regular Member 投稿: 187 参加年月日: 10/03/25 最新の投稿
I think I have the answers,

are you planning to implement the remaining CMISRepository type that would have Local Binding ?

So that in CMISRpository.getSession( ) would be also a condition like :
		if (isLocal()) {
			        parameter.put(SessionParameter.BINDING_TYPE, BindingType.LOCAL.value());
                                parameter.put(SessionParameter.LOCAL_FACTORY, "my.local.factory");


Where implementation of the ServiceFactory would be a third party responsibility, as well as the implementation of CMIS services that access the repository.

This way, Liferay could communicate with both remote repositories and local repositories running in the same JVM