You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2010/11/20 19:53:29 UTC

svn commit: r1037297 - in /wicket/trunk: wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/ wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/ wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/ wi...

Author: jdonnerstag
Date: Sat Nov 20 18:53:29 2010
New Revision: 1037297

URL: http://svn.apache.org/viewvc?rev=1037297&view=rev
Log:
fixed WICKET-1945 make wicket's configuration type an enum
Issue: WICKET-1945

Added:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/RuntimeConfigurationType.java
Removed:
    wicket/trunk/wicket/Wicket - Regenerate Tests.launch
Modified:
    wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/YuiLib.java
    wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
    wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/RequestMapperApplication.java
    wicket/trunk/wicket-guice/src/main/java/org/apache/wicket/guice/GuiceComponentInjector.java
    wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/Application.java
    wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationMBean.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractRepeater.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/mock/MockApplication.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java

Modified: wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/YuiLib.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/YuiLib.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/YuiLib.java (original)
+++ wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/YuiLib.java Sat Nov 20 18:53:29 2010
@@ -55,7 +55,7 @@ public final class YuiLib implements ICl
 		{
 			StringBuffer sb = new StringBuffer();
 			sb.append("yuiloader");
-			if (Application.DEPLOYMENT.equals(Application.get().getConfigurationType()))
+			if (Application.get().usesDeploymentConfig())
 			{
 				sb.append("-min");
 			}

Modified: wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java (original)
+++ wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java Sat Nov 20 18:53:29 2010
@@ -31,6 +31,7 @@ import java.util.Map.Entry;
 
 import org.apache.wicket.Application;
 import org.apache.wicket.Component;
+import org.apache.wicket.RuntimeConfigurationType;
 import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.ajax.AjaxEventBehavior;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -80,7 +81,7 @@ public class DatePicker extends Abstract
 		try
 		{
 			GETINSTANCEMETHOD = DateFormatSymbols.class.getMethod("getInstance",
-					new Class[] { Locale.class });
+				new Class[] { Locale.class });
 		}
 		catch (Exception e)
 		{
@@ -99,11 +100,11 @@ public class DatePicker extends Abstract
 		public UnableToDetermineFormatException()
 		{
 			super("This behavior can only be added to components that either implement " +
-					ITextFormatProvider.class.getName() +
-					" AND produce a non-null format, or that use" +
-					" converters that this datepicker can use to determine" +
-					" the pattern being used. Alternatively, you can extend " +
-					" the date picker and override getDatePattern to provide your own");
+				ITextFormatProvider.class.getName() +
+				" AND produce a non-null format, or that use" +
+				" converters that this datepicker can use to determine" +
+				" the pattern being used. Alternatively, you can extend " +
+				" the date picker and override getDatePattern to provide your own");
 		}
 	}
 
@@ -126,7 +127,7 @@ public class DatePicker extends Abstract
 	private static final ResourceReference YUI = new JavascriptResourceReference(YuiLib.class, "");
 
 	private static final ResourceReference WICKET_DATE = new JavascriptResourceReference(
-			DatePicker.class, "wicket-date.js");
+		DatePicker.class, "wicket-date.js");
 
 	private static final long serialVersionUID = 1L;
 
@@ -236,9 +237,9 @@ public class DatePicker extends Abstract
 		variables.put("showOnFieldClick", showOnFieldClick());
 		// variables for YUILoader
 		variables.put("basePath",
-				Strings.stripJSessionId(RequestCycle.get().urlFor(YUI, null).toString()) + "/");
+			Strings.stripJSessionId(RequestCycle.get().urlFor(YUI, null).toString()) + "/");
 		variables.put("wicketDatePath", RequestCycle.get().urlFor(WICKET_DATE, null));
-		if (Application.DEVELOPMENT.equals(Application.get().getConfigurationType()))
+		if (Application.get().usesDevelopmentConfig())
 		{
 			variables.put("filter", "filter: \"RAW\",");
 			variables.put("allowRollup", false);
@@ -253,7 +254,7 @@ public class DatePicker extends Abstract
 		if (script != null)
 		{
 			variables.put("additionalJavascript",
-					Strings.replaceAll(script, "${calendar}", "YAHOO.wicket." + widgetId + "DpJs"));
+				Strings.replaceAll(script, "${calendar}", "YAHOO.wicket." + widgetId + "DpJs"));
 		}
 		// print out the initialization properties
 		Map<String, Object> p = new HashMap<String, Object>();
