diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-09-06 10:57:39 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-09-06 10:58:14 +0300 |
commit | 201121c5e00ee78d85add849f8b071fce076cc0d (patch) | |
tree | bb61d130e1250e80e00326743974389c4e9db7b5 /server | |
parent | 83675b500405ef3281f2fa143a091030684d67e5 (diff) | |
download | vaadin-framework-201121c5e00ee78d85add849f8b071fce076cc0d.tar.gz vaadin-framework-201121c5e00ee78d85add849f8b071fce076cc0d.zip |
Rename ApplicationConfiguration -> DeploymentConfiguration (#9402)
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/DefaultDeploymentConfiguration.java (renamed from server/src/com/vaadin/DefaultApplicationConfiguration.java) | 19 | ||||
-rw-r--r-- | server/src/com/vaadin/server/AbstractVaadinService.java | 13 | ||||
-rw-r--r-- | server/src/com/vaadin/server/BootstrapHandler.java | 2 | ||||
-rw-r--r-- | server/src/com/vaadin/server/DeploymentConfiguration.java (renamed from server/src/com/vaadin/server/ApplicationConfiguration.java) | 7 | ||||
-rw-r--r-- | server/src/com/vaadin/server/PortletCommunicationManager.java | 2 | ||||
-rw-r--r-- | server/src/com/vaadin/server/ServletPortletHelper.java | 4 | ||||
-rw-r--r-- | server/src/com/vaadin/server/VaadinPortlet.java | 35 | ||||
-rw-r--r-- | server/src/com/vaadin/server/VaadinService.java | 6 | ||||
-rw-r--r-- | server/src/com/vaadin/server/VaadinServlet.java | 41 | ||||
-rw-r--r-- | server/src/com/vaadin/server/VaadinSession.java | 16 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java | 4 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java | 10 |
12 files changed, 76 insertions, 83 deletions
diff --git a/server/src/com/vaadin/DefaultApplicationConfiguration.java b/server/src/com/vaadin/DefaultDeploymentConfiguration.java index 2e2267193e..6159137cc3 100644 --- a/server/src/com/vaadin/DefaultApplicationConfiguration.java +++ b/server/src/com/vaadin/DefaultDeploymentConfiguration.java @@ -19,12 +19,11 @@ package com.vaadin; import java.util.Properties; import java.util.logging.Logger; -import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.Constants; +import com.vaadin.server.DeploymentConfiguration; -public class DefaultApplicationConfiguration implements - ApplicationConfiguration { - private final Properties applicationProperties; +public class DefaultDeploymentConfiguration implements DeploymentConfiguration { + private final Properties initParameters; private boolean productionMode; private boolean xsrfProtectionEnabled; private int resourceCacheTime; @@ -32,9 +31,9 @@ public class DefaultApplicationConfiguration implements private boolean idleRootCleanupEnabled; private final Class<?> systemPropertyBaseClass; - public DefaultApplicationConfiguration(Class<?> systemPropertyBaseClass, - Properties applicationProperties) { - this.applicationProperties = applicationProperties; + public DefaultDeploymentConfiguration(Class<?> systemPropertyBaseClass, + Properties initParameters) { + this.initParameters = initParameters; this.systemPropertyBaseClass = systemPropertyBaseClass; checkProductionMode(); @@ -102,14 +101,14 @@ public class DefaultApplicationConfiguration implements */ public String getApplicationProperty(String parameterName) { - String val = applicationProperties.getProperty(parameterName); + String val = initParameters.getProperty(parameterName); if (val != null) { return val; } // Try lower case application properties for backward compatibility with // 3.0.2 and earlier - val = applicationProperties.getProperty(parameterName.toLowerCase()); + val = initParameters.getProperty(parameterName.toLowerCase()); return val; } @@ -223,7 +222,7 @@ public class DefaultApplicationConfiguration implements @Override public Properties getInitParameters() { - return applicationProperties; + return initParameters; } } diff --git a/server/src/com/vaadin/server/AbstractVaadinService.java b/server/src/com/vaadin/server/AbstractVaadinService.java index 516ce23333..dc6342b299 100644 --- a/server/src/com/vaadin/server/AbstractVaadinService.java +++ b/server/src/com/vaadin/server/AbstractVaadinService.java @@ -23,21 +23,20 @@ import java.util.ServiceLoader; public abstract class AbstractVaadinService implements VaadinService { private AddonContext addonContext; - private final ApplicationConfiguration applicationConfiguration; + private final DeploymentConfiguration deploymentConfiguration; - public AbstractVaadinService( - ApplicationConfiguration applicationConfiguration) { - this.applicationConfiguration = applicationConfiguration; + public AbstractVaadinService(DeploymentConfiguration deploymentConfiguration) { + this.deploymentConfiguration = deploymentConfiguration; } @Override - public ApplicationConfiguration getApplicationConfiguration() { - return applicationConfiguration; + public DeploymentConfiguration getDeploymentConfiguration() { + return deploymentConfiguration; } @Override public ClassLoader getClassLoader() { - final String classLoaderName = getApplicationConfiguration() + final String classLoaderName = getDeploymentConfiguration() .getApplicationOrSystemProperty("ClassLoader", null); ClassLoader classLoader; if (classLoaderName == null) { diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index 37b9649e55..4ebac73b6b 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -459,7 +459,7 @@ public abstract class BootstrapHandler implements RequestHandler { } defaults.put("heartbeatInterval", vaadinService - .getApplicationConfiguration().getHeartbeatInterval()); + .getDeploymentConfiguration().getHeartbeatInterval()); defaults.put("appUri", getAppUri(context)); diff --git a/server/src/com/vaadin/server/ApplicationConfiguration.java b/server/src/com/vaadin/server/DeploymentConfiguration.java index dfb202f3fa..0333091632 100644 --- a/server/src/com/vaadin/server/ApplicationConfiguration.java +++ b/server/src/com/vaadin/server/DeploymentConfiguration.java @@ -16,17 +16,18 @@ package com.vaadin.server; +import java.io.Serializable; import java.util.Properties; /** - * A collection of properties configured for all applications as well as a way - * of accessing third party properties not explicitely supported by this class. + * A collection of properties configured at deploy time as well as a way of + * accessing third party properties not explicitly supported by this class. * * @author Vaadin Ltd * @version @VERSION@ * @since 7.0.0 */ -public interface ApplicationConfiguration { +public interface DeploymentConfiguration extends Serializable { /** * Returns whether Vaadin is in production mode. * diff --git a/server/src/com/vaadin/server/PortletCommunicationManager.java b/server/src/com/vaadin/server/PortletCommunicationManager.java index 5b6948e2e3..fe22ea770e 100644 --- a/server/src/com/vaadin/server/PortletCommunicationManager.java +++ b/server/src/com/vaadin/server/PortletCommunicationManager.java @@ -129,7 +129,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { protected String getMainDivStyle(BootstrapContext context) { VaadinService vaadinService = context.getRequest() .getVaadinService(); - return vaadinService.getApplicationConfiguration() + return vaadinService.getDeploymentConfiguration() .getApplicationOrSystemProperty( VaadinPortlet.PORTLET_PARAMETER_STYLE, null); } diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java index f964415fdc..e7e4c813ce 100644 --- a/server/src/com/vaadin/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/server/ServletPortletHelper.java @@ -43,7 +43,7 @@ class ServletPortletHelper implements Serializable { static Class<? extends Application> getLegacyApplicationClass( VaadinService vaadinService) throws ApplicationClassException { - Properties initParameters = vaadinService.getApplicationConfiguration() + Properties initParameters = vaadinService.getDeploymentConfiguration() .getInitParameters(); String applicationParameter = initParameters.getProperty("application"); ClassLoader classLoader = vaadinService.getClassLoader(); @@ -133,7 +133,7 @@ class ServletPortletHelper implements Serializable { public static void initDefaultUIProvider(VaadinSession application, VaadinService vaadinService) throws ApplicationClassException { - String uiProperty = vaadinService.getApplicationConfiguration() + String uiProperty = vaadinService.getDeploymentConfiguration() .getInitParameters().getProperty(VaadinSession.UI_PARAMETER); if (uiProperty != null) { verifyUIClass(uiProperty, vaadinService.getClassLoader()); diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index be571fbf60..4c902252c9 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -55,7 +55,7 @@ import javax.servlet.http.HttpServletResponse; import com.liferay.portal.kernel.util.PortalClassInvoker; import com.liferay.portal.kernel.util.PropsUtil; -import com.vaadin.DefaultApplicationConfiguration; +import com.vaadin.DefaultDeploymentConfiguration; import com.vaadin.server.AbstractCommunicationManager.Callback; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; import com.vaadin.server.VaadinSession.ApplicationStartEvent; @@ -78,8 +78,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { private final VaadinPortlet portlet; public PortletService(VaadinPortlet portlet, - ApplicationConfiguration applicationConfiguration) { - super(applicationConfiguration); + DeploymentConfiguration deploymentConfiguration) { + super(deploymentConfiguration); this.portlet = portlet; } @@ -90,7 +90,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { @Override public String getConfiguredWidgetset(WrappedRequest request) { - String widgetset = getApplicationConfiguration() + String widgetset = getDeploymentConfiguration() .getApplicationOrSystemProperty(PARAMETER_WIDGETSET, null); if (widgetset == null) { @@ -324,41 +324,38 @@ public class VaadinPortlet extends GenericPortlet implements Constants { @Override public void init(PortletConfig config) throws PortletException { super.init(config); - Properties applicationProperties = new Properties(); + Properties initParameters = new Properties(); // Read default parameters from the context final PortletContext context = config.getPortletContext(); for (final Enumeration<String> e = context.getInitParameterNames(); e .hasMoreElements();) { final String name = e.nextElement(); - applicationProperties.setProperty(name, - context.getInitParameter(name)); + initParameters.setProperty(name, context.getInitParameter(name)); } // Override with application settings from portlet.xml for (final Enumeration<String> e = config.getInitParameterNames(); e .hasMoreElements();) { final String name = e.nextElement(); - applicationProperties.setProperty(name, - config.getInitParameter(name)); + initParameters.setProperty(name, config.getInitParameter(name)); } - ApplicationConfiguration applicationConfiguration = createApplicationConfiguration(applicationProperties); - vaadinService = createPortletService(applicationConfiguration); + DeploymentConfiguration deploymentConfiguration = createDeploymentConfiguration(initParameters); + vaadinService = createPortletService(deploymentConfiguration); addonContext = new AddonContext(vaadinService); addonContext.init(); } - protected ApplicationConfiguration createApplicationConfiguration( - Properties applicationProperties) { - return new DefaultApplicationConfiguration(getClass(), - applicationProperties); + protected DeploymentConfiguration createDeploymentConfiguration( + Properties initParameters) { + return new DefaultDeploymentConfiguration(getClass(), initParameters); } protected PortletService createPortletService( - ApplicationConfiguration applicationConfiguration) { - return new PortletService(this, applicationConfiguration); + DeploymentConfiguration deploymentConfiguration) { + return new PortletService(this, deploymentConfiguration); } @Override @@ -830,8 +827,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { newApplication.setLocale(locale); // No application URL when running inside a portlet newApplication.start(new ApplicationStartEvent(null, getVaadinService() - .getApplicationConfiguration(), - new PortletCommunicationManager(newApplication))); + .getDeploymentConfiguration(), new PortletCommunicationManager( + newApplication))); addonContext.fireApplicationStarted(newApplication); return newApplication; diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java index 41c864fcd9..1e9a2667c3 100644 --- a/server/src/com/vaadin/server/VaadinService.java +++ b/server/src/com/vaadin/server/VaadinService.java @@ -106,11 +106,11 @@ public interface VaadinService extends Serializable { public String getMimeType(String resourceName); /** - * Gets the application configuration. + * Gets the deployment configuration. * - * @return the application configuration + * @return the deployment configuration */ - public ApplicationConfiguration getApplicationConfiguration(); + public DeploymentConfiguration getDeploymentConfiguration(); public Iterator<AddonContextListener> getAddonContextListeners(); diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index ce436205d8..ff58c8da99 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -44,7 +44,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import com.vaadin.DefaultApplicationConfiguration; +import com.vaadin.DefaultDeploymentConfiguration; import com.vaadin.server.AbstractCommunicationManager.Callback; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; import com.vaadin.server.VaadinSession.ApplicationStartEvent; @@ -59,8 +59,8 @@ public class VaadinServlet extends HttpServlet implements Constants { private final VaadinServlet servlet; public ServletService(VaadinServlet servlet, - ApplicationConfiguration applicationProperties) { - super(applicationProperties); + DeploymentConfiguration deploymentConfiguration) { + super(deploymentConfiguration); this.servlet = servlet; } @@ -74,7 +74,7 @@ public class VaadinServlet extends HttpServlet implements Constants { .cast(request); String staticFileLocation; // if property is defined in configurations, use that - staticFileLocation = getApplicationConfiguration() + staticFileLocation = getDeploymentConfiguration() .getApplicationOrSystemProperty(PARAMETER_VAADIN_RESOURCES, null); if (staticFileLocation != null) { @@ -112,10 +112,9 @@ public class VaadinServlet extends HttpServlet implements Constants { @Override public String getConfiguredWidgetset(WrappedRequest request) { - return getApplicationConfiguration() - .getApplicationOrSystemProperty( - VaadinServlet.PARAMETER_WIDGETSET, - VaadinServlet.DEFAULT_WIDGETSET); + return getDeploymentConfiguration().getApplicationOrSystemProperty( + VaadinServlet.PARAMETER_WIDGETSET, + VaadinServlet.DEFAULT_WIDGETSET); } @Override @@ -193,41 +192,39 @@ public class VaadinServlet extends HttpServlet implements Constants { public void init(javax.servlet.ServletConfig servletConfig) throws javax.servlet.ServletException { super.init(servletConfig); - Properties applicationProperties = new Properties(); + Properties initParameters = new Properties(); // Read default parameters from server.xml final ServletContext context = servletConfig.getServletContext(); for (final Enumeration<String> e = context.getInitParameterNames(); e .hasMoreElements();) { final String name = e.nextElement(); - applicationProperties.setProperty(name, - context.getInitParameter(name)); + initParameters.setProperty(name, context.getInitParameter(name)); } // Override with application config from web.xml for (final Enumeration<String> e = servletConfig .getInitParameterNames(); e.hasMoreElements();) { final String name = e.nextElement(); - applicationProperties.setProperty(name, + initParameters.setProperty(name, servletConfig.getInitParameter(name)); } - ApplicationConfiguration applicationConfiguration = createApplicationConfiguration(applicationProperties); - servletService = createServletService(applicationConfiguration); + DeploymentConfiguration deploymentConfiguration = createDeploymentConfiguration(initParameters); + servletService = createServletService(deploymentConfiguration); addonContext = new AddonContext(servletService); addonContext.init(); } - protected ApplicationConfiguration createApplicationConfiguration( - Properties applicationProperties) { - return new DefaultApplicationConfiguration(getClass(), - applicationProperties); + protected DeploymentConfiguration createDeploymentConfiguration( + Properties initParameters) { + return new DefaultDeploymentConfiguration(getClass(), initParameters); } protected ServletService createServletService( - ApplicationConfiguration applicationConfiguration) { - return new ServletService(this, applicationConfiguration); + DeploymentConfiguration deploymentConfiguration) { + return new ServletService(this, deploymentConfiguration); } @Override @@ -642,7 +639,7 @@ public class VaadinServlet extends HttpServlet implements Constants { Locale locale = request.getLocale(); newApplication.setLocale(locale); newApplication.start(new ApplicationStartEvent(applicationUrl, - getVaadinService().getApplicationConfiguration(), + getVaadinService().getDeploymentConfiguration(), createCommunicationManager(newApplication))); addonContext.fireApplicationStarted(newApplication); @@ -1008,7 +1005,7 @@ public class VaadinServlet extends HttpServlet implements Constants { * parameter in web.xml */ int resourceCacheTime = getVaadinService() - .getApplicationConfiguration().getResourceCacheTime(); + .getDeploymentConfiguration().getResourceCacheTime(); response.setHeader("Cache-Control", "max-age= " + String.valueOf(resourceCacheTime)); } diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java index c4b0680c47..52a7cd72ee 100644 --- a/server/src/com/vaadin/server/VaadinSession.java +++ b/server/src/com/vaadin/server/VaadinSession.java @@ -128,7 +128,7 @@ public class VaadinSession implements Terminal.ErrorListener, public static class ApplicationStartEvent implements Serializable { private final URL applicationUrl; - private final ApplicationConfiguration configuration; + private final DeploymentConfiguration configuration; private final AbstractCommunicationManager communicationManager; @@ -141,7 +141,7 @@ public class VaadinSession implements Terminal.ErrorListener, * the communication manager for the application. */ public ApplicationStartEvent(URL applicationUrl, - ApplicationConfiguration configuration, + DeploymentConfiguration configuration, AbstractCommunicationManager communicationManager) { this.applicationUrl = applicationUrl; this.configuration = configuration; @@ -161,11 +161,11 @@ public class VaadinSession implements Terminal.ErrorListener, } /** - * Returns the application configuration used by this application. + * Returns the deployment configuration used by this session. * * @return the deployment configuration. */ - public ApplicationConfiguration getConfiguration() { + public DeploymentConfiguration getConfiguration() { return configuration; } @@ -187,7 +187,7 @@ public class VaadinSession implements Terminal.ErrorListener, /** * Configuration for the application. */ - private ApplicationConfiguration configuration; + private DeploymentConfiguration configuration; /** * The application's URL. @@ -421,7 +421,7 @@ public class VaadinSession implements Terminal.ErrorListener, * * @return the application configuration */ - public ApplicationConfiguration getConfiguration() { + public DeploymentConfiguration getConfiguration() { return configuration; } @@ -1885,7 +1885,7 @@ public class VaadinSession implements Terminal.ErrorListener, * * @see #getUidlRequestTimeout() * @see #closeInactiveUIs() - * @see ApplicationConfiguration#getHeartbeatInterval() + * @see DeploymentConfiguration#getHeartbeatInterval() * * @since 7.0.0 * @@ -1907,7 +1907,7 @@ public class VaadinSession implements Terminal.ErrorListener, * otherwise heartbeat requests are enough to extend UI lifetime * indefinitely. * - * @see ApplicationConfiguration#isIdleUICleanupEnabled() + * @see DeploymentConfiguration#isIdleUICleanupEnabled() * @see #getHeartbeatTimeout() * @see #closeInactiveUIs() * diff --git a/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java b/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java index d8d1521a4c..e949df466d 100644 --- a/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java +++ b/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java @@ -13,7 +13,7 @@ import javax.servlet.http.HttpServletRequest; import junit.framework.TestCase; -import com.vaadin.DefaultApplicationConfiguration; +import com.vaadin.DefaultDeploymentConfiguration; import com.vaadin.server.VaadinServlet.ServletService; public class TestAbstractApplicationServletStaticFilesLocation extends TestCase { @@ -32,7 +32,7 @@ public class TestAbstractApplicationServletStaticFilesLocation extends TestCase Field f = VaadinServlet.class.getDeclaredField("servletService"); f.setAccessible(true); f.set(servlet, new ServletService(servlet, - new DefaultApplicationConfiguration(servlet.getClass(), + new DefaultDeploymentConfiguration(servlet.getClass(), new Properties()))); } diff --git a/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java b/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java index acc89895ef..707eb577cc 100644 --- a/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java +++ b/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java @@ -8,8 +8,8 @@ import junit.framework.TestCase; import org.easymock.EasyMock; -import com.vaadin.DefaultApplicationConfiguration; -import com.vaadin.server.ApplicationConfiguration; +import com.vaadin.DefaultDeploymentConfiguration; +import com.vaadin.server.DeploymentConfiguration; import com.vaadin.server.DefaultUIProvider; import com.vaadin.server.VaadinService; import com.vaadin.server.VaadinSession; @@ -64,10 +64,10 @@ public class CustomUIClassLoader extends TestCase { assertEquals(MyUI.class, uiClass); } - private static ApplicationConfiguration createConfigurationMock() { + private static DeploymentConfiguration createConfigurationMock() { Properties properties = new Properties(); properties.put(VaadinSession.UI_PARAMETER, MyUI.class.getName()); - return new DefaultApplicationConfiguration(CustomUIClassLoader.class, + return new DefaultDeploymentConfiguration(CustomUIClassLoader.class, properties); } @@ -115,7 +115,7 @@ public class CustomUIClassLoader extends TestCase { private VaadinSession createStubApplication() { return new VaadinSession() { @Override - public ApplicationConfiguration getConfiguration() { + public DeploymentConfiguration getConfiguration() { return createConfigurationMock(); } }; |