Author: jdonnerstag
Date: Sun Oct 25 14:56:25 2009
New Revision: 829593

URL: http://svn.apache.org/viewvc?rev=829593&view=rev
Log:
issue: Add ability to load UTF-8 encoded properties not in XML format.

I made the properties loaders a first call objects and restructured it a bit. 
Its now very easy to create your own properties loader and add it to properties 
factory. 

By default 3 loaders are added: 
- java iso 8859-1 via java.utils.Properties#load(InputStream) attached to 
"*.properties" files
- xml attached to "*.xml" files
- via java.util.Properties#load(Reader) a loader with configurable charset. A 
utf-8 loader attached to "*.utf8.properties" is added by default. Since it is 
based on java 6 features, it'll return null for older java versions.
Issue: WICKET-2451

Added:
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/IPropertiesLoader.java
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/IsoPropertiesFilePropertiesLoader.java
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/UtfPropertiesFilePropertiesLoader.java
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/XmlFilePropertiesLoader.java
Modified:
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/XmlPageTest.java
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/loader/ComponentStringResourceLoaderTest.java

Added: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/IPropertiesLoader.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/IPropertiesLoader.java?rev=829593&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/IPropertiesLoader.java
 (added)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/IPropertiesLoader.java
 Sun Oct 25 14:56:25 2009
@@ -0,0 +1,53 @@
+/*
+ * 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.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.wicket.util.value.ValueMap;
+
+
+/**
+ * Property loaders as used by PropertiesFactory to load properties
+ * 
+ * @author Juergen Donnerstag
+ */
+public interface IPropertiesLoader
+{
+       /**
+        * Load the properties into a ValueMap.
+        * 
+        * @param inputStream
+        * @return Properties. Null if not applicable or not found or ...
+        */
+       ValueMap loadWicketProperties(final InputStream inputStream);
+
+       /**
+        * Load the properties into a java.util.Properties object
+        * 
+        * @param inputStream
+        * @return Properties. Null if not applicable or not found or ...
+        * @throws IOException
+        */
+       java.util.Properties loadJavaProperties(final InputStream inputStream) 
throws IOException;
+
+       /**
+        * @return The file extension this loader should be applied to
+        */
+       String getFileExtension();
+}
\ No newline at end of file

Added: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/IsoPropertiesFilePropertiesLoader.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/IsoPropertiesFilePropertiesLoader.java?rev=829593&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/IsoPropertiesFilePropertiesLoader.java
 (added)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/IsoPropertiesFilePropertiesLoader.java
 Sun Oct 25 14:56:25 2009
@@ -0,0 +1,70 @@
+/*
+ * 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.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.wicket.util.value.ValueMap;
+
+/**
+ * Load properties from properties file. The encoding of the file must be ISO 
8859-1.
+ * 
+ * @see java.util.Properties
+ * 
+ * @author Juergen Donnerstag
+ */
+public class IsoPropertiesFilePropertiesLoader implements IPropertiesLoader
+{
+       private final String extension;
+
+       /**
+        * Construct.
+        * 
+        * @param extension
+        */
+       public IsoPropertiesFilePropertiesLoader(final String extension)
+       {
+               this.extension = extension;
+       }
+
+       /**
+        * @see org.apache.wicket.resource.IPropertiesLoader#getFileExtension()
+        */
+       public final String getFileExtension()
+       {
+               return extension;
+       }
+
+       /**
+        * @see 
org.apache.wicket.resource.IPropertiesLoader#loadJavaProperties(java.io.InputStream)
+        */
+       public java.util.Properties loadJavaProperties(final InputStream in) 
throws IOException
+       {
+               java.util.Properties properties = new java.util.Properties();
+               properties.load(in);
+               return properties;
+       }
+
+       /**
+        * @see 
org.apache.wicket.resource.IPropertiesLoader#loadWicketProperties(java.io.InputStream)
+        */
+       public ValueMap loadWicketProperties(InputStream inputStream)
+       {
+               return null;
+       }
+}
\ No newline at end of file

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java?rev=829593&r1=829592&r2=829593&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java
 Sun Oct 25 14:56:25 2009
@@ -27,7 +27,6 @@
 
 import org.apache.wicket.Application;
 import org.apache.wicket.settings.IResourceSettings;
-import org.apache.wicket.util.io.Streams;
 import org.apache.wicket.util.listener.IChangeListener;
 import org.apache.wicket.util.resource.IResourceStream;
 import org.apache.wicket.util.resource.ResourceStreamNotFoundException;
