Fórumok

Hook in portlets plugin Deployment order

Morad Ahmad, módosítva 9 év-val korábban

Hook in portlets plugin Deployment order

Junior Member Bejegyzések: 71 Csatlakozás dátuma: 2010.06.16. Legújabb bejegyzések
Hello,

I have a hook within a portlets project. The hook refernces the portlets in the plugin to build the site. And It calls *LocalServiceUtil classes to add sample data.
However I can't ensure the portlets and permissions (in "resource-actions/default.xml") are already exists during the execution of the hook (SetupAction configured as application.startup.events=package.name.XXXSetupAction).

I then become a lot of "NoResource" Exceptions .... (#ADD_ENTRY, #ADD_TO_PAGE) .

The second deployment of the same plugin and reexecute of the SetupAction produces no exception because portlets and resources are already deployed!

Is there a way to enforce order 1. deploy portlets and resources, the run the SetupAction?

Thank you,
Morad.
thumbnail
Andew Jardine, módosítva 9 év-val korábban

RE: Hook in portlets plugin Deployment order

Liferay Legend Bejegyzések: 2416 Csatlakozás dátuma: 2010.12.22. Legújabb bejegyzések
I would actually suggest moving the hook to a separate project and then in the hook project setting a context dependency in the liferay-plugin-package.properties -- that way the hook will delay until the dependencies are met.
thumbnail
David H Nebinger, módosítva 9 év-val korábban

RE: Hook in portlets plugin Deployment order

Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Liferay uses the startup action to test whether resources exist and, when they do not, will insert them.

You're letting the Liferay boilerplate code handle it, which is fine, but then you have to accommodate for it some other way.
Morad Ahmad, módosítva 9 év-val korábban

RE: Hook in portlets plugin Deployment order

Junior Member Bejegyzések: 71 Csatlakozás dátuma: 2010.06.16. Legújabb bejegyzések
Thank you,

I must move the code to a separate hook plugin. But actually i expect portlets and resource should be deployed befor startup events fired.
thumbnail
Andew Jardine, módosítva 9 év-val korábban

RE: Hook in portlets plugin Deployment order

Liferay Legend Bejegyzések: 2416 Csatlakozás dátuma: 2010.12.22. Legújabb bejegyzések
Either way, using the plugin package dependencies, it won't actually deploy the hook until it sees that the portlet is present.