@@ -264,10 +265,10 @@ public class DatePicker extends Abstract
 		}
 
 		if (enableMonthYearSelection() && p.containsKey("pages") &&
-				Objects.longValue(p.get("pages")) > 1)
+			Objects.longValue(p.get("pages")) > 1)
 		{
 			throw new IllegalStateException(
-					"You cannot use a CalendarGroup with month/year selection!");
+				"You cannot use a CalendarGroup with month/year selection!");
 		}
 
 		// ${calendarInit}
@@ -333,11 +334,11 @@ public class DatePicker extends Abstract
 		{
 			final String escapedComponentMarkupId = getEscapedComponentMarkupId();
 			final String javascript = "var e = Wicket.$('" + escapedComponentMarkupId + "Dp" +
-					"'); if (e != null && typeof(e.parentNode) != 'undefined' && " +
-					"typeof(e.parentNode.parentNode != 'undefined')) " +
-					"e.parentNode.parentNode.removeChild(e.parentNode);" + "YAHOO.wicket." +
-					escapedComponentMarkupId + "DpJs.destroy(); delete YAHOO.wicket." +
-					escapedComponentMarkupId + "DpJs;";
+				"'); if (e != null && typeof(e.parentNode) != 'undefined' && " +
+				"typeof(e.parentNode.parentNode != 'undefined')) " +
+				"e.parentNode.parentNode.removeChild(e.parentNode);" + "YAHOO.wicket." +
+				escapedComponentMarkupId + "DpJs.destroy(); delete YAHOO.wicket." +
+				escapedComponentMarkupId + "DpJs;";
 
 			response.renderJavascript(javascript, null);
 		}
@@ -483,8 +484,7 @@ public class DatePicker extends Abstract
 			{
 				converter = component.getConverter(Date.class);
 			}
-			format = ((SimpleDateFormat)((DateConverter)converter).getDateFormat(component
-					.getLocale())).toPattern();
+			format = ((SimpleDateFormat)((DateConverter)converter).getDateFormat(component.getLocale())).toPattern();
 		}
 
 		return format;
@@ -549,8 +549,8 @@ public class DatePicker extends Abstract
 	protected CharSequence getIconUrl()
 	{
 		return RequestCycle.get().urlFor(
-				new ResourceReferenceRequestHandler(new PackageResourceReference(DatePicker.class,
-						"icon1.gif")));
+			new ResourceReferenceRequestHandler(new PackageResourceReference(DatePicker.class,
+				"icon1.gif")));
 	}
 
 	/**
@@ -593,7 +593,7 @@ public class DatePicker extends Abstract
 			try
 			{
 				dfSymbols = (DateFormatSymbols)GETINSTANCEMETHOD.invoke(null,
-						new Object[] { getLocale() });
+					new Object[] { getLocale() });
 			}
 			catch (Exception e)
 			{
@@ -608,26 +608,26 @@ public class DatePicker extends Abstract
 		setWidgetProperty(widgetProperties, "MONTHS_SHORT", filterEmpty(dfSymbols.getShortMonths()));
 		setWidgetProperty(widgetProperties, "MONTHS_LONG", filterEmpty(dfSymbols.getMonths()));
 		setWidgetProperty(widgetProperties, "WEEKDAYS_MEDIUM",
-				filterEmpty(dfSymbols.getShortWeekdays()));
+			filterEmpty(dfSymbols.getShortWeekdays()));
 		setWidgetProperty(widgetProperties, "WEEKDAYS_LONG", filterEmpty(dfSymbols.getWeekdays()));
 
 		widgetProperties.put("START_WEEKDAY", new Integer(Calendar.getInstance(getLocale())
-				.getFirstDayOfWeek() - 1));
+			.getFirstDayOfWeek() - 1));
 
 		if (Locale.SIMPLIFIED_CHINESE.equals(getLocale()) ||
-				Locale.TRADITIONAL_CHINESE.equals(getLocale()))
+			Locale.TRADITIONAL_CHINESE.equals(getLocale()))
 		{
 			setWidgetProperty(widgetProperties, "WEEKDAYS_1CHAR",
-					filterEmpty(substring(dfSymbols.getShortWeekdays(), 2, 1)));
+				filterEmpty(substring(dfSymbols.getShortWeekdays(), 2, 1)));
 			widgetProperties.put("WEEKDAYS_SHORT",
-					filterEmpty(substring(dfSymbols.getShortWeekdays(), 2, 1)));
+				filterEmpty(substring(dfSymbols.getShortWeekdays(), 2, 1)));
 		}
 		else
 		{
 			setWidgetProperty(widgetProperties, "WEEKDAYS_1CHAR",
-					filterEmpty(substring(dfSymbols.getShortWeekdays(), 0, 1)));
+				filterEmpty(substring(dfSymbols.getShortWeekdays(), 0, 1)));
 			setWidgetProperty(widgetProperties, "WEEKDAYS_SHORT",
-					filterEmpty(substring(dfSymbols.getShortWeekdays(), 0, 2)));
+				filterEmpty(substring(dfSymbols.getShortWeekdays(), 0, 2)));
 		}
 	}
 
@@ -791,7 +791,7 @@ public class DatePicker extends Abstract
 	 * @param map
 	 * @param calendarInit
 	 */
