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:42 UTC

[2/4] git commit: WICKET-5410 Remove setting interfaces

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,