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 @Override
029 public void determine(ServletContext servletContext) throws Exception {
030 determineSupportsHotDeploy(servletContext);
031 }
032
033 @Override
034 public boolean isSupportsHotDeploy() {
035 return _supportsHotDeploy;
036 }
037
038 protected void determineSupportsHotDeploy(ServletContext servletContext)
039 throws Exception {
040
041 DeepNamedValueScanner deepNamedValueScanner = new DeepNamedValueScanner(
042 "masterView");
043
044 deepNamedValueScanner.setExcludedClassNames("org.apache.felix.");
045 deepNamedValueScanner.setSkipFirstCount(4);
046
047 deepNamedValueScanner.scan(servletContext);
048
049 if (deepNamedValueScanner.isScanning()) {
050 _supportsHotDeploy = false;
051
052 return;
053 }
054
055 Object masterViewObject = deepNamedValueScanner.getMatchedValue();
056
057 deepNamedValueScanner = new DeepNamedValueScanner("autodeploy-enabled");
058
059 deepNamedValueScanner.setExcludedClassNames(
060 "org.apache.felix.", "CountStatisticImpl");
061 deepNamedValueScanner.setSkipFirstCount(2);
062 deepNamedValueScanner.setVisitMaps(true);
063
064 deepNamedValueScanner.scan(masterViewObject);
065
066 boolean autoDeployEnabled = true;
067
068 if (!deepNamedValueScanner.isScanning()) {
069 autoDeployEnabled = GetterUtil.getBoolean(
070 deepNamedValueScanner.getMatchedValue());
071 }
072
073 _supportsHotDeploy = autoDeployEnabled;
074 }
075
076 private boolean _supportsHotDeploy;
077
078 }