001
014
015 package com.liferay.portal.server.capabilities;
016
017 import com.liferay.portal.kernel.util.GetterUtil;
018 import com.liferay.portal.server.DeepNamedValueScanner;
019
020 import javax.servlet.ServletContext;
021
022
026 public class GlassfishServerCapabilities implements ServerCapabilities {
027
028 public void determine(ServletContext servletContext) throws Exception {
029 determineSupportsHotDeploy(servletContext);
030 }
031
032 public boolean isSupportsHotDeploy() {
033 return _supportsHotDeploy;
034 }
035
036 protected void determineSupportsHotDeploy(ServletContext servletContext)
037 throws Exception {
038
039 DeepNamedValueScanner deepNamedValueScanner = new DeepNamedValueScanner(
040 "masterView");
041
042 deepNamedValueScanner.setExcludedClassNames("org.apache.felix.");
043 deepNamedValueScanner.setSkipFirstCount(4);
044
045 deepNamedValueScanner.scan(servletContext);
046
047 if (deepNamedValueScanner.isScanning()) {
048 _supportsHotDeploy = false;
049
050 return;
051 }
052
053 Object masterViewObject = deepNamedValueScanner.getMatchedValue();
054
055 deepNamedValueScanner = new DeepNamedValueScanner("autodeploy-enabled");
056
057 deepNamedValueScanner.setExcludedClassNames(
058 "org.apache.felix.", "CountStatisticImpl");
059 deepNamedValueScanner.setSkipFirstCount(2);
060 deepNamedValueScanner.setVisitMaps(true);
061
062 deepNamedValueScanner.scan(masterViewObject);
063
064 boolean autoDeployEnabled = true;
065
066 if (!deepNamedValueScanner.isScanning()) {
067 autoDeployEnabled = GetterUtil.getBoolean(
068 deepNamedValueScanner.getMatchedValue());
069 }
070
071 _supportsHotDeploy = autoDeployEnabled;
072 }
073
074 private boolean _supportsHotDeploy;
075
076 }