掲示板

Liferay DXP get system settings via service

thumbnail
6年前 に David Bougearel によって更新されました。

Liferay DXP get system settings via service

Junior Member 投稿: 54 参加年月日: 16/06/30 最新の投稿
Hi,

We are using System settings from Control Panel in Liferay DXP SP2 and we need to know how to retreive those data (maybe by using a local service like UserLocalServiceUtil ?)

Could you help me on this point ?

Thanks a lot,
David.
thumbnail
6年前 に David H Nebinger によって更新されました。

RE: Liferay DXP get system settings via service

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
The settings are in Config Admin now, they are not available via a standard Liferay service.

Which scope did you use in your ExtendedObjectClassDefinition scope?









Come meet me at the 2017 LSNA!
thumbnail
6年前 に David Bougearel によって更新されました。

RE: Liferay DXP get system settings via service

Junior Member 投稿: 54 参加年月日: 16/06/30 最新の投稿
Hi David,

Thanks for your answer, we want to get the Elastic configuration from Foundation tab of the System settings.
We have put elastic configurations inside the com.liferay.portal.search.elasticsearch.configuration.ElasticsearchConfiguration.cfg in the liferay.home/osgi/configs and we need to get them programmatically.

Do you have any idea to achieve this goal ?

Thanks a lot,
David.
thumbnail
6年前 に David Bougearel によって更新されました。

RE: Liferay DXP get system settings via service

Junior Member 投稿: 54 参加年月日: 16/06/30 最新の投稿
It's seems like my post is related to this one : https://web.liferay.com/fr/community/forums/-/message_boards/message/78981039

This post ask how to get system settings information from java or jsp or ftl/vm emoticon
thumbnail
6年前 に David H Nebinger によって更新されました。

RE: Liferay DXP get system settings via service

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
So the best way to solve a problem like this is to see how the portal does it...

I searched the code for "ElasticsearchConfiguration" expecting that I'd find not only the interface for the configuration, but also examples on how Liferay gets access to it.

All of the examples for this one were using ConfigurableUtil to create an instance. Some were more complicated than others, but this one seemed straight forward:
https://github.com/dnebing/liferay-portal/blob/master/modules/apps/foundation/portal-search/portal-search-elasticsearch/src/main/java/com/liferay/portal/search/elasticsearch/connection/ElasticsearchConnectionManager.java










Come meet me at the 2017 LSNA!
thumbnail
6年前 に David Bougearel によって更新されました。

RE: Liferay DXP get system settings via service

Junior Member 投稿: 54 参加年月日: 16/06/30 最新の投稿
I was looking into that direction, thanks a lot for your help David !

Have a nice day emoticon
thumbnail
6年前 に David Bougearel によって更新されました。

RE: Liferay DXP get system settings via service

Junior Member 投稿: 54 参加年月日: 16/06/30 最新の投稿
Hi David,

I wanted to inject the ElasticsearchConnectionManager OSGI service inside my OSGI service by using the following :

private ElasticsearchConnectionManager esConnectionmanager;

@Reference(unbind = "-")
protected void setElasticsearchConnectionManager(ElasticsearchConnectionManager esConnectionmanager){
this.esConnectionmanager = esConnectionmanager;
}

I've added it as dependency :

<dependency>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.portal.search.elasticsearch</artifactId>
<scope>provided</scope>
<version>2.1.4</version>
</dependency>

Unfortunately, with the bnd.file, the required package seems to not be exposed by liferay (com.liferay.portal.search.elasticsearch.connection -- Cannot be resolved) ; even by added it as import-package.

What i'm doing wrong in there ?

Thanks a lot,
David.
thumbnail
6年前 に David H Nebinger によって更新されました。

RE: Liferay DXP get system settings via service

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
David Bougearel:
What i'm doing wrong in there ?


Nothing.

For reasons that I don't totally understand, Liferay will export some packages but keep others private. I think the idea is that APIs can be public but they treat implementations as private. Unfortunately this means that usually we cannot access or use or extend their implementations which may be clean from an application architecture perspective, but as a platform perspective I think it's pretty short sighted.








Come meet me at the 2017 LSNA!
thumbnail
6年前 に David Bougearel によって更新されました。

RE: Liferay DXP get system settings via service

Junior Member 投稿: 54 参加年月日: 16/06/30 最新の投稿
Yes, from my point of view it's hard to understand how we can develop applications (portlets) without reuse what is in the liferay core and especially osgi services (like the elasticsearch client).

Anyway, thanks for your precious support David !

Best regards,
David.
thumbnail
6年前 に David Bougearel によって更新されました。

RE: Liferay DXP get system settings via service

Junior Member 投稿: 54 参加年月日: 16/06/30 最新の投稿
A user story in under study by liferay for the case : https://issues.liferay.com/browse/LPS-70480

I will keep an eye on it ;)