You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by al...@apache.org on 2007/08/22 15:02:26 UTC
svn commit: r568603 - in
/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket:
resource/PropertiesFactory.java settings/Settings.java
Author: almaw
Date: Wed Aug 22 06:02:26 2007
New Revision: 568603
URL: http://svn.apache.org/viewvc?rev=568603&view=rev
Log:
Make modification watcher work again.
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/Settings.java
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java?rev=568603&r1=568602&r2=568603&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java Wed Aug 22 06:02:26 2007
@@ -42,9 +42,8 @@
/**
* Default implementation of {@link IPropertiesFactory} which uses the
- * {@link IResourceStreamLocator} as defined by
- * {@link IResourceSettings#getResourceStreamLocator()} to load the
- * {@link Properties} objects. Depending on the settings, it will assign
+ * {@link IResourceStreamLocator} as defined by {@link IResourceSettings#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()
@@ -57,23 +56,25 @@
private static final Logger log = LoggerFactory.getLogger(PropertiesFactory.class);
/**
- * Listeners will be invoked after changes to property file have been
- * detected
+ * Listeners will be invoked after changes to property file have been detected
*/
private final List afterReloadListeners = new ArrayList();
/** Cache for all property files loaded */
private final Map propertiesCache = new ConcurrentHashMap();
- /** Resource Settings */
- private final IResourceSettings resourceSettings;
+ /** Application */
+ private final Application application;
/**
* Construct.
+ *
+ * @param application
+ * Application for this properties factory.
*/
- public PropertiesFactory()
+ public PropertiesFactory(Application application)
{
- resourceSettings = Application.get().getResourceSettings();
+ this.application = application;
}
/**
@@ -98,8 +99,7 @@
/**
*
- * @see org.apache.wicket.resource.IPropertiesFactory#load(java.lang.Class,
- * java.lang.String)
+ * @see org.apache.wicket.resource.IPropertiesFactory#load(java.lang.Class, java.lang.String)
*/
public Properties load(final Class clazz, final String path)
{
@@ -116,7 +116,7 @@
}
// If not in the cache than try to load the resource stream
- IResourceStream stream = Application.get().getResourceSettings().getResourceStreamLocator()
+ IResourceStream stream = application.getResourceSettings().getResourceStreamLocator()
.locate(clazz, path);
if (stream != null)
{
@@ -229,9 +229,8 @@
}
/**
- * Load properties file from an IResourceStream and add an
- * {@link IChangeListener}to the {@link ModificationWatcher} so that if the
- * resource changes, we can reload it automatically.
+ * Load properties file from an IResourceStream and add an {@link IChangeListener}to the
+ * {@link ModificationWatcher} so that if the resource changes, we can reload it automatically.
*
* @param key
* The key for the resource
@@ -243,14 +242,15 @@
final IResourceStream resourceStream)
{
// Watch file modifications
- final ModificationWatcher watcher = resourceSettings.getResourceWatcher(true);
+ final ModificationWatcher watcher = application.getResourceSettings().getResourceWatcher(
+ true);
if (watcher != null)
{
watcher.add(resourceStream, new IChangeListener()
{
public void onChange()
{
- log.info("A properties files has changed. Remove all entries " +
+ log.info("A properties files has changed. Removing all entries " +
"from the cache. Resource: " + resourceStream);
// Clear the whole cache as associated localized files may
@@ -258,7 +258,7 @@
clearCache();
// clear the localizer cache as well
- Application.get().getResourceSettings().getLocalizer().clearCache();
+ application.getResourceSettings().getLocalizer().clearCache();
// Inform all listeners
Iterator iter = afterReloadListeners.iterator();
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/Settings.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/Settings.java?rev=568603&r1=568602&r2=568603&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/Settings.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/settings/Settings.java Wed Aug 22 06:02:26 2007
@@ -66,8 +66,8 @@
/**
- * Contains settings exposed via IXXXSettings interfaces. It is not a good idea
- * to use this class directly, instead use the provided IXXXSettings interfaces.
+ * Contains settings exposed via IXXXSettings interfaces. It is not a good idea to use this class
+ * directly, instead use the provided IXXXSettings interfaces.
*
* @author Jonathan Locke
* @author Chris Turner
@@ -107,8 +107,7 @@
private boolean automaticLinking = false;
/**
- * Whether Wicket should try to support multiple windows transparently, true
- * by default.
+ * Whether Wicket should try to support multiple windows transparently, true by default.
*/
private boolean automaticMultiWindowSupport = true;
@@ -148,19 +147,17 @@
private boolean disableGZipCompression = false;
/**
- * 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.
+ * 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.
*/
private boolean enforceMounts = false;
/**
* Whether Wicket should try to get extensive client info by redirecting to
- * {@link BrowserInfoPage a page that polls for client capabilities}. This
- * method is used by the default implementation of {@link #newClientInfo()},
- * so if that method is overriden, there is no guarantee this method will be
- * taken into account. False by default.
+ * {@link BrowserInfoPage a page that polls for client capabilities}. This method is used by
+ * the default implementation of {@link #newClientInfo()}, so if that method is overriden,
+ * there is no guarantee this method will be taken into account. False by default.
*/
private boolean gatherExtendedBrowserInfo = false;
@@ -168,14 +165,12 @@
private WeakReference/* <Class<? extends Page> */internalErrorPage;
/**
- * whether wicket should track line precise additions of components for
- * error reporting.
+ * whether wicket should track line precise additions of components for error reporting.
*/
private boolean linePreciseReportingOnAddComponentEnabled = false;
/**
- * whether wicket should track line precise instantiations of components for
- * error reporting.
+ * whether wicket should track line precise instantiations of components for error reporting.
*/
private boolean linePreciseReportingOnNewComponentEnabled = false;
@@ -214,10 +209,9 @@
private org.apache.wicket.resource.IPropertiesFactory propertiesFactory;
/**
- * The render strategy, defaults to 'REDIRECT_TO_BUFFER'. This property
- * influences the default way in how a logical request that consists of an
- * 'action' and a 'render' part is handled, and is mainly used to have a
- * means to circumvent the 'refresh' problem.
+ * The render strategy, defaults to 'REDIRECT_TO_BUFFER'. This property influences the default
+ * way in how a logical request that consists of an 'action' and a 'render' part is handled, and
+ * is mainly used to have a means to circumvent the 'refresh' problem.
*/
private IRequestCycleSettings.RenderStrategy renderStrategy = REDIRECT_TO_BUFFER;
@@ -237,10 +231,9 @@
private List responseFilters;
/**
- * In order to do proper form parameter decoding it is important that the
- * response and the following request have the same encoding. see
- * http://www.crazysquirrel.com/computing/general/form-encoding.jspx for
- * additional information.
+ * In order to do proper form parameter decoding it is important that the response and the
+ * following request have the same encoding. see
+ * http://www.crazysquirrel.com/computing/general/form-encoding.jspx for additional information.
*/
private String responseRequestEncoding = "UTF-8";
@@ -251,8 +244,7 @@
private boolean stripComments = false;
/**
- * If true, wicket tags ( <wicket: ..>) and wicket:id attributes we be
- * removed from output
+ * If true, wicket tags ( <wicket: ..>) and wicket:id attributes we be removed from output
*/
private boolean stripWicketTags = false;
@@ -263,14 +255,14 @@
private boolean throwExceptionOnMissingResource = true;
/**
- * Whether the generated page id must be unique per session, or it's enough
- * if it is unique per page map;
+ * Whether the generated page id must be unique per session, or it's enough if it is unique per
+ * page map;
*/
private boolean pageIdUniquePerSession = false;
/**
- * The time that a request will by default be waiting for the previous
- * request to be handled before giving up. Defaults to one minute.
+ * The time that a request will by default be waiting for the previous request to be handled
+ * before giving up. Defaults to one minute.
*/
private Duration timeout = Duration.ONE_MINUTE;
@@ -278,12 +270,11 @@
private IUnauthorizedComponentInstantiationListener unauthorizedComponentInstantiationListener = new IUnauthorizedComponentInstantiationListener()
{
/**
- * Called when an unauthorized component instantiation is about to take
- * place (but before it happens).
+ * Called when an unauthorized component instantiation is about to take place (but before it
+ * happens).
*
* @param component
- * The partially constructed component (only the id is
- * guaranteed to be valid).
+ * The partially constructed component (only the id is guaranteed to be valid).
*/
public void onUnauthorizedInstantiation(final Component component)
{
@@ -307,20 +298,17 @@
private boolean requestLoggerEnabled;
/**
- * Whether the comments and whitespaces will be stripped from javascript
- * resources
+ * Whether the comments and whitespaces will be stripped from javascript resources
*/
private boolean stripJavascriptCommentsAndWhitespace;
/**
- * Whether the container's class name should be printed to response (in a
- * html comment).
+ * Whether the container's class name should be printed to response (in a html comment).
*/
private boolean outputMarkupContainerClassName = false;
/**
- * Create the application settings, carrying out any necessary
- * initialisations.
+ * Create the application settings, carrying out any necessary initialisations.
*
* @param application
* The application that these settings are for
@@ -624,7 +612,7 @@
{
if (propertiesFactory == null)
{
- propertiesFactory = new PropertiesFactory();
+ propertiesFactory = new PropertiesFactory(Application.get());
}
return propertiesFactory;
}
@@ -1175,8 +1163,7 @@
}
/**
- * Throws an IllegalArgumentException if the given class is not a subclass
- * of Page.
+ * Throws an IllegalArgumentException if the given class is not a subclass of Page.
*
* @param pageClass
* the page class to check