当前位置: 首页 > news >正文

网站基站的建设方案/四川seo快速排名

网站基站的建设方案,四川seo快速排名,佛山哪里有网站开发?,seo网站排名优化工具在Liferay Enterprise中,对于License的使用和控制是十分讲究的,因为lincense决定了产品的使用能力和使用期限,我们现在就来深入分析下license. License的部署: 首先又要回到Listener了,见http://supercharles888.blog.…

 在Liferay Enterprise中,对于License的使用和控制是十分讲究的,因为lincense决定了产品的使用能力和使用期限,我们现在就来深入分析下license.

 

License的部署:

首先又要回到Listener了,见http://supercharles888.blog.51cto.com/609344/907286博客所说,在Liferay的MainServlet的启动过程中,当处理全局启动事件时,它会注册所有的antoDeployListener,其中,LicenseAutoDeployListener也位列其中:

 
  1. auto.deploy.listeners=\ 
  2.        com.liferay.portal.deploy.auto.OSGiAutoDeployListener,\ 
  3.        com.liferay.portal.deploy.auto.ExtAutoDeployListener,\ 
  4.        com.liferay.portal.deploy.auto.HookAutoDeployListener,\ 
  5.        com.liferay.portal.deploy.auto.LayoutTemplateAutoDeployListener,\ 
  6.        com.liferay.portal.deploy.auto.LiferayPackageAutoDeployListener,\ 
  7.        com.liferay.portal.deploy.auto.PortletAutoDeployListener,\ 
  8.        com.liferay.portal.deploy.auto.ThemeAutoDeployListener,\ 
  9.        com.liferay.portal.deploy.auto.WebAutoDeployListener,\ 
  10.        com.liferay.portal.deploy.auto.exploded.tomcat.HookExplodedTomcatListener,\ 
  11.        com.liferay.portal.deploy.auto.exploded.tomcat.LayoutTemplateExplodedTomcatListener,\ 
  12.        com.liferay.portal.deploy.auto.exploded.tomcat.PortletExplodedTomcatListener,\ 
  13.       com.liferay.portal.license.deploy.auto.LicenseAutoDeployListener,com.liferay.portal.deploy.auto.exploded.tomcat.ThemeExplodedTomcatListener 

 

所以,当我们初次吧License文件放在$LIFERAY_HOME/deploy目录下,就会触发LicenseAutoDeployListener做出响应,而它实现了AutoDeployListener接口,所以放license文件到deploy目录会触发它的deploy方法:

 
  1. public void deploy(File paramFile, String paramString) 
  2.  { 
  3.    if (a.isDebugEnabled()) 
  4.      a.debug("Invoking deploy for " + paramFile.getPath()); 
  5.    String str1 = FileUtil.getExtension(paramFile.getName()); 
  6.    if (!str1.equals("xml")) 
  7.      return
  8.    try 
  9.    { 
  10.      String str2 = FileUtil.read(paramFile); 
  11.      Document localDocument = SAXReaderUtil.read(str2); 
  12.      Element localElement = localDocument.getRootElement(); 
  13.      String str3 = localElement.getName(); 
  14.      if (!str3.equals("license")) 
  15.        return
  16.    } 
  17.    catch (Exception localException) 
  18.    { 
  19.      return
  20.    } 
  21.    if (a.isInfoEnabled()) 
  22.      a.info("Copying license for " + paramFile.getPath()); 
  23.    this.b.autoDeploy(paramFile, paramString); 
  24.  } 

 

从这里我们可以看到,它05-07行首先会去检查license文件的扩展名是否为xml 。然后第10-13行会利用SAXReadUtil来读取这个文件,并且第14行判定根元素是否为license。然后在22行打印出一行信息(因为默认日志的info级别是开启的,所以我们可以看到这行日志):

 
  1. 06:25:14,380 INFO  [LicenseAutoDeployListener:?] Copying license for D:\Liferay_Cluster_Enterprise\Node1\liferay-portal-tomcat-6.1.10-ee-ga1\liferay-portal-6.1.10-ee-ga1\deploy\license-portaldevelopment-developer-6.1-triallicenses.xml 

 

最后,第23行它去调用autoDeploy方法来进行部署工作,我们继续跟进。

这个b是LicenseAutoDeployer的一个实例,它才具体完成license的具体部署工作:

 
  1. public class LicenseAutoDeployer extends a 
  2.   implements AutoDeployer 
  3.   public void autoDeploy(File paramFile, String paramString) 
  4.   { 
  5.     try 
  6.     { 
  7.       this.a = FileUtil.read(paramFile); 
  8.       a(); 
  9.     } 
  10.     ...
  11.   } 

 