-	private void appendMapping(Map<String, ? > map, StringBuffer calendarInit)
+	private void appendMapping(Map<String, ?> map, StringBuffer calendarInit)
 	{
 		boolean first = true;
 		calendarInit.append("{");
@@ -810,7 +810,7 @@ public class DatePicker extends Abstract
 			if (map.get(key) instanceof Map)
 			{
 				@SuppressWarnings("unchecked")
-				Map<String, ? > value = (Map<String, ? >)map.get(key);
+				Map<String, ?> value = (Map<String, ?>)map.get(key);
 				appendMapping(value, calendarInit);
 			}
 			else

Modified: wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/RequestMapperApplication.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/RequestMapperApplication.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/RequestMapperApplication.java (original)
+++ wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/RequestMapperApplication.java Sat Nov 20 18:53:29 2010
@@ -16,8 +16,8 @@
  */
 package org.apache.wicket.examples.requestmapper;
 
-import org.apache.wicket.Application;
 import org.apache.wicket.Page;
+import org.apache.wicket.RuntimeConfigurationType;
 import org.apache.wicket.examples.WicketExampleApplication;
 import org.apache.wicket.examples.requestmapper.packageMount.PackageMountedPage;
 import org.apache.wicket.protocol.https.HttpsConfig;
@@ -69,10 +69,8 @@ public class RequestMapperApplication ex
 	 * @see org.apache.wicket.protocol.http.WebApplication#getConfigurationType()
 	 */
 	@Override
-	public String getConfigurationType()
+	public RuntimeConfigurationType getConfigurationType()
 	{
-		return Application.DEVELOPMENT;
+		return RuntimeConfigurationType.DEVELOPMENT;
 	}
-
-
 }

Modified: wicket/trunk/wicket-guice/src/main/java/org/apache/wicket/guice/GuiceComponentInjector.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-guice/src/main/java/org/apache/wicket/guice/GuiceComponentInjector.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket-guice/src/main/java/org/apache/wicket/guice/GuiceComponentInjector.java (original)
+++ wicket/trunk/wicket-guice/src/main/java/org/apache/wicket/guice/GuiceComponentInjector.java Sat Nov 20 18:53:29 2010
@@ -43,8 +43,8 @@ import com.google.inject.Stage;
  * @author Alastair Maw
  */
 public class GuiceComponentInjector extends org.apache.wicket.injection.Injector
