You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/11/13 09:06:41 UTC
[1/4] git commit: WICKET-5410 Remove setting interfaces
Updated Branches:
refs/heads/master 1d79e37ae -> b2d13b276
WICKET-5410 Remove setting interfaces
Remove IResourceSettings interface
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/b2d13b27
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/b2d13b27
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/b2d13b27
Branch: refs/heads/master
Commit: b2d13b27676e332dede4004fdcff7df313f2e9de
Parents: a5b34d7
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Nov 12 18:10:47 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Nov 13 09:50:41 2013 +0200
----------------------------------------------------------------------
.../java/org/apache/wicket/Application.java | 7 +-
.../main/java/org/apache/wicket/Localizer.java | 8 +-
.../resource/locator/ResourceStreamLocator.java | 3 +-
.../markup/html/SecurePackageResourceGuard.java | 3 +-
.../wicket/markup/html/link/DownloadLink.java | 4 +-
.../resource/ResourceStreamRequestHandler.java | 4 +-
.../request/resource/AbstractResource.java | 5 +-
.../request/resource/CssResourceReference.java | 4 +-
.../resource/JavaScriptResourceReference.java | 4 +-
.../request/resource/PackageResource.java | 3 +-
.../wicket/resource/PropertiesFactory.java | 8 +-
.../wicket/settings/IResourceSettings.java | 401 -------------------
.../wicket/settings/def/ResourceSettings.java | 314 +++++++++++----
.../apache/wicket/ApplicationSettingsTest.java | 16 +-
.../java/org/apache/wicket/LocalizerTest.java | 4 +-
.../wicket/jmx/ResourceSettingsMBean.java | 10 +-
16 files changed, 267 insertions(+), 531 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/Application.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Application.java b/wicket-core/src/main/java/org/apache/wicket/Application.java
index 0690637..90d445c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Application.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Application.java
@@ -85,7 +85,6 @@ import org.apache.wicket.session.DefaultPageFactory;
import org.apache.wicket.session.ISessionStore;
import org.apache.wicket.session.ISessionStore.UnboundListener;
import org.apache.wicket.settings.IMarkupSettings;
-import org.apache.wicket.settings.IResourceSettings;
import org.apache.wicket.settings.def.ApplicationSettings;
import org.apache.wicket.settings.def.DebugSettings;
import org.apache.wicket.settings.def.ExceptionSettings;
@@ -1039,7 +1038,7 @@ public abstract class Application implements UnboundListener, IEventSink
private RequestLoggerSettings requestLoggerSettings;
/** The Resource Settings */
- private IResourceSettings resourceSettings;
+ private ResourceSettings resourceSettings;
/** The Security Settings */
private SecuritySettings securitySettings;
@@ -1254,7 +1253,7 @@ public abstract class Application implements UnboundListener, IEventSink
/**
* @return Application's resources related settings
*/
- public final IResourceSettings getResourceSettings()
+ public final ResourceSettings getResourceSettings()
{
checkSettingsAvailable();
if (resourceSettings == null)
@@ -1268,7 +1267,7 @@ public abstract class Application implements UnboundListener, IEventSink
*
* @param resourceSettings
*/
- public final void setResourceSettings(final IResourceSettings resourceSettings)
+ public final void setResourceSettings(final ResourceSettings resourceSettings)
{
this.resourceSettings = resourceSettings;
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/Localizer.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Localizer.java b/wicket-core/src/main/java/org/apache/wicket/Localizer.java
index f2bd2d8..00ccc3b 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Localizer.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Localizer.java
@@ -29,7 +29,7 @@ import org.apache.wicket.core.util.string.interpolator.ConvertingPropertyVariabl
import org.apache.wicket.markup.repeater.AbstractRepeater;
import org.apache.wicket.model.IModel;
import org.apache.wicket.resource.loader.IStringResourceLoader;
-import org.apache.wicket.settings.IResourceSettings;
+import org.apache.wicket.settings.def.ResourceSettings;
import org.apache.wicket.util.lang.Generics;
import org.apache.wicket.util.string.AppendingStringBuffer;
import org.slf4j.Logger;
@@ -45,9 +45,9 @@ import org.slf4j.LoggerFactory;
* strategy for the properties. E.g. string resource loaders which load the properties from a
* database. There should be hardly any need to extend Localizer.
*
- * @see org.apache.wicket.settings.IResourceSettings#getLocalizer()
+ * @see org.apache.wicket.settings.def.ResourceSettings#getLocalizer()
* @see org.apache.wicket.resource.loader.IStringResourceLoader
- * @see org.apache.wicket.settings.IResourceSettings#getStringResourceLoaders()
+ * @see org.apache.wicket.settings.def.ResourceSettings#getStringResourceLoaders()
*
* @author Chris Turner
* @author Juergen Donnerstag
@@ -196,7 +196,7 @@ public class Localizer
final Locale locale, final String style, final String defaultValue)
throws MissingResourceException
{
- final IResourceSettings resourceSettings = Application.get().getResourceSettings();
+ final ResourceSettings resourceSettings = Application.get().getResourceSettings();
String value = getStringIgnoreSettings(key, component, model, locale, style, null);
if ((value == null) && (defaultValue != null))
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/ResourceStreamLocator.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/ResourceStreamLocator.java b/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/ResourceStreamLocator.java
index 3641974..5cc313f 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/ResourceStreamLocator.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/ResourceStreamLocator.java
@@ -24,7 +24,6 @@ import java.util.Locale;
import org.apache.wicket.Application;
import org.apache.wicket.core.util.file.WebApplicationPath;
-import org.apache.wicket.settings.IResourceSettings;
import org.apache.wicket.util.file.IResourceFinder;
import org.apache.wicket.util.file.Path;
import org.apache.wicket.util.resource.IResourceStream;
@@ -61,7 +60,7 @@ import org.slf4j.LoggerFactory;
* Resources will be actually loaded by the {@link IResourceFinder}s defined in the resource
* settings. By default there are finders that look in the classpath and in the classpath in
* META-INF/resources. You can add more by adding {@link WebApplicationPath}s or {@link Path}s to
- * {@link IResourceSettings#getResourceFinders()}.
+ * {@link org.apache.wicket.settings.def.ResourceSettings#getResourceFinders()}.
*
* @author Juergen Donnerstag
* @author Jonathan Locke
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/markup/html/SecurePackageResourceGuard.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/SecurePackageResourceGuard.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/SecurePackageResourceGuard.java
index b7333d7..19eec46 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/SecurePackageResourceGuard.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/SecurePackageResourceGuard.java
@@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ConcurrentMap;
import java.util.regex.Pattern;
-import org.apache.wicket.settings.IResourceSettings;
import org.apache.wicket.util.collections.ReverseListIterator;
import org.apache.wicket.util.string.Strings;
import org.slf4j.Logger;
@@ -65,7 +64,7 @@ import org.slf4j.LoggerFactory;
* </table>
*
* @see IPackageResourceGuard
- * @see IResourceSettings#getPackageResourceGuard
+ * @see org.apache.wicket.settings.def.ResourceSettings#getPackageResourceGuard
* @see PackageResourceGuard
*
* @author Juergen Donnerstag
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DownloadLink.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DownloadLink.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DownloadLink.java
index 593c2a0..aaff9cc 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DownloadLink.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DownloadLink.java
@@ -23,7 +23,6 @@ import org.apache.wicket.model.Model;
import org.apache.wicket.request.IRequestCycle;
import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler;
import org.apache.wicket.request.resource.ContentDisposition;
-import org.apache.wicket.settings.IResourceSettings;
import org.apache.wicket.util.file.Files;
import org.apache.wicket.util.lang.Args;
import org.apache.wicket.util.resource.FileResourceStream;
@@ -60,7 +59,8 @@ public class DownloadLink extends Link<File>
/**
* The duration for which the file resource should be cached by the browser.
* <p>
- * By default is {@code null} and {@link IResourceSettings#getDefaultCacheDuration()} is used.
+ * By default is {@code null} and
+ * {@link org.apache.wicket.settings.def.ResourceSettings#getDefaultCacheDuration()} is used.
* </p>
*/
private Duration cacheDuration;
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceStreamRequestHandler.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceStreamRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceStreamRequestHandler.java
index e710c19..b7098c3 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceStreamRequestHandler.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceStreamRequestHandler.java
@@ -23,7 +23,6 @@ import org.apache.wicket.request.IRequestHandler;
import org.apache.wicket.request.resource.ContentDisposition;
import org.apache.wicket.request.resource.IResource.Attributes;
import org.apache.wicket.request.resource.ResourceStreamResource;
-import org.apache.wicket.settings.IResourceSettings;
import org.apache.wicket.util.lang.Args;
import org.apache.wicket.util.resource.IResourceStream;
import org.apache.wicket.util.string.Strings;
@@ -51,7 +50,8 @@ public class ResourceStreamRequestHandler implements IRequestHandler, ILoggableR
/**
* The duration fow which the resource will be cached by the browser.
* <p>
- * By default is {@code null} and {@link IResourceSettings#getDefaultCacheDuration()} is used.
+ * By default is {@code null} and
+ * {@link org.apache.wicket.settings.def.ResourceSettings#getDefaultCacheDuration()} is used.
* </p>
*/
private Duration cacheDuration;
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
index 56aa348..bc071bf 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
@@ -31,7 +31,6 @@ import org.apache.wicket.request.http.WebRequest;
import org.apache.wicket.request.http.WebResponse;
import org.apache.wicket.request.resource.caching.IResourceCachingStrategy;
import org.apache.wicket.request.resource.caching.IStaticCacheableResource;
-import org.apache.wicket.settings.IResourceSettings;
import org.apache.wicket.util.io.Streams;
import org.apache.wicket.util.lang.Args;
import org.apache.wicket.util.lang.Classes;
@@ -407,8 +406,8 @@ public abstract class AbstractResource implements IResource
*
* @return duration for caching
*
- * @see IResourceSettings#setDefaultCacheDuration(org.apache.wicket.util.time.Duration)
- * @see IResourceSettings#getDefaultCacheDuration()
+ * @see org.apache.wicket.settings.def.ResourceSettings#setDefaultCacheDuration(org.apache.wicket.util.time.Duration)
+ * @see org.apache.wicket.settings.def.ResourceSettings#getDefaultCacheDuration()
*/
public Duration getCacheDuration()
{
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/request/resource/CssResourceReference.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/CssResourceReference.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/CssResourceReference.java
index 5dbf4f5..f0d0884 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/resource/CssResourceReference.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/CssResourceReference.java
@@ -18,13 +18,11 @@ package org.apache.wicket.request.resource;
import java.util.Locale;
-import org.apache.wicket.settings.IResourceSettings;
-
/**
* Static resource reference for css resources. The resources are filtered (stripped comments and
* whitespace) if there is registered compressor.
*
- * @see IResourceSettings#getCssCompressor()
+ * @see org.apache.wicket.settings.def.ResourceSettings#getCssCompressor()
*/
public class CssResourceReference extends PackageResourceReference
{
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/request/resource/JavaScriptResourceReference.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/JavaScriptResourceReference.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/JavaScriptResourceReference.java
index 212f55a..f4a681f 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/resource/JavaScriptResourceReference.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/JavaScriptResourceReference.java
@@ -18,13 +18,11 @@ package org.apache.wicket.request.resource;
import java.util.Locale;
-import org.apache.wicket.settings.IResourceSettings;
-
/**
* Static resource reference for javascript resources. The resources are filtered (stripped comments
* and whitespace) if there is a registered compressor.
*
- * @see IResourceSettings#getJavaScriptCompressor()
+ * @see org.apache.wicket.settings.def.ResourceSettings#getJavaScriptCompressor()
* @author Matej
*/
public class JavaScriptResourceReference extends PackageResourceReference
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
index 4e4b1f3..c502829 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
@@ -29,7 +29,6 @@ import org.apache.wicket.core.util.lang.WicketObjects;
import org.apache.wicket.core.util.resource.locator.IResourceStreamLocator;
import org.apache.wicket.markup.html.IPackageResourceGuard;
import org.apache.wicket.request.resource.caching.IStaticCacheableResource;
-import org.apache.wicket.settings.IResourceSettings;
import org.apache.wicket.util.io.IOUtils;
import org.apache.wicket.util.lang.Classes;
import org.apache.wicket.util.lang.Packages;
@@ -55,7 +54,7 @@ import org.slf4j.LoggerFactory;
* </p>
*
* Access to resources can be granted or denied via a {@link IPackageResourceGuard}. Please see
- * {@link IResourceSettings#getPackageResourceGuard()} as well.
+ * {@link org.apache.wicket.settings.def.ResourceSettings#getPackageResourceGuard()} as well.
*
* @author Jonathan Locke
* @author Eelco Hillenius
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/resource/PropertiesFactory.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/PropertiesFactory.java b/wicket-core/src/main/java/org/apache/wicket/resource/PropertiesFactory.java
index 54d9c73..eb56adb 100644
--- a/wicket-core/src/main/java/org/apache/wicket/resource/PropertiesFactory.java
+++ b/wicket-core/src/main/java/org/apache/wicket/resource/PropertiesFactory.java
@@ -25,12 +25,11 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.wicket.settings.IResourceSettings;
+import org.apache.wicket.core.util.resource.locator.IResourceStreamLocator;
import org.apache.wicket.util.io.IOUtils;
import org.apache.wicket.util.listener.IChangeListener;
import org.apache.wicket.util.resource.IResourceStream;
import org.apache.wicket.util.resource.ResourceStreamNotFoundException;
-import org.apache.wicket.core.util.resource.locator.IResourceStreamLocator;
import org.apache.wicket.util.value.ValueMap;
import org.apache.wicket.util.watch.IModificationWatcher;
import org.apache.wicket.util.watch.ModificationWatcher;
@@ -40,11 +39,12 @@ import org.slf4j.LoggerFactory;
/**
* Default implementation of {@link IPropertiesFactory} which uses the
- * {@link IResourceStreamLocator} as defined by {@link IResourceSettings#getResourceStreamLocator()}
+ * {@link IResourceStreamLocator} as defined by
+ * {@link org.apache.wicket.settings.def.ResourceSettings#getResourceStreamLocator()}
* to load the {@link Properties} objects. Depending on the settings, it will assign
* {@link ModificationWatcher}s to the loaded resources to support reloading.
*
- * @see org.apache.wicket.settings.IResourceSettings#getPropertiesFactory()
+ * @see org.apache.wicket.settings.def.ResourceSettings#getPropertiesFactory()
*
* @author Juergen Donnerstag
*/
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/settings/IResourceSettings.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/IResourceSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/IResourceSettings.java
deleted file mode 100644
index 066dee1..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/settings/IResourceSettings.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * 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.settings;
-
-import java.util.Comparator;
-import java.util.List;
-
-import org.apache.wicket.IResourceFactory;
-import org.apache.wicket.Localizer;
-import org.apache.wicket.core.util.resource.locator.IResourceStreamLocator;
-import org.apache.wicket.css.ICssCompressor;
-import org.apache.wicket.javascript.IJavaScriptCompressor;
-import org.apache.wicket.markup.head.PriorityFirstComparator;
-import org.apache.wicket.markup.head.ResourceAggregator;
-import org.apache.wicket.markup.head.ResourceAggregator.RecordedHeaderItem;
-import org.apache.wicket.markup.html.IPackageResourceGuard;
-import org.apache.wicket.markup.html.PackageResourceGuard;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.request.resource.caching.IResourceCachingStrategy;
-import org.apache.wicket.resource.IPropertiesFactory;
-import org.apache.wicket.resource.IPropertiesFactoryContext;
-import org.apache.wicket.resource.loader.IStringResourceLoader;
-import org.apache.wicket.util.file.IFileCleaner;
-import org.apache.wicket.util.file.IResourceFinder;
-import org.apache.wicket.util.time.Duration;
-import org.apache.wicket.util.watch.IModificationWatcher;
-
-
-/**
- * Interface for resource related settings
- * <p>
- * <i>resourcePollFrequency </i> (defaults to no polling frequency) - Frequency at which resources
- * should be polled for changes.
- * <p>
- * <i>resourceFinders</i> - Add/modify this to alter the search path for resources.
- * <p>
- * <i>useDefaultOnMissingResource </i> (defaults to true) - Set to true to return a default value if
- * available when a required string resource is not found. If set to false then the
- * throwExceptionOnMissingResource flag is used to determine how to behave. If no default is
- * available then this is the same as if this flag were false
- * <p>
- * <i>A ResourceStreamLocator </i>- An Application's ResourceStreamLocator is used to find resources
- * such as images or markup files. You can supply your own ResourceStreamLocator if your prefer to
- * store your application's resources in a non-standard location (such as a different filesystem
- * location, a particular JAR file or even a database) by overriding the getResourceLocator()
- * method.
- * <p>
- * <i>Resource Factories </i>- Resource factories can be used to create resources dynamically from
- * specially formatted HTML tag attribute values. For more details, see {@link IResourceFactory},
- * {@link org.apache.wicket.markup.html.image.resource.DefaultButtonImageResourceFactory} and
- * especially {@link org.apache.wicket.markup.html.image.resource.LocalizedImageResource}.
- * <p>
- * <i>A Localizer </i> The getLocalizer() method returns an object encapsulating all of the
- * functionality required to access localized resources. For many localization problems, even this
- * will not be required, as there are convenience methods available to all components:
- * {@link org.apache.wicket.Component#getString(String key)} and
- * {@link org.apache.wicket.Component#getString(String key, IModel model)}.
- * <p>
- * <i>stringResourceLoaders </i>- A chain of <code>IStringResourceLoader</code> instances that are
- * searched in order to obtain string resources used during localization. By default the chain is
- * set up to first search for resources against a particular component (e.g. page etc.) and then
- * against the application.
- * </p>
- *
- * @author Igor Vaynberg (ivaynberg)
- */
-public interface IResourceSettings extends IPropertiesFactoryContext
-{
- /**
- * Adds a resource factory to the list of factories to consult when generating resources
- * automatically
- *
- * @param name
- * The name to give to the factory
- * @param resourceFactory
- * The resource factory to add
- */
- void addResourceFactory(final String name, final IResourceFactory resourceFactory);
-
- /**
- * Get the the default cache duration for resources.
- * <p/>
- *
- * @return cache duration (Duration.NONE will be returned if caching is disabled)
- *
- * @see org.apache.wicket.util.time.Duration#NONE
- */
- Duration getDefaultCacheDuration();
-
- /**
- * Gets the {@link PackageResourceGuard package resource guard}.
- *
- * @return The package resource guard
- */
- IPackageResourceGuard getPackageResourceGuard();
-
- /**
- * Get the property factory which will be used to load property files
- *
- * @return PropertiesFactory
- */
- IPropertiesFactory getPropertiesFactory();
-
- /**
- * @param name
- * Name of the factory to get
- * @return The IResourceFactory with the given name.
- */
- IResourceFactory getResourceFactory(final String name);
-
- /**
- * Gets the resource finders to use when searching for resources. By default, a finder that
- * looks in the classpath root is configured. {@link WebApplication} adds the classpath
- * directory META-INF/resources. To configure additional search paths or filesystem paths, add
- * to this list.
- *
- * @return Returns the resourceFinders.
- */
- List<IResourceFinder> getResourceFinders();
-
- /**
- * @return Returns the resourcePollFrequency.
- * @see IResourceSettings#setResourcePollFrequency(Duration)
- */
- Duration getResourcePollFrequency();
-
- /**
- * @return mutable list of all available string resource loaders
- */
- List<IStringResourceLoader> getStringResourceLoaders();
-
- /**
- * @return boolean
- */
- boolean getThrowExceptionOnMissingResource();
-
- /**
- * @return Whether to use a default value (if available) when a missing resource is requested
- */
- boolean getUseDefaultOnMissingResource();
-
- /**
- * Set the the default cache duration for resources.
- * <p/>
- * Based on RFC-2616 this should not exceed one year. If you set Duration.NONE caching will be
- * disabled.
- *
- * @param defaultDuration
- * default cache duration in seconds
- *
- * @see org.apache.wicket.util.time.Duration#NONE
- * @see org.apache.wicket.request.http.WebResponse#MAX_CACHE_DURATION
- */
- void setDefaultCacheDuration(Duration defaultDuration);
-
- /**
- * Sets the localizer which will be used to find property values.
- *
- * @param localizer
- * @since 1.3.0
- */
- void setLocalizer(Localizer localizer);
-
- /**
- * Sets the {@link PackageResourceGuard package resource guard}.
- *
- * @param packageResourceGuard
- * The package resource guard
- */
- void setPackageResourceGuard(IPackageResourceGuard packageResourceGuard);
-
- /**
- * Set the property factory which will be used to load property files
- *
- * @param factory
- */
- void setPropertiesFactory(IPropertiesFactory factory);
-
- /**
- * Sets the finders to use when searching for resources. By default, the resources are located
- * on the classpath. To add additional search paths, add to the list given by
- * {@link #getResourceFinders()}. Use this method if you want to completely exchange the list of
- * resource finders.
- *
- * @param resourceFinder
- * The resourceFinder to set
- */
- void setResourceFinders(final List<IResourceFinder> resourceFinder);
-
- /**
- * Sets the resource polling frequency. This is the duration of time between checks of resource
- * modification times. If a resource, such as an HTML file, has changed, it will be reloaded.
- * The default is one second in 'development' mode and 'never' in deployment mode.
- *
- * @param resourcePollFrequency
- * Frequency at which to poll resources or <code>null</code> if polling should be
- * disabled
- *
- * @see org.apache.wicket.settings.IResourceSettings#getResourceFinders()
- */
- void setResourcePollFrequency(final Duration resourcePollFrequency);
-
- /**
- * Sets the resource stream locator for this application
- *
- * @param resourceStreamLocator
- * new resource stream locator
- */
- void setResourceStreamLocator(IResourceStreamLocator resourceStreamLocator);
-
- /**
- * Sets the resource watcher
- *
- * @param watcher
- */
- void setResourceWatcher(IModificationWatcher watcher);
-
- /**
- * Sets a cleaner that can be used to remove files asynchronously.
- * <p>
- * Used internally to delete the temporary files created by FileUpload functionality
- *
- * @param fileCleaner
- * the actual cleaner implementation. Can be <code>null</code>
- */
- void setFileCleaner(IFileCleaner fileCleaner);
-
- /**
- * @return the a cleaner which can be used to remove files asynchronously.
- */
- IFileCleaner getFileCleaner();
-
- /**
- * @param throwExceptionOnMissingResource
- */
- void setThrowExceptionOnMissingResource(final boolean throwExceptionOnMissingResource);
-
- /**
- * @param useDefaultOnMissingResource
- * Whether to use a default value (if available) when a missing resource is requested
- */
- void setUseDefaultOnMissingResource(final boolean useDefaultOnMissingResource);
-
- /**
- * Set the javascript compressor implemententation use e.g. by
- * {@link org.apache.wicket.request.resource.JavaScriptPackageResource
- * JavaScriptPackageResource}. A typical implementation will remove comments and whitespace. But
- * a no-op implementation is available as well.
- *
- * @param compressor
- * The implementation to be used
- * @return The old value
- */
- IJavaScriptCompressor setJavaScriptCompressor(IJavaScriptCompressor compressor);
-
- /**
- * Get the javascript compressor to remove comments and whitespace characters from javascripts
- *
- * @return whether the comments and whitespace characters will be stripped from resources served
- * through {@link org.apache.wicket.request.resource.JavaScriptPackageResource
- * JavaScriptPackageResource}. Null is a valid value.
- */
- IJavaScriptCompressor getJavaScriptCompressor();
-
- /**
- * Placeholder string for '..' within resource urls (which will be crippled by the browser and
- * not work anymore). Note that by default the placeholder string is <code>::</code>. Resources
- * are protected by a {@link org.apache.wicket.markup.html.IPackageResourceGuard
- * IPackageResourceGuard} implementation such as
- * {@link org.apache.wicket.markup.html.PackageResourceGuard} which you may use or extend based
- * on your needs.
- *
- * @return placeholder
- */
- String getParentFolderPlaceholder();
-
- /**
- * Placeholder string for '..' within resource urls (which will be crippled by the browser and
- * not work anymore). Note that by default the placeholder string is <code>null</code> and thus
- * will not allow to access parent folders. That is by purpose and for security reasons (see
- * Wicket-1992). In case you really need it, a good value for placeholder would e.g. be "$up$".
- * Resources additionally are protected by a
- * {@link org.apache.wicket.markup.html.IPackageResourceGuard IPackageResourceGuard}
- * implementation such as {@link org.apache.wicket.markup.html.PackageResourceGuard} which you
- * may use or extend based on your needs.
- *
- * @see #getParentFolderPlaceholder()
- *
- * @param sequence
- * character sequence which must not be ambiguous within urls
- */
- void setParentFolderPlaceholder(String sequence);
-
- /**
- * gets the resource caching strategy
- *
- * @return strategy
- */
- IResourceCachingStrategy getCachingStrategy();
-
- /**
- * sets the resource caching strategy
- *
- * @param strategy
- * instance of resource caching strategy
- *
- * @see IResourceCachingStrategy
- */
- void setCachingStrategy(IResourceCachingStrategy strategy);
-
- /**
- * Set the CSS compressor implemententation use e.g. by
- * {@link org.apache.wicket.request.resource.CssPackageResource CssPackageResource}. A typical
- * implementation will remove comments and whitespace. But a no-op implementation is available
- * as well.
- *
- * @param compressor
- * The implementation to be used
- * @return The old value
- */
- ICssCompressor setCssCompressor(ICssCompressor compressor);
-
- /**
- * Get the CSS compressor to remove comments and whitespace characters from css resources
- *
- * @return whether the comments and whitespace characters will be stripped from resources served
- * through {@link org.apache.wicket.request.resource.CssPackageResource
- * CssPackageResource}. Null is a valid value.
- */
- ICssCompressor getCssCompressor();
-
- /**
- * Sets whether to use pre-minified resources when available. Minified resources are detected by
- * name. The minified version of {@code x.js} is expected to be called {@code x.min.js}. For css
- * files, the same convention is used: {@code x.min.css} is the minified version of
- * {@code x.css}. When this is null, minified resources will only be used in deployment
- * configuration.
- *
- * @param useMinifiedResources
- * The new value for the setting
- */
- void setUseMinifiedResources(boolean useMinifiedResources);
-
- /**
- * @return Whether pre-minified resources will be used.
- */
- boolean getUseMinifiedResources();
-
- /**
- * Sets the comparator used by the {@linkplain ResourceAggregator resource aggregator} for
- * sorting header items. It should be noted that sorting header items may break resource
- * dependencies. This comparator should therefore at least respect dependencies declared by
- * resource references. By default, items are sorted using the {@link PriorityFirstComparator}.
- *
- * @param comparator
- * The comparator used to sort header items, when null, header items will not be
- * sorted.
- */
- void setHeaderItemComparator(Comparator<? super RecordedHeaderItem> comparator);
-
- /**
- * @return The comparator used to sort header items.
- */
- Comparator<? super RecordedHeaderItem> getHeaderItemComparator();
-
- /**
- * A flag indicating whether static resources should have <tt>jsessionid</tt> encoded in their
- * url.
- *
- * @return {@code true} if the jsessionid should be encoded in the url for resources
- * implementing
- * {@link org.apache.wicket.request.resource.caching.IStaticCacheableResource} when the
- * cookies are disabled and there is an active http session.
- */
- boolean isEncodeJSessionId();
-
- /**
- * Sets a flag indicating whether the jsessionid should be encoded in the url for resources
- * implementing {@link org.apache.wicket.request.resource.caching.IStaticCacheableResource} when
- * the cookies are disabled and there is an active http session.
- *
- * @param encodeJSessionId
- * {@code true} when the jsessionid should be encoded, {@code false} - otherwise
- */
- void setEncodeJSessionId(boolean encodeJSessionId);
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/main/java/org/apache/wicket/settings/def/ResourceSettings.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/def/ResourceSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/def/ResourceSettings.java
index 3b9b9b7..421c198 100644
--- a/wicket-core/src/main/java/org/apache/wicket/settings/def/ResourceSettings.java
+++ b/wicket-core/src/main/java/org/apache/wicket/settings/def/ResourceSettings.java
@@ -43,6 +43,7 @@ import org.apache.wicket.request.resource.caching.version.IResourceVersion;
import org.apache.wicket.request.resource.caching.version.LastModifiedResourceVersion;
import org.apache.wicket.request.resource.caching.version.MessageDigestResourceVersion;
import org.apache.wicket.request.resource.caching.version.RequestCycleCachedResourceVersion;
+import org.apache.wicket.resource.IPropertiesFactoryContext;
import org.apache.wicket.resource.PropertiesFactory;
import org.apache.wicket.resource.loader.ClassStringResourceLoader;
import org.apache.wicket.resource.loader.ComponentStringResourceLoader;
@@ -50,7 +51,6 @@ import org.apache.wicket.resource.loader.IStringResourceLoader;
import org.apache.wicket.resource.loader.InitializerStringResourceLoader;
import org.apache.wicket.resource.loader.PackageStringResourceLoader;
import org.apache.wicket.resource.loader.ValidatorStringResourceLoader;
-import org.apache.wicket.settings.IResourceSettings;
import org.apache.wicket.util.file.IFileCleaner;
import org.apache.wicket.util.file.IResourceFinder;
import org.apache.wicket.util.lang.Args;
@@ -61,6 +61,41 @@ import org.apache.wicket.util.watch.IModificationWatcher;
import org.apache.wicket.util.watch.ModificationWatcher;
/**
+ * Interface for resource related settings
+ * <p>
+ * <i>resourcePollFrequency </i> (defaults to no polling frequency) - Frequency at which resources
+ * should be polled for changes.
+ * <p>
+ * <i>resourceFinders</i> - Add/modify this to alter the search path for resources.
+ * <p>
+ * <i>useDefaultOnMissingResource </i> (defaults to true) - Set to true to return a default value if
+ * available when a required string resource is not found. If set to false then the
+ * throwExceptionOnMissingResource flag is used to determine how to behave. If no default is
+ * available then this is the same as if this flag were false
+ * <p>
+ * <i>A ResourceStreamLocator </i>- An Application's ResourceStreamLocator is used to find resources
+ * such as images or markup files. You can supply your own ResourceStreamLocator if your prefer to
+ * store your application's resources in a non-standard location (such as a different filesystem
+ * location, a particular JAR file or even a database) by overriding the getResourceLocator()
+ * method.
+ * <p>
+ * <i>Resource Factories </i>- Resource factories can be used to create resources dynamically from
+ * specially formatted HTML tag attribute values. For more details, see {@link IResourceFactory},
+ * {@link org.apache.wicket.markup.html.image.resource.DefaultButtonImageResourceFactory} and
+ * especially {@link org.apache.wicket.markup.html.image.resource.LocalizedImageResource}.
+ * <p>
+ * <i>A Localizer </i> The getLocalizer() method returns an object encapsulating all of the
+ * functionality required to access localized resources. For many localization problems, even this
+ * will not be required, as there are convenience methods available to all components:
+ * {@link org.apache.wicket.Component#getString(String key)} and
+ * {@link org.apache.wicket.Component#getString(String key, org.apache.wicket.model.IModel model)}.
+ * <p>
+ * <i>stringResourceLoaders </i>- A chain of <code>IStringResourceLoader</code> instances that are
+ * searched in order to obtain string resources used during localization. By default the chain is
+ * set up to first search for resources against a particular component (e.g. page etc.) and then
+ * against the application.
+ * </p>
+ *
* @author Jonathan Locke
* @author Chris Turner
* @author Eelco Hillenius
@@ -70,7 +105,7 @@ import org.apache.wicket.util.watch.ModificationWatcher;
* @author Martijn Dashorst
* @author James Carman
*/
-public class ResourceSettings implements IResourceSettings
+public class ResourceSettings implements IPropertiesFactoryContext
{
/** I18N support */
private Localizer localizer;
@@ -190,19 +225,19 @@ public class ResourceSettings implements IResourceSettings
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#addResourceFactory(java.lang.String,
- * org.apache.wicket.IResourceFactory)
+ * Adds a resource factory to the list of factories to consult when generating resources
+ * automatically
+ *
+ * @param name
+ * The name to give to the factory
+ * @param resourceFactory
+ * The resource factory to add
*/
- @Override
public void addResourceFactory(final String name, IResourceFactory resourceFactory)
{
nameToResourceFactory.put(name, resourceFactory);
}
- /**
- * @see org.apache.wicket.settings.IResourceSettings#getLocalizer()
- */
- @Override
public Localizer getLocalizer()
{
if (localizer == null)
@@ -213,18 +248,20 @@ public class ResourceSettings implements IResourceSettings
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#getPackageResourceGuard()
+ * Gets the {@link org.apache.wicket.markup.html.PackageResourceGuard package resource guard}.
+ *
+ * @return The package resource guard
*/
- @Override
public IPackageResourceGuard getPackageResourceGuard()
{
return packageResourceGuard;
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#getPropertiesFactory()
+ * Get the property factory which will be used to load property files
+ *
+ * @return PropertiesFactory
*/
- @Override
public org.apache.wicket.resource.IPropertiesFactory getPropertiesFactory()
{
if (propertiesFactory == null)
@@ -235,36 +272,36 @@ public class ResourceSettings implements IResourceSettings
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#getResourceFactory(java.lang.String)
+ * @param name
+ * Name of the factory to get
+ * @return The IResourceFactory with the given name.
*/
- @Override
public IResourceFactory getResourceFactory(final String name)
{
return nameToResourceFactory.get(name);
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#getResourceFinders()
+ * Gets the resource finders to use when searching for resources. By default, a finder that
+ * looks in the classpath root is configured. {@link org.apache.wicket.protocol.http.WebApplication} adds the classpath
+ * directory META-INF/resources. To configure additional search paths or filesystem paths, add
+ * to this list.
+ *
+ * @return Returns the resourceFinders.
*/
- @Override
public List<IResourceFinder> getResourceFinders()
{
return resourceFinders;
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#getResourcePollFrequency()
+ * @return Returns the resourcePollFrequency.
*/
- @Override
public Duration getResourcePollFrequency()
{
return resourcePollFrequency;
}
- /**
- * @see org.apache.wicket.settings.IResourceSettings#getResourceStreamLocator()
- */
- @Override
public IResourceStreamLocator getResourceStreamLocator()
{
if (resourceStreamLocator == null)
@@ -277,10 +314,6 @@ public class ResourceSettings implements IResourceSettings
return resourceStreamLocator;
}
- /**
- * @see org.apache.wicket.settings.IResourceSettings#getResourceWatcher(boolean)
- */
- @Override
public IModificationWatcher getResourceWatcher(boolean start)
{
if (resourceWatcher == null && start)
@@ -301,84 +334,98 @@ public class ResourceSettings implements IResourceSettings
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#setResourceWatcher(org.apache.wicket.util.watch.IModificationWatcher)
+ * Sets the resource watcher
+ *
+ * @param watcher
*/
- @Override
public void setResourceWatcher(IModificationWatcher watcher)
{
resourceWatcher = watcher;
}
- @Override
+ /**
+ * @return the a cleaner which can be used to remove files asynchronously.
+ */
public IFileCleaner getFileCleaner()
{
return fileCleaner;
}
- @Override
+ /**
+ * Sets a cleaner that can be used to remove files asynchronously.
+ * <p>
+ * Used internally to delete the temporary files created by FileUpload functionality
+ *
+ * @param fileUploadCleaner
+ * the actual cleaner implementation. Can be <code>null</code>
+ */
public void setFileCleaner(IFileCleaner fileUploadCleaner)
{
fileCleaner = fileUploadCleaner;
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#getStringResourceLoaders()
+ * @return mutable list of all available string resource loaders
*/
- @Override
public List<IStringResourceLoader> getStringResourceLoaders()
{
return stringResourceLoaders;
}
- /**
- * @see org.apache.wicket.settings.IResourceSettings#getThrowExceptionOnMissingResource()
- */
- @Override
public boolean getThrowExceptionOnMissingResource()
{
return throwExceptionOnMissingResource;
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#getUseDefaultOnMissingResource()
+ * @return Whether to use a default value (if available) when a missing resource is requested
*/
- @Override
public boolean getUseDefaultOnMissingResource()
{
return useDefaultOnMissingResource;
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#setLocalizer(org.apache.wicket.Localizer)
+ * Sets the localizer which will be used to find property values.
+ *
+ * @param localizer
+ * @since 1.3.0
*/
- @Override
public void setLocalizer(final Localizer localizer)
{
this.localizer = localizer;
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#setPackageResourceGuard(org.apache.wicket.markup.html.IPackageResourceGuard)
+ * Sets the {@link org.apache.wicket.markup.html.PackageResourceGuard package resource guard}.
+ *
+ * @param packageResourceGuard
+ * The package resource guard
*/
- @Override
public void setPackageResourceGuard(IPackageResourceGuard packageResourceGuard)
{
this.packageResourceGuard = Args.notNull(packageResourceGuard, "packageResourceGuard");
}
/**
- * @see IResourceSettings#setPropertiesFactory(org.apache.wicket.resource.IPropertiesFactory)
+ * Set the property factory which will be used to load property files
+ *
+ * @param factory
*/
- @Override
public void setPropertiesFactory(org.apache.wicket.resource.IPropertiesFactory factory)
{
propertiesFactory = factory;
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#setResourceFinders(java.util.List)
+ * Sets the finders to use when searching for resources. By default, the resources are located
+ * on the classpath. To add additional search paths, add to the list given by
+ * {@link #getResourceFinders()}. Use this method if you want to completely exchange the list of
+ * resource finders.
+ *
+ * @param resourceFinders
+ * The resourceFinders to set
*/
- @Override
public void setResourceFinders(final List<IResourceFinder> resourceFinders)
{
Args.notNull(resourceFinders, "resourceFinders");
@@ -389,73 +436,103 @@ public class ResourceSettings implements IResourceSettings
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#setResourcePollFrequency(org.apache.wicket.util.time.Duration)
+ * Sets the resource polling frequency. This is the duration of time between checks of resource
+ * modification times. If a resource, such as an HTML file, has changed, it will be reloaded.
+ * The default is one second in 'development' mode and 'never' in deployment mode.
+ *
+ * @param resourcePollFrequency
+ * Frequency at which to poll resources or <code>null</code> if polling should be
+ * disabled
*/
- @Override
public void setResourcePollFrequency(final Duration resourcePollFrequency)
{
this.resourcePollFrequency = resourcePollFrequency;
}
/**
- * {@inheritDoc}
- *
+ * /**
+ * Sets the resource stream locator for this application
+ *
* Consider wrapping <code>resourceStreamLocator</code> in {@link CachingResourceStreamLocator}.
* This way the locator will not be asked more than once for {@link IResourceStream}s which do
* not exist.
- *
+ * @param resourceStreamLocator
+ * new resource stream locator
+ *
* @see #getResourceStreamLocator()
*/
- @Override
public void setResourceStreamLocator(IResourceStreamLocator resourceStreamLocator)
{
this.resourceStreamLocator = resourceStreamLocator;
}
- /**
- * @see org.apache.wicket.settings.IResourceSettings#setThrowExceptionOnMissingResource(boolean)
- */
- @Override
public void setThrowExceptionOnMissingResource(final boolean throwExceptionOnMissingResource)
{
this.throwExceptionOnMissingResource = throwExceptionOnMissingResource;
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#setUseDefaultOnMissingResource(boolean)
+ * @param useDefaultOnMissingResource
+ * Whether to use a default value (if available) when a missing resource is requested
*/
- @Override
public void setUseDefaultOnMissingResource(final boolean useDefaultOnMissingResource)
{
this.useDefaultOnMissingResource = useDefaultOnMissingResource;
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#getDefaultCacheDuration()
+ * Get the the default cache duration for resources.
+ * <p/>
+ *
+ * @return cache duration (Duration.NONE will be returned if caching is disabled)
+ *
+ * @see org.apache.wicket.util.time.Duration#NONE
*/
- @Override
public final Duration getDefaultCacheDuration()
{
return defaultCacheDuration;
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#setDefaultCacheDuration(org.apache.wicket.util.time.Duration)
+ * Set the the default cache duration for resources.
+ * <p/>
+ * Based on RFC-2616 this should not exceed one year. If you set Duration.NONE caching will be
+ * disabled.
+ *
+ * @param duration
+ * default cache duration in seconds
+ *
+ * @see org.apache.wicket.util.time.Duration#NONE
+ * @see org.apache.wicket.request.http.WebResponse#MAX_CACHE_DURATION
*/
- @Override
public final void setDefaultCacheDuration(Duration duration)
{
Args.notNull(duration, "duration");
defaultCacheDuration = duration;
}
- @Override
+ /**
+ * Get the javascript compressor to remove comments and whitespace characters from javascripts
+ *
+ * @return whether the comments and whitespace characters will be stripped from resources served
+ * through {@link org.apache.wicket.request.resource.JavaScriptPackageResource
+ * JavaScriptPackageResource}. Null is a valid value.
+ */
public IJavaScriptCompressor getJavaScriptCompressor()
{
return javascriptCompressor;
}
- @Override
+ /**
+ * Set the javascript compressor implemententation use e.g. by
+ * {@link org.apache.wicket.request.resource.JavaScriptPackageResource
+ * JavaScriptPackageResource}. A typical implementation will remove comments and whitespace. But
+ * a no-op implementation is available as well.
+ *
+ * @param compressor
+ * The implementation to be used
+ * @return The old value
+ */
public IJavaScriptCompressor setJavaScriptCompressor(IJavaScriptCompressor compressor)
{
IJavaScriptCompressor old = javascriptCompressor;
@@ -463,13 +540,28 @@ public class ResourceSettings implements IResourceSettings
return old;
}
- @Override
+ /**
+ * Get the CSS compressor to remove comments and whitespace characters from css resources
+ *
+ * @return whether the comments and whitespace characters will be stripped from resources served
+ * through {@link org.apache.wicket.request.resource.CssPackageResource
+ * CssPackageResource}. Null is a valid value.
+ */
public ICssCompressor getCssCompressor()
{
return cssCompressor;
}
- @Override
+ /**
+ * Set the CSS compressor implemententation use e.g. by
+ * {@link org.apache.wicket.request.resource.CssPackageResource CssPackageResource}. A typical
+ * implementation will remove comments and whitespace. But a no-op implementation is available
+ * as well.
+ *
+ * @param compressor
+ * The implementation to be used
+ * @return The old value
+ */
public ICssCompressor setCssCompressor(ICssCompressor compressor)
{
ICssCompressor old = cssCompressor;
@@ -477,29 +569,46 @@ public class ResourceSettings implements IResourceSettings
return old;
}
-
/**
- * @see org.apache.wicket.settings.IResourceSettings#getParentFolderPlaceholder()
+ * Placeholder string for '..' within resource urls (which will be crippled by the browser and
+ * not work anymore). Note that by default the placeholder string is <code>::</code>. Resources
+ * are protected by a {@link org.apache.wicket.markup.html.IPackageResourceGuard
+ * IPackageResourceGuard} implementation such as
+ * {@link org.apache.wicket.markup.html.PackageResourceGuard} which you may use or extend based
+ * on your needs.
+ *
+ * @return placeholder
*/
- @Override
public String getParentFolderPlaceholder()
{
return parentFolderPlaceholder;
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#setParentFolderPlaceholder(String)
+ * Placeholder string for '..' within resource urls (which will be crippled by the browser and
+ * not work anymore). Note that by default the placeholder string is <code>null</code> and thus
+ * will not allow to access parent folders. That is by purpose and for security reasons (see
+ * Wicket-1992). In case you really need it, a good value for placeholder would e.g. be "$up$".
+ * Resources additionally are protected by a
+ * {@link org.apache.wicket.markup.html.IPackageResourceGuard IPackageResourceGuard}
+ * implementation such as {@link org.apache.wicket.markup.html.PackageResourceGuard} which you
+ * may use or extend based on your needs.
+ *
+ * @see #getParentFolderPlaceholder()
+ *
+ * @param sequence
+ * character sequence which must not be ambiguous within urls
*/
- @Override
public void setParentFolderPlaceholder(final String sequence)
{
parentFolderPlaceholder = sequence;
}
/**
- * @see IResourceSettings#getCachingStrategy()
+ * gets the resource caching strategy
+ *
+ * @return strategy
*/
- @Override
public IResourceCachingStrategy getCachingStrategy()
{
if (resourceCachingStrategy == null)
@@ -529,9 +638,13 @@ public class ResourceSettings implements IResourceSettings
}
/**
- * @see org.apache.wicket.settings.IResourceSettings#setCachingStrategy(org.apache.wicket.request.resource.caching.IResourceCachingStrategy)
+ * sets the resource caching strategy
+ *
+ * @param strategy
+ * instance of resource caching strategy
+ *
+ * @see IResourceCachingStrategy
*/
- @Override
public void setCachingStrategy(IResourceCachingStrategy strategy)
{
if (strategy == null)
@@ -543,37 +656,74 @@ public class ResourceSettings implements IResourceSettings
resourceCachingStrategy = strategy;
}
- @Override
+ /**
+ * Sets whether to use pre-minified resources when available. Minified resources are detected by
+ * name. The minified version of {@code x.js} is expected to be called {@code x.min.js}. For css
+ * files, the same convention is used: {@code x.min.css} is the minified version of
+ * {@code x.css}. When this is null, minified resources will only be used in deployment
+ * configuration.
+ *
+ * @param useMinifiedResources
+ * The new value for the setting
+ */
public void setUseMinifiedResources(boolean useMinifiedResources)
{
this.useMinifiedResources = useMinifiedResources;
}
- @Override
+ /**
+ * @return Whether pre-minified resources will be used.
+ */
public boolean getUseMinifiedResources()
{
return useMinifiedResources;
}
- @Override
+ /**
+ * @return The comparator used to sort header items.
+ */
public Comparator<? super RecordedHeaderItem> getHeaderItemComparator()
{
return headerItemComparator;
}
- @Override
+ /**
+ * Sets the comparator used by the {@linkplain org.apache.wicket.markup.head.ResourceAggregator resource aggregator} for
+ * sorting header items. It should be noted that sorting header items may break resource
+ * dependencies. This comparator should therefore at least respect dependencies declared by
+ * resource references. By default, items are sorted using the {@link PriorityFirstComparator}.
+ *
+ * @param headerItemComparator
+ * The comparator used to sort header items, when null, header items will not be
+ * sorted.
+ */
public void setHeaderItemComparator(Comparator<? super RecordedHeaderItem> headerItemComparator)
{
this.headerItemComparator = headerItemComparator;
}
- @Override
+ /**
+ * A flag indicating whether static resources should have <tt>jsessionid</tt> encoded in their
+ * url.
+ *
+ * @return {@code true} if the jsessionid should be encoded in the url for resources
+ * implementing
+ * {@link org.apache.wicket.request.resource.caching.IStaticCacheableResource} when the
+ * cookies are disabled and there is an active http session.
+ */
public boolean isEncodeJSessionId()
{
return encodeJSessionId;
}
- @Override
+ /**
+ * Sets a flag indicating whether the jsessionid should be encoded in the url for resources
+ * implementing {@link org.apache.wicket.request.resource.caching.IStaticCacheableResource} when
+ * the cookies are disabled and there is an active http session.
+ *
+ * @param encodeJSessionId
+ * {@code true} when the jsessionid should be encoded, {@code false} - otherwise
+ */
public void setEncodeJSessionId(boolean encodeJSessionId)
{
this.encodeJSessionId = encodeJSessionId;
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/test/java/org/apache/wicket/ApplicationSettingsTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/ApplicationSettingsTest.java b/wicket-core/src/test/java/org/apache/wicket/ApplicationSettingsTest.java
index 20d7828..0ce397c 100644
--- a/wicket-core/src/test/java/org/apache/wicket/ApplicationSettingsTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/ApplicationSettingsTest.java
@@ -20,8 +20,6 @@ import static org.junit.Assert.assertEquals;
import java.util.List;
-import org.junit.Assert;
-
import org.apache.wicket.mock.MockApplication;
import org.apache.wicket.protocol.http.mock.MockServletContext;
import org.apache.wicket.resource.loader.BundleStringResourceLoader;
@@ -31,10 +29,10 @@ import org.apache.wicket.resource.loader.IStringResourceLoader;
import org.apache.wicket.resource.loader.InitializerStringResourceLoader;
import org.apache.wicket.resource.loader.PackageStringResourceLoader;
import org.apache.wicket.resource.loader.ValidatorStringResourceLoader;
-import org.apache.wicket.settings.IResourceSettings;
import org.apache.wicket.settings.def.FrameworkSettings;
import org.apache.wicket.settings.def.ResourceSettings;
import org.junit.After;
+import org.junit.Assert;
import org.junit.Test;
/**
@@ -70,7 +68,7 @@ public class ApplicationSettingsTest
@Test
public void testExceptionOnMissingResourceDefaultValue() throws Exception
{
- IResourceSettings settings = new ResourceSettings(new MockApplication());
+ ResourceSettings settings = new ResourceSettings(new MockApplication());
Assert.assertTrue("exceptionOnMissingResource should default to true",
settings.getThrowExceptionOnMissingResource());
}
@@ -81,7 +79,7 @@ public class ApplicationSettingsTest
@Test
public void testExceptionOnMissingResourceSetsCorrectly() throws Exception
{
- IResourceSettings settings = new ResourceSettings(new MockApplication());
+ ResourceSettings settings = new ResourceSettings(new MockApplication());
settings.setThrowExceptionOnMissingResource(false);
Assert.assertFalse("exceptionOnMissingResource should have been set to false",
settings.getThrowExceptionOnMissingResource());
@@ -93,7 +91,7 @@ public class ApplicationSettingsTest
@Test
public void testUseDefaultOnMissingResourceDefaultValue() throws Exception
{
- IResourceSettings settings = new ResourceSettings(new MockApplication());
+ ResourceSettings settings = new ResourceSettings(new MockApplication());
Assert.assertTrue("useDefaultOnMissingResource should default to true",
settings.getUseDefaultOnMissingResource());
}
@@ -104,7 +102,7 @@ public class ApplicationSettingsTest
@Test
public void testUseDefaultOnMissingResourceSetsCorrectly() throws Exception
{
- IResourceSettings settings = new ResourceSettings(new MockApplication());
+ ResourceSettings settings = new ResourceSettings(new MockApplication());
settings.setUseDefaultOnMissingResource(false);
Assert.assertFalse("useDefaultOnMissingResource should have been set to false",
settings.getUseDefaultOnMissingResource());
@@ -116,7 +114,7 @@ public class ApplicationSettingsTest
@Test
public void testDefaultStringResourceLoaderSetup()
{
- IResourceSettings settings = new ResourceSettings(new MockApplication());
+ ResourceSettings settings = new ResourceSettings(new MockApplication());
List<IStringResourceLoader> loaders = settings.getStringResourceLoaders();
Assert.assertEquals("There should be 5 default loaders", 5, loaders.size());
Assert.assertTrue("First loader one should be the component one",
@@ -137,7 +135,7 @@ public class ApplicationSettingsTest
@Test
public void testOverrideStringResourceLoaderSetup()
{
- IResourceSettings settings = new ResourceSettings(new MockApplication());
+ ResourceSettings settings = new ResourceSettings(new MockApplication());
settings.getStringResourceLoaders().clear();
settings.getStringResourceLoaders().add(
new BundleStringResourceLoader("org.apache.wicket.resource.DummyResources"));
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-core/src/test/java/org/apache/wicket/LocalizerTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/LocalizerTest.java b/wicket-core/src/test/java/org/apache/wicket/LocalizerTest.java
index db1767e..96f61a8 100644
--- a/wicket-core/src/test/java/org/apache/wicket/LocalizerTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/LocalizerTest.java
@@ -30,7 +30,7 @@ import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.resource.DummyApplication;
import org.apache.wicket.resource.loader.ComponentStringResourceLoader;
-import org.apache.wicket.settings.IResourceSettings;
+import org.apache.wicket.settings.def.ResourceSettings;
import org.apache.wicket.util.string.Strings;
import org.apache.wicket.util.tester.WicketTester;
import org.apache.wicket.util.value.ValueMap;
@@ -72,7 +72,7 @@ public class LocalizerTest extends Assert
}
private WicketTester tester;
- private IResourceSettings settings;
+ private ResourceSettings settings;
protected Localizer localizer;
http://git-wip-us.apache.org/repos/asf/wicket/blob/b2d13b27/wicket-jmx/src/main/java/org/apache/wicket/jmx/ResourceSettingsMBean.java
----------------------------------------------------------------------
diff --git a/wicket-jmx/src/main/java/org/apache/wicket/jmx/ResourceSettingsMBean.java b/wicket-jmx/src/main/java/org/apache/wicket/jmx/ResourceSettingsMBean.java
index a7695fd..f3af599 100644
--- a/wicket-jmx/src/main/java/org/apache/wicket/jmx/ResourceSettingsMBean.java
+++ b/wicket-jmx/src/main/java/org/apache/wicket/jmx/ResourceSettingsMBean.java
@@ -17,8 +17,6 @@
package org.apache.wicket.jmx;
import org.apache.wicket.markup.html.PackageResourceGuard;
-import org.apache.wicket.settings.IResourceSettings;
-import org.apache.wicket.util.file.IResourceFinder;
import org.apache.wicket.util.time.Duration;
/**
@@ -53,13 +51,13 @@ public interface ResourceSettingsMBean
* Gets the resource finder to use when searching for resources.
*
* @return Returns the resourceFinder.
- * @see IResourceSettings#setResourceFinder(IResourceFinder)
+ * @see org.apache.wicket.settings.def.ResourceSettings#getResourceFinders()
*/
String getResourceFinders();
/**
* @return Returns the resourcePollFrequency.
- * @see IResourceSettings#setResourcePollFrequency(Duration)
+ * @see org.apache.wicket.settings.def.ResourceSettings#setResourcePollFrequency(Duration)
*/
String getResourcePollFrequency();
@@ -74,7 +72,7 @@ public interface ResourceSettingsMBean
String[] getStringResourceLoaders();
/**
- * @see org.apache.wicket.settings.IExceptionSettings#getThrowExceptionOnMissingResource()
+ * @see org.apache.wicket.settings.def.ResourceSettings#getThrowExceptionOnMissingResource()
*
* @return boolean
*/
@@ -86,7 +84,7 @@ public interface ResourceSettingsMBean
boolean getUseDefaultOnMissingResource();
/**
- * @see org.apache.wicket.settings.IExceptionSettings#setThrowExceptionOnMissingResource(boolean)
+ * @see org.apache.wicket.settings.def.ResourceSettings#setThrowExceptionOnMissingResource(boolean)
*
* @param throwExceptionOnMissingResource
*/
[3/4] git commit: WICKET-5410 Remove setting interfaces
Posted by mg...@apache.org.
WICKET-5410 Remove setting interfaces
Remove ISecuritySettings interface
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/a5b34d75
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/a5b34d75
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/a5b34d75
Branch: refs/heads/master
Commit: a5b34d75fa82d7d522ff8516f4cbb3082d9ed587
Parents: 82dd6ee
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Nov 12 17:53:58 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Nov 13 09:50:41 2013 +0200
----------------------------------------------------------------------
.../authentication/panel/SignInPanel.java | 7 +-
.../java/org/apache/wicket/Application.java | 7 +-
.../authorization/IAuthorizationStrategy.java | 3 +-
.../core/request/mapper/CryptoMapper.java | 9 +-
.../wicket/settings/ISecuritySettings.java | 125 -------------------
.../wicket/settings/def/SecuritySettings.java | 89 ++++++++-----
.../examples/WicketExampleApplication.java | 4 +-
7 files changed, 68 insertions(+), 176 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/a5b34d75/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/panel/SignInPanel.java
----------------------------------------------------------------------
diff --git a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/panel/SignInPanel.java b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/panel/SignInPanel.java
index 78ee0a1..8d9b113 100644
--- a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/panel/SignInPanel.java
+++ b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/panel/SignInPanel.java
@@ -28,8 +28,6 @@ import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.protocol.http.WebSession;
-import org.apache.wicket.settings.ISecuritySettings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,10 +38,9 @@ import org.slf4j.LoggerFactory;
* session.
*
* @see {@link IAuthenticationStrategy}
- * @see {@link ISecuritySettings#getAuthenticationStrategy()}
+ * @see {@link org.apache.wicket.settings.def.SecuritySettings#getAuthenticationStrategy()}
* @see {@link DefaultAuthenticationStrategy}
- * @see {@link WebSession#authenticate(String, String)}
- *
+ *
* @author Jonathan Locke
* @author Juergen Donnerstag
* @author Eelco Hillenius
http://git-wip-us.apache.org/repos/asf/wicket/blob/a5b34d75/wicket-core/src/main/java/org/apache/wicket/Application.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Application.java b/wicket-core/src/main/java/org/apache/wicket/Application.java
index 977279f..0690637 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Application.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Application.java
@@ -86,7 +86,6 @@ import org.apache.wicket.session.ISessionStore;
import org.apache.wicket.session.ISessionStore.UnboundListener;
import org.apache.wicket.settings.IMarkupSettings;
import org.apache.wicket.settings.IResourceSettings;
-import org.apache.wicket.settings.ISecuritySettings;
import org.apache.wicket.settings.def.ApplicationSettings;
import org.apache.wicket.settings.def.DebugSettings;
import org.apache.wicket.settings.def.ExceptionSettings;
@@ -1043,7 +1042,7 @@ public abstract class Application implements UnboundListener, IEventSink
private IResourceSettings resourceSettings;
/** The Security Settings */
- private ISecuritySettings securitySettings;
+ private SecuritySettings securitySettings;
/** The settings for {@link IPageStore}, {@link IDataStore} and {@link IPageManager} */
private StoreSettings storeSettings;
@@ -1277,7 +1276,7 @@ public abstract class Application implements UnboundListener, IEventSink
/**
* @return Application's security related settings
*/
- public final ISecuritySettings getSecuritySettings()
+ public final SecuritySettings getSecuritySettings()
{
checkSettingsAvailable();
if (securitySettings == null)
@@ -1291,7 +1290,7 @@ public abstract class Application implements UnboundListener, IEventSink
*
* @param securitySettings
*/
- public final void setSecuritySettings(final ISecuritySettings securitySettings)
+ public final void setSecuritySettings(final SecuritySettings securitySettings)
{
this.securitySettings = securitySettings;
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/a5b34d75/wicket-core/src/main/java/org/apache/wicket/authorization/IAuthorizationStrategy.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/authorization/IAuthorizationStrategy.java b/wicket-core/src/main/java/org/apache/wicket/authorization/IAuthorizationStrategy.java
index e566b9e..98e2321 100644
--- a/wicket-core/src/main/java/org/apache/wicket/authorization/IAuthorizationStrategy.java
+++ b/wicket-core/src/main/java/org/apache/wicket/authorization/IAuthorizationStrategy.java
@@ -20,7 +20,6 @@ import org.apache.wicket.Component;
import org.apache.wicket.request.component.IRequestableComponent;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.request.resource.IResource;
-import org.apache.wicket.settings.ISecuritySettings;
/**
* Authorization strategies specify aspect-like constraints on significant actions taken by the
@@ -71,7 +70,7 @@ public interface IAuthorizationStrategy
/**
* Checks whether an instance of the given component class may be created. If this method
* returns false, the {@link IUnauthorizedComponentInstantiationListener} that is configured in
- * the {@link ISecuritySettings security settings} will be called. The default implementation of
+ * the {@link org.apache.wicket.settings.def.SecuritySettings security settings} will be called. The default implementation of
* that listener throws a {@link UnauthorizedInstantiationException}.
* <p>
* If you wish to implement a strategy that authenticates users which cannot access a given Page
http://git-wip-us.apache.org/repos/asf/wicket/blob/a5b34d75/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/CryptoMapper.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/CryptoMapper.java b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/CryptoMapper.java
index 06a10ed..2c47525 100755
--- a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/CryptoMapper.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/CryptoMapper.java
@@ -24,7 +24,6 @@ import org.apache.wicket.request.IRequestHandler;
import org.apache.wicket.request.IRequestMapper;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Url;
-import org.apache.wicket.settings.ISecuritySettings;
import org.apache.wicket.util.IProvider;
import org.apache.wicket.util.crypt.ICrypt;
import org.apache.wicket.util.crypt.ICryptFactory;
@@ -57,10 +56,10 @@ public class CryptoMapper implements IRequestMapper
private final IProvider<ICrypt> cryptProvider;
/**
- * Encrypt with {@link ISecuritySettings#getCryptFactory()}.
+ * Encrypt with {@link org.apache.wicket.settings.def.SecuritySettings#getCryptFactory()}.
* <p>
- * Note: Encryption is done with {@link ISecuritySettings#DEFAULT_ENCRYPTION_KEY} if you haven't
- * configured an alternative {@link ICryptFactory}. Alternatively use
+ * Note: Encryption is done with {@link org.apache.wicket.settings.def.SecuritySettings#DEFAULT_ENCRYPTION_KEY}
+ * if you haven't configured an alternative {@link ICryptFactory}. Alternatively use
* {@link CryptoMapper#CryptoMapper(IRequestMapper, IProvider)} with a specific {@link ICrypt}.
*
* @param wrappedMapper
@@ -321,4 +320,4 @@ public class CryptoMapper implements IRequestMapper
return hash;
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/a5b34d75/wicket-core/src/main/java/org/apache/wicket/settings/ISecuritySettings.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/ISecuritySettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/ISecuritySettings.java
deleted file mode 100644
index cf6806a..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/settings/ISecuritySettings.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.settings;
-
-import org.apache.wicket.authentication.IAuthenticationStrategy;
-import org.apache.wicket.authorization.IAuthorizationStrategy;
-import org.apache.wicket.authorization.IUnauthorizedComponentInstantiationListener;
-import org.apache.wicket.authorization.IUnauthorizedResourceRequestListener;
-import org.apache.wicket.util.crypt.ICryptFactory;
-
-/**
- * Interface for security related settings
- *
- * @author Igor Vaynberg (ivaynberg)
- */
-public interface ISecuritySettings
-{
- /**
- * encryption key used by default crypt factory
- */
- public static final String DEFAULT_ENCRYPTION_KEY = "WiCkEt-FRAMEwork";
-
- /**
- * Gets the authorization strategy.
- *
- * @return Returns the authorizationStrategy.
- */
- IAuthorizationStrategy getAuthorizationStrategy();
-
- /**
- * Gets the authentication strategy.
- *
- * @return Returns the authentication strategy.
- */
- IAuthenticationStrategy getAuthenticationStrategy();
-
- /**
- * @return crypt factory used to generate crypt objects
- */
- ICryptFactory getCryptFactory();
-
- /**
- * Gets whether mounts should be enforced. If true, requests for mounted targets have to done
- * through the mounted paths. If, for instance, a bookmarkable page is mounted to a path, a
- * request to that same page via the bookmarkablePage parameter will be denied.
- *
- * @return Whether mounts should be enforced
- */
- boolean getEnforceMounts();
-
- /**
- * @return The listener
- * @see IUnauthorizedComponentInstantiationListener
- */
- IUnauthorizedComponentInstantiationListener getUnauthorizedComponentInstantiationListener();
-
- /**
- * Sets the authorization strategy.
- *
- * @param strategy
- * new authorization strategy
- */
- void setAuthorizationStrategy(IAuthorizationStrategy strategy);
-
- /**
- * Sets the authentication strategy.
- *
- * @param strategy
- * new authentication strategy
- */
- void setAuthenticationStrategy(IAuthenticationStrategy strategy);
-
- /**
- * Sets the factory that will be used to create crypt objects. The crypt object returned from
- * the first call is cached.
- *
- * @param cryptFactory
- */
- void setCryptFactory(ICryptFactory cryptFactory);
-
- /**
- * Sets whether mounts should be enforced. If true, requests for mounted targets have to done
- * through the mounted paths. If, for instance, a bookmarkable page is mounted to a path, a
- * request to that same page via the bookmarkablePage parameter will be denied.
- *
- * @param enforce
- * Whether mounts should be enforced
- */
- void setEnforceMounts(boolean enforce);
-
- /**
- * @param unauthorizedComponentInstantiationListener
- * The listener to set
- * @see IUnauthorizedComponentInstantiationListener
- */
- void setUnauthorizedComponentInstantiationListener(
- IUnauthorizedComponentInstantiationListener unauthorizedComponentInstantiationListener);
-
- /**
- * @return The listener that will be used when a request to an IResource is not allowed for some reason
- */
- IUnauthorizedResourceRequestListener getUnauthorizedResourceRequestListener();
-
- /**
- * Sets a listener that will be used when a request to an IResource is not allowed for some reason
- *
- * @param listener
- * The listener
- */
- void setUnauthorizedResourceRequestListener(IUnauthorizedResourceRequestListener listener);
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/a5b34d75/wicket-core/src/main/java/org/apache/wicket/settings/def/SecuritySettings.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/def/SecuritySettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/def/SecuritySettings.java
index 0eec303..bc73feb 100644
--- a/wicket-core/src/main/java/org/apache/wicket/settings/def/SecuritySettings.java
+++ b/wicket-core/src/main/java/org/apache/wicket/settings/def/SecuritySettings.java
@@ -23,11 +23,13 @@ import org.apache.wicket.authorization.IAuthorizationStrategy;
import org.apache.wicket.authorization.IUnauthorizedComponentInstantiationListener;
import org.apache.wicket.authorization.IUnauthorizedResourceRequestListener;
import org.apache.wicket.authorization.UnauthorizedInstantiationException;
-import org.apache.wicket.settings.ISecuritySettings;
import org.apache.wicket.util.crypt.CachingSunJceCryptFactory;
import org.apache.wicket.util.crypt.ICryptFactory;
+import org.apache.wicket.util.lang.Args;
/**
+ * Interface for security related settings
+ *
* @author Jonathan Locke
* @author Chris Turner
* @author Eelco Hillenius
@@ -37,8 +39,13 @@ import org.apache.wicket.util.crypt.ICryptFactory;
* @author Martijn Dashorst
* @author James Carman
*/
-public class SecuritySettings implements ISecuritySettings
+public class SecuritySettings
{
+ /**
+ * encryption key used by default crypt factory
+ */
+ public static final String DEFAULT_ENCRYPTION_KEY = "WiCkEt-FRAMEwork";
+
/** The authorization strategy. */
private IAuthorizationStrategy authorizationStrategy = IAuthorizationStrategy.ALLOW_ALL;
@@ -81,106 +88,120 @@ public class SecuritySettings implements ISecuritySettings
private IUnauthorizedResourceRequestListener unauthorizedResourceRequestListener = DEFAULT_UNAUTHORIZED_RESOURCE_REQUEST_LISTENER;
/**
- * @see org.apache.wicket.settings.ISecuritySettings#getAuthorizationStrategy()
+ * Gets the authorization strategy.
+ *
+ * @return Returns the authorizationStrategy.
*/
- @Override
public IAuthorizationStrategy getAuthorizationStrategy()
{
return authorizationStrategy;
}
/**
- * @see org.apache.wicket.settings.ISecuritySettings#getCryptFactory()
+ * @return crypt factory used to generate crypt objects
*/
- @Override
public synchronized ICryptFactory getCryptFactory()
{
if (cryptFactory == null)
{
- cryptFactory = new CachingSunJceCryptFactory(ISecuritySettings.DEFAULT_ENCRYPTION_KEY);
+ cryptFactory = new CachingSunJceCryptFactory(DEFAULT_ENCRYPTION_KEY);
}
return cryptFactory;
}
/**
- * @see org.apache.wicket.settings.ISecuritySettings#getEnforceMounts()
+ * Gets whether mounts should be enforced. If true, requests for mounted targets have to done
+ * through the mounted paths. If, for instance, a bookmarkable page is mounted to a path, a
+ * request to that same page via the bookmarkablePage parameter will be denied.
+ *
+ * @return Whether mounts should be enforced
*/
- @Override
public boolean getEnforceMounts()
{
return enforceMounts;
}
/**
- * @see org.apache.wicket.settings.ISecuritySettings#getUnauthorizedComponentInstantiationListener()
+ * @return The listener
+ * @see IUnauthorizedComponentInstantiationListener
*/
- @Override
public IUnauthorizedComponentInstantiationListener getUnauthorizedComponentInstantiationListener()
{
return unauthorizedComponentInstantiationListener;
}
/**
- * @see org.apache.wicket.settings.ISecuritySettings#setAuthorizationStrategy(org.apache.wicket.authorization.IAuthorizationStrategy)
+ * Sets the authorization strategy.
+ *
+ * @param strategy
+ * new authorization strategy
*/
- @Override
public void setAuthorizationStrategy(IAuthorizationStrategy strategy)
{
- if (strategy == null)
- {
- throw new IllegalArgumentException("authorization strategy cannot be set to null");
- }
+ Args.notNull(strategy, "strategy");
authorizationStrategy = strategy;
}
/**
- * @see org.apache.wicket.settings.ISecuritySettings#setCryptFactory(org.apache.wicket.util.crypt.ICryptFactory)
+ * Sets the factory that will be used to create crypt objects. The crypt object returned from
+ * the first call is cached.
+ *
+ * @param cryptFactory
*/
- @Override
public void setCryptFactory(ICryptFactory cryptFactory)
{
- if (cryptFactory == null)
- {
- throw new IllegalArgumentException("cryptFactory cannot be null");
- }
+ Args.notNull(cryptFactory, "cryptFactory");
this.cryptFactory = cryptFactory;
}
/**
- * @see org.apache.wicket.settings.ISecuritySettings#setEnforceMounts(boolean)
+ * Sets whether mounts should be enforced. If true, requests for mounted targets have to done
+ * through the mounted paths. If, for instance, a bookmarkable page is mounted to a path, a
+ * request to that same page via the bookmarkablePage parameter will be denied.
+ *
+ * @param enforce
+ * Whether mounts should be enforced
*/
- @Override
public void setEnforceMounts(boolean enforce)
{
enforceMounts = enforce;
}
/**
- * @see org.apache.wicket.settings.ISecuritySettings#setUnauthorizedComponentInstantiationListener(org.apache.wicket.authorization.IUnauthorizedComponentInstantiationListener)
+ * @param listener
+ * The listener to set
+ * @see IUnauthorizedComponentInstantiationListener
*/
- @Override
public void setUnauthorizedComponentInstantiationListener(
IUnauthorizedComponentInstantiationListener listener)
{
this.unauthorizedComponentInstantiationListener = listener == null ? DEFAULT_UNAUTHORIZED_COMPONENT_INSTANTIATION_LISTENER : listener;
}
- @Override
+ /**
+ * @return The listener that will be used when a request to an IResource is not allowed for some reason
+ */
public IUnauthorizedResourceRequestListener getUnauthorizedResourceRequestListener()
{
return unauthorizedResourceRequestListener;
}
- @Override
+ /**
+ * Sets a listener that will be used when a request to an IResource is not allowed for some reason
+ *
+ * @param listener
+ * The listener
+ */
public void setUnauthorizedResourceRequestListener(IUnauthorizedResourceRequestListener listener)
{
this.unauthorizedResourceRequestListener = listener == null ? DEFAULT_UNAUTHORIZED_RESOURCE_REQUEST_LISTENER : listener;
}
/**
- * @see org.apache.wicket.settings.ISecuritySettings#getAuthenticationStrategy()
+ * Gets the authentication strategy.
+ *
+ * @return Returns the authentication strategy.
*/
- @Override
public IAuthenticationStrategy getAuthenticationStrategy()
{
if (authenticationStrategy == null)
@@ -191,9 +212,11 @@ public class SecuritySettings implements ISecuritySettings
}
/**
- * @see org.apache.wicket.settings.ISecuritySettings#setAuthenticationStrategy(org.apache.wicket.authentication.IAuthenticationStrategy)
+ * Sets the authentication strategy.
+ *
+ * @param strategy
+ * new authentication strategy
*/
- @Override
public void setAuthenticationStrategy(final IAuthenticationStrategy strategy)
{
authenticationStrategy = strategy;
http://git-wip-us.apache.org/repos/asf/wicket/blob/a5b34d75/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleApplication.java
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleApplication.java b/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleApplication.java
index 64276cc..8fa6b93 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleApplication.java
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleApplication.java
@@ -17,7 +17,7 @@
package org.apache.wicket.examples;
import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.settings.ISecuritySettings;
+import org.apache.wicket.settings.def.SecuritySettings;
import org.apache.wicket.util.crypt.ClassCryptFactory;
import org.apache.wicket.util.crypt.NoCrypt;
@@ -62,7 +62,7 @@ public abstract class WicketExampleApplication extends WebApplication
// and we want them to be able to run the examples out of the
// box.
getSecuritySettings().setCryptFactory(
- new ClassCryptFactory(NoCrypt.class, ISecuritySettings.DEFAULT_ENCRYPTION_KEY));
+ new ClassCryptFactory(NoCrypt.class, SecuritySettings.DEFAULT_ENCRYPTION_KEY));
getDebugSettings().setDevelopmentUtilitiesEnabled(true);
}
[2/4] git commit: WICKET-5410 Remove setting interfaces
Posted by mg...@apache.org.
WICKET-5410 Remove setting interfaces
Remove IStoreSettings interface
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/82dd6ee8
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/82dd6ee8
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/82dd6ee8
Branch: refs/heads/master
Commit: 82dd6ee8f6b0b181f383eac685c080caf3479d44
Parents: 18fbdf4
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Nov 12 17:42:19 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Nov 13 09:50:41 2013 +0200
----------------------------------------------------------------------
.../java/org/apache/wicket/Application.java | 7 +-
.../wicket/DefaultPageManagerProvider.java | 10 +-
.../protocol/http/PageExpiredException.java | 3 +-
.../apache/wicket/settings/IStoreSettings.java | 117 -------------------
.../wicket/settings/def/StoreSettings.java | 82 ++++++++++---
.../wicket/pageStore/DiskDataStoreTest.java | 5 +-
.../diskstore/DebugPageManagerProvider.java | 4 +-
7 files changed, 82 insertions(+), 146 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/82dd6ee8/wicket-core/src/main/java/org/apache/wicket/Application.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Application.java b/wicket-core/src/main/java/org/apache/wicket/Application.java
index 5835f14..977279f 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Application.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Application.java
@@ -87,7 +87,6 @@ import org.apache.wicket.session.ISessionStore.UnboundListener;
import org.apache.wicket.settings.IMarkupSettings;
import org.apache.wicket.settings.IResourceSettings;
import org.apache.wicket.settings.ISecuritySettings;
-import org.apache.wicket.settings.IStoreSettings;
import org.apache.wicket.settings.def.ApplicationSettings;
import org.apache.wicket.settings.def.DebugSettings;
import org.apache.wicket.settings.def.ExceptionSettings;
@@ -1047,7 +1046,7 @@ public abstract class Application implements UnboundListener, IEventSink
private ISecuritySettings securitySettings;
/** The settings for {@link IPageStore}, {@link IDataStore} and {@link IPageManager} */
- private IStoreSettings storeSettings;
+ private StoreSettings storeSettings;
/** can the settings object be set/used. */
private boolean settingsAccessible;
@@ -1300,7 +1299,7 @@ public abstract class Application implements UnboundListener, IEventSink
/**
* @return Application's stores related settings
*/
- public final IStoreSettings getStoreSettings()
+ public final StoreSettings getStoreSettings()
{
checkSettingsAvailable();
if (storeSettings == null)
@@ -1314,7 +1313,7 @@ public abstract class Application implements UnboundListener, IEventSink
*
* @param storeSettings
*/
- public final void setStoreSettings(final IStoreSettings storeSettings)
+ public final void setStoreSettings(final StoreSettings storeSettings)
{
this.storeSettings = storeSettings;
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/82dd6ee8/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java b/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java
index a6e7591..e0f0657 100644
--- a/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java
+++ b/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java
@@ -27,7 +27,7 @@ import org.apache.wicket.pageStore.DiskDataStore;
import org.apache.wicket.pageStore.IDataStore;
import org.apache.wicket.pageStore.IPageStore;
import org.apache.wicket.serialize.ISerializer;
-import org.apache.wicket.settings.IStoreSettings;
+import org.apache.wicket.settings.def.StoreSettings;
import org.apache.wicket.util.lang.Bytes;
/**
@@ -53,7 +53,7 @@ public class DefaultPageManagerProvider implements IPageManagerProvider
{
IDataStore dataStore = newDataStore();
- IStoreSettings storeSettings = getStoreSettings();
+ StoreSettings storeSettings = getStoreSettings();
if (dataStore.canBeAsynchronous())
{
@@ -75,15 +75,15 @@ public class DefaultPageManagerProvider implements IPageManagerProvider
protected IDataStore newDataStore()
{
- IStoreSettings storeSettings = getStoreSettings();
+ StoreSettings storeSettings = getStoreSettings();
Bytes maxSizePerSession = storeSettings.getMaxSizePerSession();
File fileStoreFolder = storeSettings.getFileStoreFolder();
return new DiskDataStore(application.getName(), fileStoreFolder, maxSizePerSession);
}
- IStoreSettings getStoreSettings()
+ StoreSettings getStoreSettings()
{
return application.getStoreSettings();
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/82dd6ee8/wicket-core/src/main/java/org/apache/wicket/protocol/http/PageExpiredException.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/PageExpiredException.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/PageExpiredException.java
index 14fcc58..c85c49b 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/PageExpiredException.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/PageExpiredException.java
@@ -23,7 +23,6 @@ import javax.servlet.http.HttpSession;
import org.apache.wicket.Page;
import org.apache.wicket.WicketRuntimeException;
import org.apache.wicket.core.request.handler.IPageProvider;
-import org.apache.wicket.settings.IStoreSettings;
/**
* Thrown when a {@link Page} instance cannot be found by its id in the page stores. The page may be
@@ -38,7 +37,7 @@ import org.apache.wicket.settings.IStoreSettings;
* stacktrace it is not really needed.</p>
*
* @see HttpSession#setMaxInactiveInterval(int)
- * @see IStoreSettings#setMaxSizePerSession(org.apache.wicket.util.lang.Bytes)
+ * @see org.apache.wicket.settings.def.StoreSettings#setMaxSizePerSession(org.apache.wicket.util.lang.Bytes)
* @see NotSerializableException
* @see IPageProvider#getPageInstance()
*/
http://git-wip-us.apache.org/repos/asf/wicket/blob/82dd6ee8/wicket-core/src/main/java/org/apache/wicket/settings/IStoreSettings.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/IStoreSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/IStoreSettings.java
deleted file mode 100644
index ad2ac14..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/settings/IStoreSettings.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.settings;
-
-import java.io.File;
-
-import org.apache.wicket.page.IPageManager;
-import org.apache.wicket.pageStore.AsynchronousDataStore;
-import org.apache.wicket.pageStore.DiskDataStore;
-import org.apache.wicket.pageStore.IDataStore;
-import org.apache.wicket.pageStore.IPageStore;
-import org.apache.wicket.util.lang.Bytes;
-
-/**
- * An interface for settings related to the the storages where page instances are persisted -
- * {@link IPageStore}, {@link IDataStore} and {@link IPageManager}.
- * <p>
- * For more information about page storages read <a
- * href="https://cwiki.apache.org/confluence/x/qIaoAQ">Page Storage - Wiki page</a>
- * </p>
- *
- * @since 1.5
- */
-public interface IStoreSettings
-{
- /**
- * @return the number of page instances which will be stored in the application scoped cache for
- * faster retrieval
- */
- int getInmemoryCacheSize();
-
- /**
- * Sets the maximum number of page instances which will be stored in the application scoped
- * second level cache for faster retrieval
- *
- * @param inmemoryCacheSize
- * the maximum number of page instances which will be held in the application scoped
- * cache
- */
- void setInmemoryCacheSize(int inmemoryCacheSize);
-
- /**
- * @return maximum page size. After this size is exceeded, the {@link DiskDataStore} will start
- * saving the pages at the beginning of file.
- */
- Bytes getMaxSizePerSession();
-
- /**
- * Sets the maximum size of the {@link File} where page instances per session are stored. After
- * reaching this size the {@link DiskDataStore} will start overriding the oldest pages at the
- * beginning of the file.
- *
- * @param maxSizePerSession
- * the maximum size of the file where page instances are stored per session. In
- * bytes.
- */
- void setMaxSizePerSession(Bytes maxSizePerSession);
-
- /**
- * @return the location of the folder where {@link DiskDataStore} will store the files with page
- * instances per session
- */
- File getFileStoreFolder();
-
- /**
- * Sets the folder where {@link DiskDataStore} will store the files with page instances per
- * session
- *
- * @param fileStoreFolder
- * the new location
- */
- void setFileStoreFolder(File fileStoreFolder);
-
- /**
- * @return the capacity of the queue used to store the pages which will be stored asynchronously
- * @see AsynchronousDataStore
- */
- int getAsynchronousQueueCapacity();
-
- /**
- * Sets the capacity of the queue used to store the pages which will be stored asynchronously
- *
- * @param capacity
- * the capacity of the queue
- * @see AsynchronousDataStore
- */
- void setAsynchronousQueueCapacity(int capacity);
-
- /**
- * Sets a flag whether to wrap the configured {@link IDataStore} with
- * {@link AsynchronousDataStore}. By doing this the HTTP worker thread will not wait for the
- * actual write of the page's bytes into the wrapped {@link IDataStore}.
- *
- * @param async
- * {@code true} to make it asynchronous, {@code false} - otherwise
- */
- void setAsynchronous(boolean async);
-
- /**
- * @return {@code true} if the storing of page's bytes is asynchronous
- */
- boolean isAsynchronous();
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/82dd6ee8/wicket-core/src/main/java/org/apache/wicket/settings/def/StoreSettings.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/def/StoreSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/def/StoreSettings.java
index 897cad6..2269f98 100644
--- a/wicket-core/src/main/java/org/apache/wicket/settings/def/StoreSettings.java
+++ b/wicket-core/src/main/java/org/apache/wicket/settings/def/StoreSettings.java
@@ -22,14 +22,21 @@ import java.io.IOException;
import org.apache.wicket.Application;
import org.apache.wicket.WicketRuntimeException;
import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.settings.IStoreSettings;
import org.apache.wicket.util.lang.Args;
import org.apache.wicket.util.lang.Bytes;
/**
- * The implementation of {@link IStoreSettings}
+ * An interface for settings related to the the storages where page instances are persisted -
+ * {@link org.apache.wicket.pageStore.IPageStore},
+ * {@link org.apache.wicket.pageStore.IDataStore} and {@link org.apache.wicket.page.IPageManager}.
+ * <p>
+ * For more information about page storages read <a
+ * href="https://cwiki.apache.org/confluence/x/qIaoAQ">Page Storage - Wiki page</a>
+ * </p>
+ *
+ * @since 1.5
*/
-public class StoreSettings implements IStoreSettings
+public class StoreSettings
{
private static final int DEFAULT_CACHE_SIZE = 40;
@@ -56,31 +63,56 @@ public class StoreSettings implements IStoreSettings
{
}
- @Override
+ /**
+ * @return the number of page instances which will be stored in the application scoped cache for
+ * faster retrieval
+ */
public int getInmemoryCacheSize()
{
return inmemoryCacheSize;
}
- @Override
+ /**
+ * Sets the maximum number of page instances which will be stored in the application scoped
+ * second level cache for faster retrieval
+ *
+ * @param inmemoryCacheSize
+ * the maximum number of page instances which will be held in the application scoped
+ * cache
+ */
public void setInmemoryCacheSize(int inmemoryCacheSize)
{
this.inmemoryCacheSize = inmemoryCacheSize;
}
- @Override
+ /**
+ * @return maximum page size. After this size is exceeded,
+ * the {@link org.apache.wicket.pageStore.DiskDataStore} will start saving the
+ * pages at the beginning of file.
+ */
public Bytes getMaxSizePerSession()
{
return maxSizePerSession;
}
- @Override
+ /**
+ * Sets the maximum size of the {@link File} where page instances per session are stored. After
+ * reaching this size the {@link org.apache.wicket.pageStore.DiskDataStore} will start overriding the
+ * oldest pages at the beginning of the file.
+ *
+ * @param maxSizePerSession
+ * the maximum size of the file where page instances are stored per session. In
+ * bytes.
+ */
public void setMaxSizePerSession(final Bytes maxSizePerSession)
{
this.maxSizePerSession = Args.notNull(maxSizePerSession, "maxSizePerSession");
}
- @Override
+ /**
+ * @return the location of the folder where {@link org.apache.wicket.pageStore.DiskDataStore} will store the files with page
+ * instances per session
+ */
public File getFileStoreFolder()
{
if (fileStoreFolder == null)
@@ -108,19 +140,34 @@ public class StoreSettings implements IStoreSettings
return fileStoreFolder;
}
- @Override
+ /**
+ * Sets the folder where {@link org.apache.wicket.pageStore.DiskDataStore} will store the files with page instances per
+ * session
+ *
+ * @param fileStoreFolder
+ * the new location
+ */
public void setFileStoreFolder(final File fileStoreFolder)
{
this.fileStoreFolder = Args.notNull(fileStoreFolder, "fileStoreFolder");
}
- @Override
+ /**
+ * @return the capacity of the queue used to store the pages which will be stored asynchronously
+ * @see org.apache.wicket.pageStore.AsynchronousDataStore
+ */
public int getAsynchronousQueueCapacity()
{
return asynchronousQueueCapacity;
}
- @Override
+ /**
+ * Sets the capacity of the queue used to store the pages which will be stored asynchronously
+ *
+ * @param queueCapacity
+ * the capacity of the queue
+ * @see org.apache.wicket.pageStore.AsynchronousDataStore
+ */
public void setAsynchronousQueueCapacity(int queueCapacity)
{
if (queueCapacity < 1)
@@ -131,13 +178,22 @@ public class StoreSettings implements IStoreSettings
asynchronousQueueCapacity = queueCapacity;
}
- @Override
+ /**
+ * Sets a flag whether to wrap the configured {@link org.apache.wicket.pageStore.IDataStore} with
+ * {@link org.apache.wicket.pageStore.AsynchronousDataStore}. By doing this the HTTP worker thread will not wait for the
+ * actual write of the page's bytes into the wrapped {@link org.apache.wicket.pageStore.IDataStore}.
+ *
+ * @param async
+ * {@code true} to make it asynchronous, {@code false} - otherwise
+ */
public void setAsynchronous(boolean async)
{
isAsynchronous = async;
}
- @Override
+ /**
+ * @return {@code true} if the storing of page's bytes is asynchronous
+ */
public boolean isAsynchronous()
{
return isAsynchronous;
http://git-wip-us.apache.org/repos/asf/wicket/blob/82dd6ee8/wicket-core/src/test/java/org/apache/wicket/pageStore/DiskDataStoreTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/pageStore/DiskDataStoreTest.java b/wicket-core/src/test/java/org/apache/wicket/pageStore/DiskDataStoreTest.java
index e8fbc44..03283e5 100644
--- a/wicket-core/src/test/java/org/apache/wicket/pageStore/DiskDataStoreTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/pageStore/DiskDataStoreTest.java
@@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.wicket.settings.IStoreSettings;
import org.apache.wicket.settings.def.StoreSettings;
import org.apache.wicket.util.SlowTests;
import org.apache.wicket.util.lang.Bytes;
@@ -369,7 +368,7 @@ public class DiskDataStoreTest extends Assert
{
generateFiles();
- IStoreSettings storeSettings = new StoreSettings(null);
+ StoreSettings storeSettings = new StoreSettings(null);
java.io.File fileStoreFolder = storeSettings.getFileStoreFolder();
dataStore = new DiskDataStore("app1", fileStoreFolder, MAX_SIZE_PER_SESSION);
@@ -390,7 +389,7 @@ public class DiskDataStoreTest extends Assert
@Test
public void sessionFolderName()
{
- IStoreSettings storeSettings = new StoreSettings(null);
+ StoreSettings storeSettings = new StoreSettings(null);
java.io.File fileStoreFolder = storeSettings.getFileStoreFolder();
DiskDataStore store = new DiskDataStore("sessionFolderName", fileStoreFolder, MAX_SIZE_PER_SESSION);
http://git-wip-us.apache.org/repos/asf/wicket/blob/82dd6ee8/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugPageManagerProvider.java
----------------------------------------------------------------------
diff --git a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugPageManagerProvider.java b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugPageManagerProvider.java
index bc6fba0..e219ed5 100644
--- a/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugPageManagerProvider.java
+++ b/wicket-devutils/src/main/java/org/apache/wicket/devutils/diskstore/DebugPageManagerProvider.java
@@ -22,7 +22,7 @@ import org.apache.wicket.Application;
import org.apache.wicket.DefaultPageManagerProvider;
import org.apache.wicket.pageStore.DiskDataStore;
import org.apache.wicket.pageStore.IDataStore;
-import org.apache.wicket.settings.IStoreSettings;
+import org.apache.wicket.settings.def.StoreSettings;
import org.apache.wicket.util.lang.Bytes;
/**
@@ -53,7 +53,7 @@ public class DebugPageManagerProvider extends DefaultPageManagerProvider
@Override
protected IDataStore newDataStore()
{
- IStoreSettings storeSettings = application.getStoreSettings();
+ StoreSettings storeSettings = application.getStoreSettings();
File fileStoreFolder = storeSettings.getFileStoreFolder();
Bytes maxSizePerSession = storeSettings.getMaxSizePerSession();
dataStore = new DebugDiskDataStore(application.getName(), fileStoreFolder,
[4/4] git commit: WICKET-5410 Remove setting interfaces
Posted by mg...@apache.org.
WICKET-5410 Remove setting interfaces
Remove IRequestLoggerSettings interface
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/18fbdf44
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/18fbdf44
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/18fbdf44
Branch: refs/heads/master
Commit: 18fbdf44837d0908302005bc1a9e9a6dacd85acf
Parents: 1d79e37
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Nov 12 17:34:58 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Nov 13 09:50:41 2013 +0200
----------------------------------------------------------------------
.../java/org/apache/wicket/Application.java | 7 +--
.../protocol/http/AbstractRequestLogger.java | 3 +-
.../http/RequestLoggerRequestCycleListener.java | 4 +-
.../wicket/settings/IRequestLoggerSettings.java | 63 --------------------
.../settings/def/RequestLoggerSettings.java | 31 +++++-----
5 files changed, 22 insertions(+), 86 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/18fbdf44/wicket-core/src/main/java/org/apache/wicket/Application.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Application.java b/wicket-core/src/main/java/org/apache/wicket/Application.java
index 0359459..5835f14 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Application.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Application.java
@@ -85,7 +85,6 @@ import org.apache.wicket.session.DefaultPageFactory;
import org.apache.wicket.session.ISessionStore;
import org.apache.wicket.session.ISessionStore.UnboundListener;
import org.apache.wicket.settings.IMarkupSettings;
-import org.apache.wicket.settings.IRequestLoggerSettings;
import org.apache.wicket.settings.IResourceSettings;
import org.apache.wicket.settings.ISecuritySettings;
import org.apache.wicket.settings.IStoreSettings;
@@ -1039,7 +1038,7 @@ public abstract class Application implements UnboundListener, IEventSink
private RequestCycleSettings requestCycleSettings;
/** The Request Logger Settings */
- private IRequestLoggerSettings requestLoggerSettings;
+ private RequestLoggerSettings requestLoggerSettings;
/** The Resource Settings */
private IResourceSettings resourceSettings;
@@ -1235,7 +1234,7 @@ public abstract class Application implements UnboundListener, IEventSink
/**
* @return Application's request logger related settings
*/
- public final IRequestLoggerSettings getRequestLoggerSettings()
+ public final RequestLoggerSettings getRequestLoggerSettings()
{
checkSettingsAvailable();
if (requestLoggerSettings == null)
@@ -1249,7 +1248,7 @@ public abstract class Application implements UnboundListener, IEventSink
*
* @param requestLoggerSettings
*/
- public final void setRequestLoggerSettings(final IRequestLoggerSettings requestLoggerSettings)
+ public final void setRequestLoggerSettings(final RequestLoggerSettings requestLoggerSettings)
{
this.requestLoggerSettings = requestLoggerSettings;
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/18fbdf44/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java
index add5220..7583325 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java
@@ -31,7 +31,6 @@ import org.apache.wicket.MetaDataKey;
import org.apache.wicket.Session;
import org.apache.wicket.request.IRequestHandler;
import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.settings.IRequestLoggerSettings;
import org.apache.wicket.util.lang.Args;
import org.apache.wicket.util.time.Time;
import org.slf4j.Logger;
@@ -432,7 +431,7 @@ public abstract class AbstractRequestLogger implements IRequestLogger
/**
* Resizes the request buffer to match the
- * {@link IRequestLoggerSettings#getRequestsWindowSize() configured window size}
+ * {@link org.apache.wicket.settings.def.RequestLoggerSettings#getRequestsWindowSize() configured window size}
*/
private void resizeBuffer()
{
http://git-wip-us.apache.org/repos/asf/wicket/blob/18fbdf44/wicket-core/src/main/java/org/apache/wicket/protocol/http/RequestLoggerRequestCycleListener.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/RequestLoggerRequestCycleListener.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/RequestLoggerRequestCycleListener.java
index 5fbfa70..c822c3b 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/RequestLoggerRequestCycleListener.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/RequestLoggerRequestCycleListener.java
@@ -22,7 +22,7 @@ import org.apache.wicket.Application;
import org.apache.wicket.request.IRequestHandler;
import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.settings.IRequestLoggerSettings;
+import org.apache.wicket.settings.def.RequestLoggerSettings;
import org.apache.wicket.util.string.AppendingStringBuffer;
/**
@@ -88,7 +88,7 @@ public class RequestLoggerRequestCycleListener extends AbstractRequestCycleListe
private boolean isRequestLoggingEnabled()
{
IRequestLogger requestLogger = Application.get().getRequestLogger();
- IRequestLoggerSettings settings = Application.get().getRequestLoggerSettings();
+ RequestLoggerSettings settings = Application.get().getRequestLoggerSettings();
return requestLogger != null && settings.isRequestLoggerEnabled();
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/18fbdf44/wicket-core/src/main/java/org/apache/wicket/settings/IRequestLoggerSettings.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/IRequestLoggerSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/IRequestLoggerSettings.java
deleted file mode 100644
index 1a73baf..0000000
--- a/wicket-core/src/main/java/org/apache/wicket/settings/IRequestLoggerSettings.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.settings;
-
-/**
- * @author jcompagner
- */
-public interface IRequestLoggerSettings
-{
- /**
- * Enable/Disable the request logger.
- *
- * @param enable
- * boolean.
- */
- void setRequestLoggerEnabled(boolean enable);
-
-
- /**
- * @return true if the request Logger is enabled. (default false)
- */
- boolean isRequestLoggerEnabled();
-
- /**
- * Enable/Disable the recording of the session size for every request.
- *
- * @param record
- */
- void setRecordSessionSize(boolean record);
-
- /**
- * @return true if the session size is recorded. (default true)
- */
- boolean getRecordSessionSize();
-
- /**
- * Set the window of all the requests that is kept in memory for viewing. Default is 2000, You
- * can set this to 0 then only Sessions data is recorded (number of request, total time, latest
- * size)
- *
- * @param size
- */
- void setRequestsWindowSize(int size);
-
- /**
- * @return The window size of the recorded requests. (default 2000)
- */
- int getRequestsWindowSize();
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/18fbdf44/wicket-core/src/main/java/org/apache/wicket/settings/def/RequestLoggerSettings.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/def/RequestLoggerSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/def/RequestLoggerSettings.java
index 812063c..380479c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/settings/def/RequestLoggerSettings.java
+++ b/wicket-core/src/main/java/org/apache/wicket/settings/def/RequestLoggerSettings.java
@@ -16,8 +16,6 @@
*/
package org.apache.wicket.settings.def;
-import org.apache.wicket.settings.IRequestLoggerSettings;
-
/**
* @author Jonathan Locke
* @author Chris Turner
@@ -28,7 +26,7 @@ import org.apache.wicket.settings.IRequestLoggerSettings;
* @author Martijn Dashorst
* @author James Carman
*/
-public class RequestLoggerSettings implements IRequestLoggerSettings
+public class RequestLoggerSettings
{
private boolean recordSessionSize = true;
@@ -37,54 +35,57 @@ public class RequestLoggerSettings implements IRequestLoggerSettings
private boolean requestLoggerEnabled;
/**
- * @see org.apache.wicket.settings.IRequestLoggerSettings#getRecordSessionSize()
+ * @return true if the session size is recorded. (default true)
*/
- @Override
public boolean getRecordSessionSize()
{
return recordSessionSize;
}
/**
- * @see org.apache.wicket.settings.IRequestLoggerSettings#getRequestsWindowSize()
+ * @return The window size of the recorded requests. (default 2000)
*/
- @Override
public int getRequestsWindowSize()
{
return requestsWindowSize;
}
/**
- * @see org.apache.wicket.settings.IRequestLoggerSettings#isRequestLoggerEnabled()
+ * @return true if the request Logger is enabled. (default false)
*/
- @Override
public boolean isRequestLoggerEnabled()
{
return requestLoggerEnabled;
}
/**
- * @see org.apache.wicket.settings.IRequestLoggerSettings#setRecordSessionSize(boolean)
+ * Enable/Disable the recording of the session size for every request.
+ *
+ * @param record
*/
- @Override
public void setRecordSessionSize(boolean record)
{
recordSessionSize = record;
}
/**
- * @see org.apache.wicket.settings.IRequestLoggerSettings#setRequestLoggerEnabled(boolean)
+ * Enable/Disable the request logger.
+ *
+ * @param enable
+ * boolean.
*/
- @Override
public void setRequestLoggerEnabled(boolean enable)
{
requestLoggerEnabled = enable;
}
/**
- * @see org.apache.wicket.settings.IRequestLoggerSettings#setRequestsWindowSize(int)
+ * Set the window of all the requests that is kept in memory for viewing. Default is 2000, You
+ * can set this to 0 then only Sessions data is recorded (number of request, total time, latest
+ * size)
+ *
+ * @param size
*/
- @Override
public void setRequestsWindowSize(int size)
{
requestsWindowSize = size;