它首先在第08行用FileUtil来读取license文件,具体处理逻辑在a类的b()方法中:

 
  1. private com.liferay.portal.license.a b() 
  2.   { 
  3.     Document localDocument = SAXReaderUtil.read(this.a); 
  4.     Element localElement1 = localDocument.getRootElement(); 
  5.     String str1 = GetterUtil.getString(localElement1.elementTextTrim("account-name")); 
  6.     String str2 = GetterUtil.getString(localElement1.elementTextTrim("owner")); 
  7.     String str3 = GetterUtil.getString(localElement1.elementTextTrim("description")); 
  8.     String str4 = GetterUtil.getString(localElement1.elementTextTrim("product-name")); 
  9.     String str5 = GetterUtil.getString(localElement1.elementTextTrim("product-id"), "Portal"); 
  10.     String str6 = GetterUtil.getString(localElement1.elementTextTrim("product-version")); 
  11.     String str7 = GetterUtil.getString(localElement1.elementTextTrim("license-name")); 
  12.     String str8 = GetterUtil.getString(localElement1.elementTextTrim("license-type")); 
  13.     String str9 = GetterUtil.getString(localElement1.elementTextTrim("license-version")); 
  14.     DateFormat localDateFormat = DateFormat.getDateTimeInstance(0, 0, Locale.US); 
  15.     Date localDate1 = null
  16.     if (str8.equals("trial")) 
  17.       localDate1 = new Date(); 
  18.     else 
  19.       localDate1 = localDateFormat.parse(localElement1.elementTextTrim("start-date")); 
  20.     Date localDate2 = null
  21.     if (str8.equals("trial")) 
  22.     { 
  23.       long l1 = GetterUtil.getLong(localElement1.elementTextTrim("lifetime")); 
  24.       localDate2 = new Date(localDate1.getTime() + l1); 
  25.     } 
  26.     else 
  27.     { 
  28.       localDate2 = localDateFormat.parse(localElement1.elementTextTrim("expiration-date")); 
  29.     } 
  30.     int i = GetterUtil.getInteger(localElement1.elementTextTrim("max-servers")); 
  31.     int j = GetterUtil.getInteger(localElement1.elementTextTrim("max-http-sessions")); 
  32.     long l2 = GetterUtil.getLong(localElement1.elementTextTrim("max-concurrent-users")); 
  33.     long l3 = GetterUtil.getLong(localElement1.elementTextTrim("max-users")); 
  34.     ArrayList localArrayList1 = new ArrayList(); 
  35.     ArrayList localArrayList2 = new ArrayList(); 
  36.     ArrayList localArrayList3 = new ArrayList(); 
  37.     ArrayList localArrayList4 = new ArrayList(); 
  38.     a(localArrayList1, localElement1.element("host-names"), "host-name"); 
  39.     a(localArrayList2, localElement1.element("ip-addresses"), "ip-address"); 
  40.     a(localArrayList3, localElement1.element("mac-addresses"), "mac-address"); 
  41.     a(localArrayList4, localElement1.element("server-ids"), "server-id"); 
  42.     Element localElement2 = localElement1.element("servers"); 
  43.     if (localElement2 != null) 
  44.     { 
  45.       localObject1 = localElement2.elements("server"); 
  46.       Iterator localIterator = ((List)localObject1).iterator(); 
  47.       while (localIterator.hasNext()) 
  48.       { 
  49.         localObject2 = (Element)localIterator.next(); 
  50.         a(localArrayList1, ((Element)localObject2).element("host-names"), "host-name"); 
  51.         a(localArrayList2, ((Element)localObject2).element("ip-addresses"), "ip-address"); 
  52.         a(localArrayList3, ((Element)localObject2).element("mac-addresses"), "mac-address"); 
  53.         a(localArrayList4, ((Element)localObject2).element("server-ids"), "server-id"); 
  54.       } 
  55.     } 
  56.     Object localObject1 = localElement1.elementTextTrim("key"); 
  57.     Object localObject2 = new com.liferay.portal.license.a(str1, str2, str3, str4, str5, str6, str7, str8, str9, localDate1, localDate2, i, j, l2, l3, (String[])localArrayList1.toArray(new String[localArrayList1.size()]), (String[])localArrayList2.toArray(new String[localArrayList2.size()]), (String[])localArrayList3.toArray(new String[localArrayList3.size()]), (String[])localArrayList4.toArray(new String[localArrayList4.size()]), (String)localObject1); 
  58.     if (str8.equals("trial")) 
  59.       localObject2 = d.b((com.liferay.portal.license.a)localObject2); 
  60.     return (com.liferay.portal.license.a)(com.liferay.portal.license.a)localObject2; 
  61.   } 

 