-		implements
-			IComponentInstantiationListener
+	implements
+		IComponentInstantiationListener
 {
 	private final IFieldValueFactory fieldValueFactory;
 
@@ -72,9 +72,8 @@ public class GuiceComponentInjector exte
 	 */
 	public GuiceComponentInjector(Application app, Module... modules)
 	{
-		this(app, Guice.createInjector(app.getConfigurationType().equals(Application.DEVELOPMENT)
-				? Stage.DEVELOPMENT
-				: Stage.PRODUCTION, modules), true);
+		this(app, Guice.createInjector(app.usesDeploymentConfig() ? Stage.PRODUCTION
+			: Stage.DEVELOPMENT, modules), true);
 	}
 
 	/**

Modified: wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/Application.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/Application.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/Application.java (original)
+++ wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/Application.java Sat Nov 20 18:53:29 2010
@@ -18,6 +18,8 @@ package org.apache.wicket.jmx;
 
 import java.io.IOException;
 
+import org.apache.wicket.RuntimeConfigurationType;
+
 
 /**
  * Exposes Application related functionality for JMX.
@@ -57,7 +59,7 @@ public class Application implements Appl
 	/**
 	 * @see org.apache.wicket.jmx.ApplicationMBean#getConfigurationType()
 	 */
-	public String getConfigurationType()
+	public RuntimeConfigurationType getConfigurationType()
 	{
 		return application.getConfigurationType();
 	}

Modified: wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationMBean.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationMBean.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationMBean.java (original)
+++ wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/ApplicationMBean.java Sat Nov 20 18:53:29 2010
@@ -19,6 +19,7 @@ package org.apache.wicket.jmx;
 import java.io.IOException;
 
 import org.apache.wicket.Application;
+import org.apache.wicket.RuntimeConfigurationType;
 
 
 /**
@@ -50,7 +51,7 @@ public interface ApplicationMBean
 	 * 
 	 * @return The configuration type
 	 */
-	String getConfigurationType();
+	RuntimeConfigurationType getConfigurationType();
 
 	/**
 	 * Gets the configured home page for this application.

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java Sat Nov 20 18:53:29 2010
@@ -151,12 +151,6 @@ public abstract class Application implem
 	/** Configuration constant for the 2 types */
 	public static final String CONFIGURATION = "configuration";
 
-	/** Configuration type constant for deployment */
-	public static final String DEPLOYMENT = "deployment";
-
-	/** Configuration type constant for development */
-	public static final String DEVELOPMENT = "development";
-
 	/**
 	 * Applications keyed on the {@link #getApplicationKey()} so that they can be retrieved even
 	 * without being in a request/ being set in the thread local (we need that e.g. for when we are
@@ -291,38 +285,34 @@ public abstract class Application implem
 	 */
 	public final void configure()
 	{
-		final String configurationType = getConfigurationType();
-
 		// As long as this is public api the development and deployment mode
 		// should counter act each other for all properties.
-		if (DEVELOPMENT.equalsIgnoreCase(configurationType))
-		{
-			getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);
-			getDebugSettings().setComponentUseCheck(true);
-			getMarkupSettings().setStripWicketTags(false);
-			getExceptionSettings().setUnexpectedExceptionDisplay(
-				IExceptionSettings.SHOW_EXCEPTION_PAGE);
-			getDebugSettings().setAjaxDebugModeEnabled(true);
-			getDebugSettings().setDevelopmentUtilitiesEnabled(true);
-			// getDebugSettings().setOutputMarkupContainerClassName(true);
-			getResourceSettings().setJavascriptCompressor(null);
-			getRequestCycleSettings().addResponseFilter(EmptySrcAttributeCheckFilter.INSTANCE);
-		}
-		else if (DEPLOYMENT.equalsIgnoreCase(configurationType))
-		{
-			getResourceSettings().setResourcePollFrequency(null);
-			getDebugSettings().setComponentUseCheck(false);
-			getMarkupSettings().setStripWicketTags(true);
-			getExceptionSettings().setUnexpectedExceptionDisplay(
-				IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
-			getDebugSettings().setAjaxDebugModeEnabled(false);
-			getDebugSettings().setDevelopmentUtilitiesEnabled(false);
-			getResourceSettings().setJavascriptCompressor(new DefaultJavascriptCompressor());
-		}
-		else
+		switch (getConfigurationType())
 		{
-			throw new IllegalArgumentException("Invalid configuration type: '" + configurationType +
-				"'.  Must be \"development\" or \"deployment\".");
+			case DEVELOPMENT : {
+				getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);
+				getDebugSettings().setComponentUseCheck(true);
+				getMarkupSettings().setStripWicketTags(false);
+				getExceptionSettings().setUnexpectedExceptionDisplay(
+					IExceptionSettings.SHOW_EXCEPTION_PAGE);
+				getDebugSettings().setAjaxDebugModeEnabled(true);
+				getDebugSettings().setDevelopmentUtilitiesEnabled(true);
+				// getDebugSettings().setOutputMarkupContainerClassName(true);
+				getResourceSettings().setJavascriptCompressor(null);
+				getRequestCycleSettings().addResponseFilter(EmptySrcAttributeCheckFilter.INSTANCE);
+				break;
+			}
+			case DEPLOYMENT : {
+				getResourceSettings().setResourcePollFrequency(null);
+				getDebugSettings().setComponentUseCheck(false);
+				getMarkupSettings().setStripWicketTags(true);
+				getExceptionSettings().setUnexpectedExceptionDisplay(
+					IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
+				getDebugSettings().setAjaxDebugModeEnabled(false);
+				getDebugSettings().setDevelopmentUtilitiesEnabled(false);
+				getResourceSettings().setJavascriptCompressor(new DefaultJavascriptCompressor());
+				break;
+			}
 		}
 	}
 
@@ -386,7 +376,7 @@ public abstract class Application implem
 	 * @since 1.2.3 (function existed as a property getter)
 	 * @since 1.3.0 (abstract, used to configure things)
 	 */
-	public abstract String getConfigurationType();
+	public abstract RuntimeConfigurationType getConfigurationType();
 
 	/**
 	 * Application subclasses must specify a home page class by implementing this abstract method.
@@ -1538,4 +1528,22 @@ public abstract class Application implem
 		}
 		return headerResponseDecorator.decorate(response);
 	}
+
+	/**
+	 * 
+	 * @return true, of app is in Development mode
+	 */
+	public final boolean usesDevelopmentConfig()
+	{
+		return RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType());
+	}
+
+	/**
+	 * 
+	 * @return true, of app is in Deployment mode
+	 */
+	public final boolean usesDeploymentConfig()
+	{
+		return RuntimeConfigurationType.DEPLOYMENT.equals(getConfigurationType());
+	}
 }

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java Sat Nov 20 18:53:29 2010
@@ -1554,10 +1554,10 @@ public abstract class Component
 		}
 
 		String markupIdPrefix = "id";
