0

I have a hook where to add an organization and few custom field variables (Expando Variables) automatically to a liferay portal. How do I run that hook or a method in the hook during liferay setup or the first time I start a liferay portal? Does anyone have any links or codes for this?

Thanks

saurjk
  • 973
  • 3
  • 13
  • 27

2 Answers2

2

To reiterate your requirement you need to do some custom actions when Liferay server is started, so from what I understand you need a startup custom action hook.

This is nothing but a simple hook where you would override some porperties from portal.properties and provide a custom action class like MyCustomStartupAction or MyCustomGlobalAction in that property and implement it.

In the user-guide here is a list of some properties you can configure: Startup Events

This SO Answer gives more information about creating a hook with such properties.

Community
  • 1
  • 1
Prakash K
  • 11,669
  • 6
  • 51
  • 109
1

When you deploy that Hook (war file) into your server and restart it, in the (bin) logs, you could see one log statement which says that your particular Hook is available for use. This means your Hook has been successfully deployed into your Liferay portal.

To run the Hook or invoke a particular method inside your Hook, you need to invoke the flow for which your Hook was written.

For eg., if you have written a hook for logout.events.post= and if you want to invoke this, then you need to logout from your portal.

In your case you have written a Hook for registration. So, you need to do registration. Remember your Hook method should have extended Action class.

Vikas V
  • 3,176
  • 2
  • 37
  • 60
  • I did not understand your answer. sorry. – saurjk Feb 07 '13 at 12:09
  • What I meant to say was, I think you did not understand my question fully. I actually need to run a method of liferay startup, esp. the first time liferay is started. I ma trying this by extending the UpgradeProgress interface and writing the codes I need run. But it hasn't work much. Got any ideas? – saurjk Feb 08 '13 at 08:15
  • You should paste the code for extending UpgradeProgress interface you have tried and the error you are getting for better answers here instead of generalizing your question. – Vikas V Feb 08 '13 at 08:29