@@ -60,7 +59,7 @@
        /** Cache for all property files loaded */
        private final Map<String, Properties> propertiesCache = new 
ConcurrentHashMap<String, Properties>();
 
-       /** Application */
+       /** This is necessary since the ModificationWatcher runs in a separate 
thread */
        private final Application application;
 
        /** List of Properties Loader */
@@ -72,12 +71,13 @@
         * @param application
         *            Application for this properties factory.
         */
-       public PropertiesFactory(Application application)
+       public PropertiesFactory(final Application application)
        {
                this.application = application;
 
                propertiesLoader = new ArrayList<IPropertiesLoader>();
-               propertiesLoader.add(new PropertiesFilePropertiesLoader());
+               propertiesLoader.add(new 
IsoPropertiesFilePropertiesLoader("properties"));
+               propertiesLoader.add(new 
UtfPropertiesFilePropertiesLoader("utf8.properties", "utf-8"));
                propertiesLoader.add(new XmlFilePropertiesLoader("xml"));
        }
 
@@ -123,14 +123,37 @@
        {
                // Check the cache
                Properties properties = propertiesCache.get(path);
-
                if (properties == null)
                {
+                       IResourceSettings resourceSettings = 
Application.get().getResourceSettings();
+
                        Iterator<IPropertiesLoader> iter = 
propertiesLoader.iterator();
                        while ((properties == null) && iter.hasNext())
                        {
                                IPropertiesLoader loader = iter.next();
-                               properties = loader.load(clazz, path);
+                               String fullPath = path + 
loader.getFileExtension();
+
+                               // If not in the cache than try to load 
properties
+                               final IResourceStream resourceStream = 
resourceSettings.getResourceStreamLocator()
+                                       .locate(clazz, fullPath);
+
+                               if (resourceStream == null)
+                               {
+                                       continue;
+                               }
+
+                               // Watch file modifications
+                               final IModificationWatcher watcher = 
resourceSettings.getResourceWatcher(true);
+                               if (watcher != null)
+                               {
+                                       addToWatcher(path, resourceStream, 
watcher);
+                               }
+
+                               ValueMap props = loadFromLoader(loader, 
resourceStream);
+                               if (props != null)
+                               {
+                                       properties = new Properties(path, 
props);
+                               }
                        }
 
                        // Cache the lookup
@@ -155,235 +178,125 @@
        }
 
        /**
-        * For subclasses to get access to the cache
         * 
-        * @return Map
+        * @param loader
+        * @param resourceStream
+        * @return properties
         */
-       protected final Map<String, Properties> getCache()
+       private ValueMap loadFromLoader(final IPropertiesLoader loader,
+               final IResourceStream resourceStream)
        {
-               return propertiesCache;
-       }
-
-       /**
-        * 
-        */
-       public interface IPropertiesLoader
-       {
-               /**
-                * 
-                * @param clazz
-                * @param path
-                * @return Properties
-                */
-               Properties load(final Class<?> clazz, final String path);
-       }
-
-       /**
-        * 
-        */
-       public abstract class AbstractPropertiesLoader implements 
IPropertiesLoader
-       {
-               /**
-                * Construct.
-                */
-               public AbstractPropertiesLoader()
+               if (log.isInfoEnabled())
                {
+                       log.info("Loading properties files from " + 
resourceStream + " with loader " + loader);
                }
 
-               /**
-                * 
-                * @return File extension
-                */
-               abstract protected String getFileExtension();
-
-               /**
-                * 
-                * @param in
-                * @return java.util.Properties
-                * @throws IOException
-                */
-               abstract protected java.util.Properties 
loadProperties(BufferedInputStream in)
-                       throws IOException;
-
-               /**
-                * 
-                * @see 
org.apache.wicket.resource.PropertiesFactory.IPropertiesLoader#load(java.lang.Class,
-                *      java.lang.String)
-                */
-               public Properties load(final Class<?> clazz, final String path)
-               {
-                       String fullPath = path + getFileExtension();
+               BufferedInputStream in = null;
 
-                       // If not in the cache than try to load properties
-                       final IResourceStream resourceStream = 
application.getResourceSettings()
-                               .getResourceStreamLocator()
-                               .locate(clazz, fullPath);
-
-                       if (resourceStream == null)
-                       {
-                               return null;
-                       }
-
-                       // Watch file modifications
-                       final IModificationWatcher watcher = 
application.getResourceSettings()
-                               .getResourceWatcher(true);
-                       if (watcher != null)
+               try
+               {
+                       // Get the InputStream
+                       in = new 
BufferedInputStream(resourceStream.getInputStream());
+                       ValueMap data = loader.loadWicketProperties(in);
+                       if (data == null)
                        {
-                               watcher.add(resourceStream, new 
IChangeListener()
+                               java.util.Properties props = 
loader.loadJavaProperties(in);
+                               if (props != null)
                                {
-                                       public void onChange()
+                                       // Copy the properties into the ValueMap
+                                       data = new ValueMap();
+                                       Enumeration<?> enumeration = 
props.propertyNames();
+                                       while (enumeration.hasMoreElements())
                                        {
-                                               log.info("A properties files 
has changed. Removing all entries " +
-                                                       "from the cache. 
Resource: " + resourceStream);
-
-                                               // Clear the whole cache as 
associated localized files may
-                                               // be affected and may need 
reloading as well.
-                                               clearCache();
-
-                                               // Inform all listeners
-                                               
Iterator<IPropertiesChangeListener> iter = afterReloadListeners.iterator();
-                                               while (iter.hasNext())
-                                               {
-                                                       
IPropertiesChangeListener listener = iter.next();
-                                                       try
-                                                       {
-                                                               
listener.propertiesChanged(path);
-                                                       }
-                                                       catch (Throwable ex)
-                                                       {
-                                                               
log.error("PropertiesReloadListener has thrown an exception: " +
-                                                                       
ex.getMessage());
-                                                       }
-                                               }
+                                               String property = 
(String)enumeration.nextElement();
+                                               data.put(property, 
props.getProperty(property));
                                        }
-                               });
+                               }
                        }
-
-                       log.info("Loading properties files from " + 
resourceStream);
-                       ValueMap strings = null;
-
-                       try
+                       return data;
+               }
+               catch (ResourceStreamNotFoundException e)
+               {
+                       log.warn("Unable to find resource " + resourceStream, 
e);
+               }
+               catch (IOException e)
+               {
+                       log.warn("Unable to find resource " + resourceStream, 
e);
+               }
+               finally
+               {
+                       if (in != null)
                        {
-                               BufferedInputStream in = null;
-
                                try
                                {
-                                       // Get the InputStream
-                                       in = new 
BufferedInputStream(resourceStream.getInputStream());
-
-                                       java.util.Properties properties = 
loadProperties(in);
-
-                                       // Copy the properties into the ValueMap
-                                       strings = new ValueMap();
-                                       Enumeration<?> enumeration = 
properties.propertyNames();
-                                       while (enumeration.hasMoreElements())
-                                       {
-                                               String property = 
(String)enumeration.nextElement();
-                                               strings.put(property, 
properties.getProperty(property));
-                                       }
-
-                                       return new Properties(path, strings);
+                                       in.close();
                                }
-                               finally
+                               catch (IOException ex)
                                {
-                                       if (in != null)
-                                       {
-                                               in.close();
-                                       }
-                                       resourceStream.close();
+                                       // ignore
                                }
                        }
-                       catch (ResourceStreamNotFoundException e)
+
+                       try
                        {
-                               log.warn("Unable to find resource " + 
resourceStream, e);
-                               strings = ValueMap.EMPTY_MAP;
+                               resourceStream.close();
                        }
-                       catch (IOException e)
+                       catch (IOException ex)
                        {
-                               log.warn("Unable to access resource " + 
resourceStream, e);
-                               strings = ValueMap.EMPTY_MAP;
+                               // ignore
                        }
-
-                       return null;
                }
+
+               return null;
        }
 
        /**
+        * Add the resource stream to the file being watched
         * 
+        * @param path
+        * @param resourceStream
+        * @param watcher
         */
-       public class PropertiesFilePropertiesLoader extends 
AbstractPropertiesLoader
+       private void addToWatcher(final String path, final IResourceStream 
resourceStream,
+               final IModificationWatcher watcher)
        {
-               /**
-                * Construct.
-                */
-               public PropertiesFilePropertiesLoader()
+               watcher.add(resourceStream, new IChangeListener()
                {
-               }
-
-               /**
-                * 
-                * @see 
org.apache.wicket.resource.PropertiesFactory.AbstractPropertiesLoader#getFileExtension()
-                */
-               @Override
-               protected String getFileExtension()
-               {
-                       return "properties";
-               }
+                       public void onChange()
+                       {
+                               log.info("A properties files has changed. 
Removing all entries " +
+                                       "from the cache. Resource: " + 
resourceStream);
 
-               /**
-                * 
-                * @param in
-                * @return java.util.Properties
-                * @throws IOException
-                */
-               @Override
-               protected java.util.Properties 
loadProperties(BufferedInputStream in) throws IOException
-               {
-                       java.util.Properties properties = new 
java.util.Properties();
-                       properties.load(in);
-                       return properties;
-               }
+                               // Clear the whole cache as associated 
localized files may
+                               // be affected and may need reloading as well.
+                               clearCache();
+
+                               // Inform all listeners
+                               Iterator<IPropertiesChangeListener> iter = 
afterReloadListeners.iterator();
+                               while (iter.hasNext())
+                               {
+                                       IPropertiesChangeListener listener = 
iter.next();
+                                       try
+                                       {
+                                               
listener.propertiesChanged(path);
+                                       }
+                                       catch (Throwable ex)
+                                       {
+                                               
PropertiesFactory.log.error("PropertiesReloadListener has thrown an exception: 
" +
+                                                       ex.getMessage());
+                                       }
+                               }
+                       }
+               });
        }
 
        /**
+        * For subclasses to get access to the cache
         * 
+        * @return Map
         */
-       public class XmlFilePropertiesLoader extends AbstractPropertiesLoader
+       protected final Map<String, Properties> getCache()
        {
-               private final String fileExtension;
-
-               /**
-                * Construct.
-                * 
-                * @param fileExtension
-                */
-               public XmlFilePropertiesLoader(final String fileExtension)
-               {
-                       this.fileExtension = fileExtension;
-               }
-
-               /**
-                * 
-                * @see 
org.apache.wicket.resource.PropertiesFactory.AbstractPropertiesLoader#getFileExtension()
-                */
-               @Override
-               protected String getFileExtension()
-               {
-                       return fileExtension;
-               }
-
-               /**
-                * 
-                * @param in
-                * @return java.util.Properties
-                * @throws IOException
-                */
-               @Override
-               protected java.util.Properties 
loadProperties(BufferedInputStream in) throws IOException
-               {
-                       java.util.Properties properties = new 
java.util.Properties();
-                       Streams.loadFromXml(properties, in);
-                       return properties;
-               }
+               return propertiesCache;
        }
 }