-		if (!Application.get().getConfigurationType().equals(Application.DEPLOYMENT))
+		if (!getApplication().usesDeploymentConfig())
 		{
-			// in non-deployment mode we make the markup id include component id so it is easier to
-			// debug
+			// in non-deployment mode we make the markup id include component id
+			// so it is easier to debug
 			markupIdPrefix = getId();
 		}
 

Added: wicket/trunk/wicket/src/main/java/org/apache/wicket/RuntimeConfigurationType.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/RuntimeConfigurationType.java?rev=1037297&view=auto
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/RuntimeConfigurationType.java (added)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/RuntimeConfigurationType.java Sat Nov 20 18:53:29 2010
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket;
+
+/**
+ * 
+ * @author Juergen Donnerstag
+ */
+public enum RuntimeConfigurationType {
+	/** */
+	DEVELOPMENT,
+
+	/** */
+	DEPLOYMENT
+}

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java Sat Nov 20 18:53:29 2010
@@ -16,7 +16,6 @@
  */
 package org.apache.wicket.markup.html;
 
-import org.apache.wicket.Application;
 import org.apache.wicket.Component;
 import org.apache.wicket.Page;
 import org.apache.wicket.markup.MarkupType;
@@ -175,7 +174,7 @@ public class WebPage extends Page
 		super.onAfterRender();
 
 		// only in development mode validate the headers
