Liferay 启动过程分析16-初始化插件

本文详细解析了Liferay系统的启动过程,重点介绍了MainServlet中的插件初始化步骤,包括SetupWizardUtil.isSetupFinished()方法的使用及条件判断逻辑,为理解Liferay启动机制提供了清晰的指引。

 MainServlet中,初始化公司信息之后就是初始化插件了,对应代码如下:

 
  
  1.     if (_log.isDebugEnabled()) { 
  2.             _log.debug("Initialize plugins"); 
  3.         } 
  4.  
  5.         try { 
  6.             initPlugins(); 
  7.         } 
  8. .. 

 

它会去调用initPlugins方法:

 
  
  1. protected void initPlugins() throws Exception { 
  2.  
  3.         // See LEP-2885. Don't flush hot deploy events until after the portal 
  4.         // has initialized. 
  5.  
  6.         if (SetupWizardUtil.isSetupFinished()) { 
  7.             HotDeployUtil.setCapturePrematureEvents(false); 
  8.  
  9.             PortalLifecycleUtil.flushInits(); 
  10.         } 
  11.     } 

 

这里很简单,只要进行SetupWizardUtil.isSetupFinished的判断:

 
  
  1. public static boolean isSetupFinished() { 
  2.         if (PropsValues.SETUP_WIZARD_ENABLED) { 
  3.             return _setupFinished; 
  4.         } 
  5.  
  6.         return true
  7.     } 

这个方法会先去判断是否开启了setup向导,这个值写在portal.properties文件中:

 
  
  1.    # Set this property to true if the Setup Wizard should be displayed the 
  2.    # first the portal is started. 
  3.    # 
  4.    setup.wizard.enabled=true 

从这里看出,默认portal第一次启动会启动向导,所以isSetupFinished()返回的是_setupFinished的值,也就是false。

 

所以我们不执行07-09行的代码。

 

现在,Liferay的启动过程就算正式完成了。





本文转自 charles_wang888 51CTO博客,原文链接:http://blog.51cto.com/supercharles888/907671,如需转载请自行联系原作者

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值