\ No newline at end of file

Added: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/UtfPropertiesFilePropertiesLoader.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/UtfPropertiesFilePropertiesLoader.java?rev=829593&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/UtfPropertiesFilePropertiesLoader.java
 (added)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/UtfPropertiesFilePropertiesLoader.java
 Sun Oct 25 14:56:25 2009
@@ -0,0 +1,114 @@
+/*
+ * 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.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.wicket.util.value.ValueMap;
+
+/**
+ * Load properties from properties file via a Reader, which allows to provide 
the charset and thus
+ * the encoding can be different than ISO 8859-1.
+ * 
+ * The implementation depends on the Java 6 Properties implementation and is 
disable if the
+ * reflection cannot find the method load(Reader).
+ * 
+ * @author Juergen Donnerstag
+ */
+public class UtfPropertiesFilePropertiesLoader implements IPropertiesLoader
+{
+       private final String fileExtension;
+
+       private final String encoding;
+
+       private Method load;
+
+       /**
+        * Construct.
+        * 
+        * @param fileExtension
+        * @param encoding
+        */
+       public UtfPropertiesFilePropertiesLoader(final String fileExtension, 
final String encoding)
+       {
+               this.fileExtension = fileExtension;
+               this.encoding = encoding;
+
+               try
+               {
+                       load = java.util.Properties.class.getMethod("load", new 
Class[] { Reader.class });
+               }
+               catch (NoSuchMethodException ex)
+               {
+                       load = null;
+               }
+       }
+
+       /**
+        * @see org.apache.wicket.resource.IPropertiesLoader#getFileExtension()
+        */
+       public final String getFileExtension()
+       {
+               return fileExtension;
+       }
+
+       /**
+        * @see 
org.apache.wicket.resource.IPropertiesLoader#loadJavaProperties(java.io.InputStream)
+        */
+       public java.util.Properties loadJavaProperties(final InputStream in) 
throws IOException
+       {
+               if (load == null)
+               {
+                       return null;
+               }
+
+               java.util.Properties properties = new java.util.Properties();
+               Reader reader = new InputStreamReader(in, encoding);
+
+               try
+               {
+                       load.invoke(properties, new Object[] { reader });
+               }
+               catch (IllegalArgumentException ex)
+               {
+                       properties = null;
+               }
+               catch (IllegalAccessException ex)
+               {
+                       properties = null;
+               }
+               catch (InvocationTargetException ex)
+               {
+                       properties = null;
+               }
+
+               return properties;
+       }
+
+       /**
+        * @see 
org.apache.wicket.resource.IPropertiesLoader#loadWicketProperties(java.io.InputStream)
+        */
+       public ValueMap loadWicketProperties(InputStream inputStream)
+       {
+               return null;
+       }
+}
\ No newline at end of file

