掲示板
How to implement Startup Action Hook in LIferay DXP?
6年前 に Kushagra Khanna によって更新されました。
How to implement Startup Action Hook in LIferay DXP?
Junior Member 投稿: 45 参加年月日: 14/12/28 最新の投稿
Hi Team,
I have a requirement where I have to create a hook that invoke "application.startup.events" in Liferay DXP.
How I can implement such hook in Liferay DXP and what are the configuration required for the same.
Regards,
Kushagra
I have a requirement where I have to create a hook that invoke "application.startup.events" in Liferay DXP.
How I can implement such hook in Liferay DXP and what are the configuration required for the same.
Regards,
Kushagra
6年前 に Olaf Kock によって更新されました。
RE: How to implement Startup Action Hook in LIferay DXP?
Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿Kushagra Khanna:
I have a requirement where I have to create a hook that invoke "application.startup.events" in Liferay DXP.
How I can implement such hook in Liferay DXP and what are the configuration required for the same.
You'd go for a lifecycle action. Here's a sample in a module. Check the blade-sample readme for alternative properties, to change it from a login action to another lifecycle action.
3年前 に asif aftab によって更新されました。
RE: How to implement Startup Action Hook in LIferay DXP?
Regular Member 投稿: 123 参加年月日: 13/09/02 最新の投稿
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.LifecycleAction;
import com.liferay.portal.kernel.events.SimpleAction;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;import org.osgi.service.component.annotations.Component;@Component(
immediate = true,
property = {
"key=application.startup.events"
},
service = LifecycleAction.class
)
public class CustomStartupAction extends SimpleAction{ private static final Log _log = LogFactoryUtil.getLog(CustomStartupAction .class);
@Override
public void run(String[] ids) throws ActionException { _log.info("----------------------------only on startup of server -------------------------------");
}}
import com.liferay.portal.kernel.events.LifecycleAction;
import com.liferay.portal.kernel.events.SimpleAction;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;import org.osgi.service.component.annotations.Component;@Component(
immediate = true,
property = {
"key=application.startup.events"
},
service = LifecycleAction.class
)
public class CustomStartupAction extends SimpleAction{ private static final Log _log = LogFactoryUtil.getLog(CustomStartupAction .class);
@Override
public void run(String[] ids) throws ActionException { _log.info("----------------------------only on startup of server -------------------------------");
}}
3年前 に David H Nebinger によって更新されました。
RE: How to implement Startup Action Hook in LIferay DXP?
Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
An easier solution may be to use an @Activate annotated method. This will run every time the bundle starts so you get it for initial portal startup, deployment, etc.
3年前 に asif aftab によって更新されました。
RE: How to implement Startup Action Hook in LIferay DXP?
Regular Member 投稿: 123 参加年月日: 13/09/02 最新の投稿
Thank you so much
I will try this
I will try this