Overriding Liferay Startup Events

狂风中的少年 提交于 2019-12-06 04:55:26

问题


I have a question with respect to Liferay Startup Events.

In Liferay documentation it is given:

Startup Events

Input a list of comma delimited class names that extend com.liferay.portal.struts.SimpleAction. These classes will run at the specified event.

Could anybody please tell me what is the difference between global.startup.events and application.startup.events and could any body tell me in what case do we need to override them?

And should both these start up events extend com.liferay.portal.struts.SimpleAction?? and I couldn't find anything inside the SimpleAction except this:

public abstract class SimpleAction {

    public abstract void run(String[] ids) throws ActionException;

    }
}

I also wanted to know this class contains nothing, how does Liferay knows what XML files to read and process?

Thanks


回答1:


global.startup.events - run once for global server

application.startup.events - run for every portal instance at startup. If you have one portal instance at your server (normal case) - here is no difference between this properties. I use application.startup.events.

Extend the com.liferay.portal.kernel.events.SimpleAction class and impliment run-methode, that will call by liferay startup. For this purpose create a hook plugin and register in liferay-hook.xml the property file, e.g.:

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

Create portal-myext.properties in classpath and set your startup action:

application.startup.events=com.my.actions.MyStartupAction

The action MyStartupAction must be in the same classpath, hence same hook-plugin.



来源:https://stackoverflow.com/questions/10353881/overriding-liferay-startup-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!