r2119 - trunk/nuiton-utils/src/main/java/org/nuiton/util
Author: echatellier Date: 2011-04-28 11:41:53 +0200 (Thu, 28 Apr 2011) New Revision: 2119 Url: http://nuiton.org/repositories/revision/nuiton-utils/2119 Log: Remove deprecated method getConfigProperties() Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java =================================================================== --- trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java 2011-04-26 17:03:12 UTC (rev 2118) +++ trunk/nuiton-utils/src/main/java/org/nuiton/util/Resource.java 2011-04-28 09:41:53 UTC (rev 2119) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2004 - 2010 CodeLutin + * Copyright (C) 2004 - 2011 CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,18 +23,6 @@ * #L% */ -/** - * Resource.java - * - * Created: Sun Apr 14 2002 - * - * @author POUSSIN Benjamin <bpoussin@free.fr> - * Copyright Code Lutin - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : */ - package org.nuiton.util; import org.apache.commons.logging.Log; @@ -111,7 +99,6 @@ method.invoke(classLoader, url); } catch (Exception eee) { throw new RuntimeException(_("nuitonutil.error.add.url.in.classloader", classLoader, eee)); - //throw new RuntimeException("Can't add url in classloader " + classLoader,eee); } } @@ -182,84 +169,6 @@ } /** - * Recherche et retourne l'objet properties de configuration à utiliser. - * <p/> - * Les différents fichiers trouvé sont chainé. L'ordre de recherche est le - * classpath, le fichier dans /etc et enfin le chemin sur le filesystem. - * - * @param filename le nom du fichier à rechercher - * @return l'objet Properties de configuration - * @throws IOException si une erreur est survenue - * @deprecated since 1.1.2, use {@link ApplicationConfig} class instead - * to {@link ApplicationConfig#setConfigFileName(String) } - * and search properties file from more folders with - * {@link ApplicationConfig#parse(String[]) } method - */ - @Deprecated - static public Properties getConfigProperties(String filename) - throws IOException { - Properties result; - result = getConfigProperties(filename, null); - return result; - } - - /** - * Recherche et retourne l'objet properties de configuration à utiliser. - * <p/> - * Les différents fichiers trouvé sont chainé. L'ordre de recherche est le - * classpath, le fichier dans /etc et enfin le chemin sur le filesystem. - * - * @param filename le nom du fichier à rechercher - * @param parent les proprietes parent a surcharger - * @return l'objet Properties de configuration - * @throws IOException si une erreur est survenue - * @deprecated since 1.1.2, use {@link ApplicationConfig} class instead - * to {@link ApplicationConfig#setConfigFileName(String) } - * and search properties file from more folders with - * {@link ApplicationConfig#parse(String[]) } method - */ - @Deprecated - static public Properties getConfigProperties(String filename, - Properties parent) throws IOException { - Properties result; - if (parent != null) { - result = new Properties(parent); - } else { - result = new Properties(); - } - - URL inClasspath = ClassLoader.getSystemClassLoader().getResource( - filename); - if (inClasspath == null) { - inClasspath = Resource.class.getResource(filename); - } - if (inClasspath == null) { - inClasspath = getURLOrNull(filename); - } - if (inClasspath != null) { - log.info("Chargement du fichier de config: " + inClasspath); - result.load(inClasspath.openStream()); - result = new Properties(result); - } - - File etcConfig = new File("/etc/" + filename); - if (etcConfig.exists()) { - log.info("Chargement du fichier de config: " + etcConfig); - result.load(etcConfig.toURI().toURL().openStream()); - result = new Properties(result); - } - - File config = new File(filename); - if (config.exists()) { - log.info("Chargement du fichier de config: " + config); - result.load(config.toURI().toURL().openStream()); - result = new Properties(result); - } - - return result; - } - - /** * Retourner la liste des fichiers du classLoader. Ces fichiers doivent * correspondre au pattern donne. *
participants (1)
-
echatellier@users.nuiton.org