Added: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/XmlFilePropertiesLoader.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/XmlFilePropertiesLoader.java?rev=829593&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/XmlFilePropertiesLoader.java
 (added)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/XmlFilePropertiesLoader.java
 Sun Oct 25 14:56:25 2009
@@ -0,0 +1,70 @@
+/*
+ * 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.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.wicket.util.io.Streams;
+import org.apache.wicket.util.value.ValueMap;
+
+/**
+ * Load properties from XML file
+ * 
+ * @author Juergen Donnerstag
+ */
+public class XmlFilePropertiesLoader implements IPropertiesLoader
+{
+       private final String fileExtension;
+
+       /**
+        * Construct.
+        * 
+        * @param fileExtension
+        */
+       public XmlFilePropertiesLoader(final String fileExtension)
+       {
+               this.fileExtension = fileExtension;
+       }
+
+       /**
+        * @see org.apache.wicket.resource.IPropertiesLoader#getFileExtension()
+        */
+       public final String getFileExtension()
+       {
+               return fileExtension;
+       }
+
+       /**
+        * @throws IOException
+        * @see 
org.apache.wicket.resource.IPropertiesLoader#loadJavaProperties(java.io.InputStream)
+        */
+       public java.util.Properties loadJavaProperties(final InputStream in) 
throws IOException
+       {
+               java.util.Properties properties = new java.util.Properties();
+               Streams.loadFromXml(properties, in);
+               return properties;
+       }
+
+       /**
+        * @see 
org.apache.wicket.resource.IPropertiesLoader#loadWicketProperties(java.io.InputStream)
+        */
+       public ValueMap loadWicketProperties(InputStream inputStream)
+       {
+               return null;
+       }
+}
\ No newline at end of file