这里可以看出,从第03-13行依次读取一些通用元素。然后第16行对是否是trial版本的license进行判断,一个license如下图所示:

 
  1. <?xml version="1.0"?> 
  2.  
  3. <license> 
  4.     <account-name>Liferay Trial</account-name> 
  5.     <owner>Charles Wang</owner> 
  6.     <description>30-Day Trial License</description> 
  7.     <product-name>Portal Development</product-name> 
  8.     <product-version>6.1</product-version> 
  9.     <license-name>Portal Developer</license-name> 
  10.     <license-type>developer</license-type> 
  11.     <license-version>3</license-version> 
  12.     <start-date>Sunday, June 17, 2012 7:00:00 AM GMT</start-date> 
  13.     <expiration-date>Tuesday, July 17, 2012 7:00:00 AM GMT</expiration-date> 
  14.     <max-http-sessions>10</max-http-sessions> 
  15.     <key>96af591fbfd1b507446223f679df4bbc4d8f51e9824f5424c0f83c42130c4c9180837cca5e9fc2e8dca0dffdae1cc0f1ca993f421c8c55f22153a28b970a6a6508ab22fa6180e7b66634451a1f8dd81eeb34ad936d1e13de77df4f6e216bed19e3ff69a01744b3b6258a17bcee435bed13820c5c00e2158553568cb9b2623c474508a3aa</key> 
  16. </license> 

 

从这里可以看出,我们的<license-type>是developer, 不是trail,所以代码会执行第19行和28行,这2行会分别读取<start-date>和<expiration-date>这2个元素。第30-55行会读取集群license的一些配置信息,因为我们的license是免费申请的,所以没有这些信息,所以跳过。然后就执行第56行,它会去读取<key>元素的信息。最终把所有必要信息填充到a对象中以便 以后使用。

 

License的管理:

对于License的管理主要在LicenseManager类中。主要方法之一为checkLicense,它会对license做合法性检查:

 




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

http://www.lbrq.cn/news/1444609.html

相关文章:

  • 网站超链接的优化/关键词排名顾问
  • 织梦本地做的网站内网访问不/靠谱的免费建站
  • 沭阳各乡镇做网站/短视频营销的特点
  • 传媒公司营业执照怎么办理/seo的作用是什么
  • 厦门 网站建设闽icp/手机免费建站系统
  • 网站设计收费标准/个人网站模板
  • 网站添加新闻栏怎么做/小程序模板
  • 用网站名查询网址/今日新闻最新
  • 做网站的收入来源/优化推荐
  • 微信引流推广网站建设/运城seo
  • 做网站公司哪家正规/广东seo网站设计
  • 网站数据库密码修改了要怎么做/成都网络营销搜索推广
  • wordpress建站空间推荐/18种最有效推广的方式
  • 网站服务器安装教程视频教程/企业培训课程名称
  • 商城网站入驻系统/网站建设服务
  • 南宁软件优化网站建设/网络seo招聘
  • 域名跟网站的区别/哪个app可以找培训班
  • 中学加强校园网站建设/网络营销的未来发展趋势
  • wordpress后台加载慢/重庆seo入门教程
  • 综合网站开发设计/百度广告竞价
  • 天河建设网站公司排名/在线一键生成网页
  • 网站建设及推广/南昌seo网站推广
  • 天猫是不是b2b电子商务网站/哈尔滨百度关键词优化
  • 做网站一定要用ps吗/软文例文 经典软文范例
  • 网站建设视频百度网盘/宁波网络营销怎么做
  • 网站受众群体/长沙seo免费诊断
  • 广昌网站建设/谷歌官方网站首页
  • 济宁专业网站建设/西安百度seo推广
  • 国内bi软件排名/武汉seo网站排名优化公司
  • 阿里云服务器做网站/龙岗网站制作
  • Poetry与UV——现代Python依赖管理的革新者
  • Qt 综述:从基础到一般应用
  • 202506 电子学会青少年等级考试机器人三级器人理论真题
  • 2025-08-09 李沐深度学习12——卷积神经网络基础
  • GitHub第三方登录全解析:OAuth 2.0流程详解(适合初学者)
  • Python樱花树