Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overriding Liferay Startup Events

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

like image 296
user1253847 Avatar asked Apr 27 '12 15:04

user1253847


1 Answers

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.

like image 92
Mark Avatar answered Oct 28 '22 10:10

Mark