Modified: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/XmlPageTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/XmlPageTest.java?rev=829593&r1=829592&r2=829593&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/XmlPageTest.java
 (original)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/XmlPageTest.java
 Sun Oct 25 14:56:25 2009
@@ -19,7 +19,9 @@
 import org.apache.wicket.Application;
 import org.apache.wicket.WicketTestCase;
 import org.apache.wicket.resource.IPropertiesFactory;
+import org.apache.wicket.resource.IsoPropertiesFilePropertiesLoader;
 import org.apache.wicket.resource.PropertiesFactory;
+import org.apache.wicket.resource.XmlFilePropertiesLoader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -88,7 +90,7 @@
                        super(application);
 
                        getPropertiesLoaders().clear();
-                       getPropertiesLoaders().add(new 
PropertiesFilePropertiesLoader());
+                       getPropertiesLoaders().add(new 
IsoPropertiesFilePropertiesLoader("properties"));
                        getPropertiesLoaders().add(new 
XmlFilePropertiesLoader("xmlProperties"));
                }
        }

Modified: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/loader/ComponentStringResourceLoaderTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/loader/ComponentStringResourceLoaderTest.java?rev=829593&r1=829592&r2=829593&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/loader/ComponentStringResourceLoaderTest.java
 (original)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/loader/ComponentStringResourceLoaderTest.java
 Sun Oct 25 14:56:25 2009
@@ -20,6 +20,7 @@
 import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.WicketTestCase;
 import org.apache.wicket.resource.IPropertiesFactory;
+import org.apache.wicket.resource.IsoPropertiesFilePropertiesLoader;
 import org.apache.wicket.resource.PropertiesFactory;
 
 /**
@@ -81,7 +82,7 @@
                        super(application);
 
                        getPropertiesLoaders().clear();
-                       getPropertiesLoaders().add(new 
PropertiesFilePropertiesLoader());
+                       getPropertiesLoaders().add(new 
IsoPropertiesFilePropertiesLoader("properties"));
                }
        }
 }


Reply via email to