In Liferay Enterprise, the use and control of license is very exquisite, because the lincense determines the use of products and the use of the term, we are now to in-depth analysis of the license.
Deployment of License:
First of all, back to listener, see http://supercharles888.blog.51cto.com/609344/907286 Blog said, in the Liferay mainservlet startup process, when dealing with the global startup event , it will register all the Antodeploylistener, of which Licenseautodeploylistener is also ranked:
01.auto.deploy.listeners=\
Com.liferay.portal.deploy.auto.osgiautodeploylistener,\
03. Com.liferay.portal.deploy.auto.extautodeploylistener,\
04. Com.liferay.portal.deploy.auto.hookautodeploylistener,\
05. Com.liferay.portal.deploy.auto.layouttemplateautodeploylistener,\
06. Com.liferay.portal.deploy.auto.liferaypackageautodeploylistener,\
07. Com.liferay.portal.deploy.auto.portletautodeploylistener,\
08. Com.liferay.portal.deploy.auto.themeautodeploylistener,\
09. 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
So, when we first put the license file in the $liferay_home/deploy directory, it triggers the licenseautodeploylistener to respond, and it implements the Autodeploylistener interface, So putting the license file into the Deploy directory triggers its Deploy method:
public void Deploy (File paramfile, String paramstring)
{
if (a.isdebugenabled ())
A.debug ("invoking deploy For "+ Paramfile.getpath ());
String str1 = fileutil.getextension (Paramfile.getname ());
if (!str1.equals ("xml")) return
;
Try
{
String str2 = Fileutil.read (paramfile);
Document localdocument = Saxreaderutil.read (str2);
Element localelement = Localdocument.getrootelement ();
String STR3 = Localelement.getname ();
if (!str3.equals ("license")) return
;
catch (Exception localexception)
{return
;
}
if (a.isinfoenabled ())
a.info ("Copying license for" + Paramfile.getpath ());
This.b.autodeploy (Paramfile, paramstring);
}
From here we can see that it's 05-07 lines first to check whether the extension of the license file is XML. The 第10-13 Guild then uses Saxreadutil to read the file, and line 14th determines whether the root element is license. Then print out a line of information on line 22 (because the info level of the default log is open, so we can see this line of log):
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
Finally, line 23rd it calls the Autodeploy method for deployment, and we continue to follow up.
This b is an example of Licenseautodeployer, which completes the specific deployment of license:
public class Licenseautodeployer extends a
implements Autodeployer
{public
void Autodeploy (File paramfile , String paramstring)
{
try
{
THIS.A = Fileutil.read (paramfile);
A ();
}
...
}
}