留言板

Hook - global. startup. events

Jiri Mecner,修改在11 年前。

Hook - global. startup. events

New Member 帖子: 3 加入日期: 13-3-4 最近的帖子
Hi,

i have tryed use custom global.startup.events in my hook. I have followed book Liferay Portal Systems Development Second Edition. My hook consist of:

liferay-hook.xml
<!--?xml version="1.0"?-->


<hook>
	<portal-properties>portal.properties</portal-properties> 
</hook>


portal.properties
global.startup.events=com.liferay.sandbox.SandboxInitializationAction


but my action is not executed on server startup so i decided to debug code. At time when MainServlet calls processGlobalStartupEvents() global.startup.events = com.liferay.portal.events.GlobalStartupAction and only GlobalStartupAction is executed. Ok, then i decided to debug HookHotDeployListener mabe event will be executed there. At the first look global.startup.events is not present in SUPPORTED_PROPERTIES. When i go throught HookHotDeployListener i havent find any global.startup.events hanler.

Can anyone tell me what I missed?
thumbnail
Vitaliy Koshelenko,修改在11 年前。

RE: Hook - global. startup. events

Expert 帖子: 319 加入日期: 11-3-25 最近的帖子
You can use

application.startup.events instead of global.startup.events

if you need your custom event to be started when your hook applicaton is deployed.

Vitaliy
thumbnail
Andrew Jardine,修改在8 年前。

RE: Hook - global. startup. events

Liferay Legend 帖子: 2416 加入日期: 10-12-22 最近的帖子
One thing to note for this though is that in a multi-tenant environment (where you are using portal instances) the hook will run for EVERY instance when you use the application one. If you use the global one, then it will only run once. Unfortunately, I don't beleive that the global events are "hookable". I think y ou have to configure those in your portal-ext (or derivative) and make sure that the class is part of the classpath.

Alternatively, you could scope your hook to only run for the default instance using a little additional logic in the hook itself.
thumbnail
Olaf Kock,修改在8 年前。

RE: Hook - global. startup. events

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
Correct - global.startup.events is not hookable. The DTD says so (it's quite well commented). +1