-		if (Application.DEVELOPMENT.equals(getApplication().getConfigurationType()))
+		if (getApplication().usesDevelopmentConfig())
 		{
 			// Ignore if an exception and a redirect happened in between (e.g.
 			// RestartResponseAtInterceptPageException)

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractRepeater.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractRepeater.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractRepeater.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/repeater/AbstractRepeater.java Sat Nov 20 18:53:29 2010
@@ -119,7 +119,7 @@ public abstract class AbstractRepeater e
 	{
 		onPopulate();
 
-		if (Application.get().getConfigurationType().equals(Application.DEVELOPMENT))
+		if (getApplication().usesDevelopmentConfig())
 		{
 			Iterator<? extends Component> i = iterator();
 			while (i.hasNext())

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/mock/MockApplication.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/mock/MockApplication.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/mock/MockApplication.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/mock/MockApplication.java Sat Nov 20 18:53:29 2010
@@ -18,6 +18,7 @@ package org.apache.wicket.mock;
 
 import org.apache.wicket.IPageManagerProvider;
 import org.apache.wicket.Page;
+import org.apache.wicket.RuntimeConfigurationType;
 import org.apache.wicket.Session;
 import org.apache.wicket.page.IPageManager;
 import org.apache.wicket.page.IPageManagerContext;
@@ -27,7 +28,6 @@ import org.apache.wicket.util.IProvider;
 
 public class MockApplication extends WebApplication
 {
-
 	public MockApplication()
 	{
 	}
@@ -39,12 +39,11 @@ public class MockApplication extends Web
 	}
 
 	@Override
-	public String getConfigurationType()
+	public RuntimeConfigurationType getConfigurationType()
 	{
-		return DEVELOPMENT;
+		return RuntimeConfigurationType.DEVELOPMENT;
 	}
 
-
 	public Session getSession()
 	{
 		return getSessionStore().lookup(null);
@@ -67,22 +66,17 @@ public class MockApplication extends Web
 
 	private static class MockSessionStoreProvider implements IProvider<ISessionStore>
 	{
-
 		public ISessionStore get()
 		{
 			return new MockSessionStore();
 		}
-
 	}
+
 	private static class MockPageManagerProvider implements IPageManagerProvider
 	{
-
 		public IPageManager get(IPageManagerContext pageManagerContext)
 		{
 			return new MockPageManager();
 		}
-
-
 	}
-
 }

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java Sat Nov 20 18:53:29 2010
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpSession;
 import org.apache.wicket.Application;
 import org.apache.wicket.IPageRendererProvider;
 import org.apache.wicket.Page;
+import org.apache.wicket.RuntimeConfigurationType;
 import org.apache.wicket.Session;
 import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -489,7 +490,7 @@ public abstract class WebApplication ext
 	 * {@inheritDoc}
 	 */
 	@Override
-	public String getConfigurationType()
+	public RuntimeConfigurationType getConfigurationType()
 	{
 		String result = null;
 		try
@@ -528,10 +529,21 @@ public abstract class WebApplication ext
 		// as the default.
 		if (result != null)
 		{
-			return result;
+			try
+			{
+				return RuntimeConfigurationType.valueOf(result.toUpperCase());
+			}
+			catch (IllegalArgumentException e)
+			{
+				// Ignore : fall back to DEVELOPMENT mode
+				// log.warn("Unknown runtime configuration type '" + result +
+				// "', falling back to DEVELOPMENT mode.");
+				throw new IllegalArgumentException("Invalid configuration type: '" + result +
+					"'.  Must be \"development\" or \"deployment\".");
+			}
 		}
 
-		return Application.DEVELOPMENT;
+		return RuntimeConfigurationType.DEVELOPMENT;
 	}
 
 	/**
@@ -590,16 +602,20 @@ public abstract class WebApplication ext
 	 */
 	final void logStarted()
 	{
-		String version = getFrameworkSettings().getVersion();
-		StringBuffer b = new StringBuffer();
-		b.append("[").append(getName()).append("] Started Wicket ");
-		if (!"n/a".equals(version))
-		{
-			b.append("version ").append(version).append(" ");
-		}
-		b.append("in ").append(getConfigurationType()).append(" mode");
-		log.info(b.toString());
-		if (DEVELOPMENT.equalsIgnoreCase(getConfigurationType()))
+		if (log.isInfoEnabled())
+		{
+			String version = getFrameworkSettings().getVersion();
+			StringBuilder b = new StringBuilder();
+			b.append("[").append(getName()).append("] Started Wicket ");
+			if (!"n/a".equals(version))
+			{
+				b.append("version ").append(version).append(" ");
+			}
+			b.append("in ").append(getConfigurationType()).append(" mode");
+			log.info(b.toString());
+		}
+
+		if (usesDevelopmentConfig())
 		{
 			outputDevelopmentModeWarning();
 		}
@@ -625,12 +641,24 @@ public abstract class WebApplication ext
 	// TODO: Do this properly
 	private final Map<String, BufferedWebResponse> storedResponses = new ConcurrentHashMap<String, BufferedWebResponse>();
 
+	/**
+	 * 
+	 * @param sessionId
+	 * @param url
+	 * @return true if has buffered response
+	 */
 	public boolean hasBufferedResponse(String sessionId, Url url)
 	{
 		String key = sessionId + url.toString();
 		return storedResponses.containsKey(key);
 	}
 
+	/**
+	 * 
+	 * @param sessionId
+	 * @param url
+	 * @return buffered response
+	 */
 	public BufferedWebResponse getAndRemoveBufferedResponse(String sessionId, Url url)
 	{
 		String key = sessionId + url.toString();

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java?rev=1037297&r1=1037296&r2=1037297&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java Sat Nov 20 18:53:29 2010
@@ -121,7 +121,7 @@ public class WebSession extends Session
 
 			// see if any component related feedback messages were left unrendered and warn if in
 			// dev mode
-			if (Application.DEVELOPMENT.equals(getApplication().getConfigurationType()))
+			if (getApplication().usesDevelopmentConfig())
 			{
 				List<FeedbackMessage> messages = getFeedbackMessages().messages(
 					WebSession.MESSAGES_FOR_COMPONENTS);