001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.wicket.resource; 018 019import java.io.IOException; 020import java.io.InputStream; 021 022import org.apache.wicket.util.io.Streams; 023import org.apache.wicket.util.value.ValueMap; 024 025/** 026 * Load properties from XML file 027 * 028 * @author Juergen Donnerstag 029 */ 030public class XmlFilePropertiesLoader implements IPropertiesLoader 031{ 032 private final String fileExtension; 033 034 /** 035 * Construct. 036 * 037 * @param fileExtension 038 */ 039 public XmlFilePropertiesLoader(final String fileExtension) 040 { 041 this.fileExtension = fileExtension; 042 } 043 044 /** 045 * @see org.apache.wicket.resource.IPropertiesLoader#getFileExtension() 046 */ 047 @Override 048 public final String getFileExtension() 049 { 050 return fileExtension; 051 } 052 053 /** 054 * @throws IOException 055 * @see org.apache.wicket.resource.IPropertiesLoader#loadJavaProperties(java.io.InputStream) 056 */ 057 @Override 058 public java.util.Properties loadJavaProperties(final InputStream in) throws IOException 059 { 060 java.util.Properties properties = new java.util.Properties(); 061 Streams.loadFromXml(properties, in); 062 return properties; 063 } 064 065 /** 066 * @see org.apache.wicket.resource.IPropertiesLoader#loadWicketProperties(java.io.InputStream) 067 */ 068 @Override 069 public ValueMap loadWicketProperties(InputStream inputStream) 070 { 071 return null; 072 } 073}