覆盖Liferay启动事件 [英] Overriding Liferay Startup Events

查看:160
本文介绍了覆盖Liferay启动事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在Liferay文档中给出:


启动事件



输入扩展名为的逗号分隔的类名列表com.liferay.portal.struts.SimpleAction 。这些课程将在指定的事件中运行。


有人可以告诉我,全球之间有什么区别。 startup.events application.startup.events ,任何身体都可以告诉我,在什么情况下我们需要覆盖它们?



并且这两个启动事件应该扩展到 com.liferay.portal.struts.SimpleAction ??我没有在 SimpleAction 中找到任何东西,除了这个:

  public abstract class SimpleAction {

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

}
}

我也想知道这个类没有什么,Liferay如何知道要读取和处理的XML文件?



谢谢

解决方案

global.startup.events - 为全局服务器运行一次



application.startup.events - 在启动时为每个门户网站实例运行。如果您的服务器上有一个门户网站实例(正常情况) - 这里的属性没有区别。我使用 application.startup.events



扩展 com.liferay.portal。 kernel.events.SimpleAction class和impliment run -methode,将由liferay启动调用。为此,创建一个钩子插件并在liferay-hook.xml中注册属性文件,例如:

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

在类路径中创建 portal-myext.properties 并设置您的启动操作:

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

动作 MyStartupAction 必须在同一个类路径中,因此相同的钩子插件。


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

解决方案

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.

这篇关于覆盖Liferay启动事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