Author: remy.maucherat(a)jboss.com
Date: 2010-04-27 06:03:51 -0400 (Tue, 27 Apr 2010)
New Revision: 1453
Removed:
trunk/java/org/apache/catalina/startup/CatalinaProperties.java
trunk/java/org/apache/catalina/startup/catalina.properties
Modified:
trunk/java/org/apache/catalina/security/SecurityConfig.java
Log:
- Drop CatalinaProperties, system properties should be set by the embedding program.
Modified: trunk/java/org/apache/catalina/security/SecurityConfig.java
===================================================================
--- trunk/java/org/apache/catalina/security/SecurityConfig.java 2010-04-26 20:32:49 UTC
(rev 1452)
+++ trunk/java/org/apache/catalina/security/SecurityConfig.java 2010-04-27 10:03:51 UTC
(rev 1453)
@@ -17,7 +17,6 @@
package org.apache.catalina.security;
import java.security.Security;
-import org.apache.catalina.startup.CatalinaProperties;
/**
* Util class to protect Catalina against package access and insertion.
@@ -59,14 +58,8 @@
* Create a single instance of this class.
*/
private SecurityConfig(){
- try{
- packageDefinition =
CatalinaProperties.getProperty("package.definition");
- packageAccess = CatalinaProperties.getProperty("package.access");
- } catch (java.lang.Exception ex){
- if (log.isDebugEnabled()){
- log.debug("Unable to load properties using CatalinaProperties",
ex);
- }
- }
+ packageDefinition = System.getProperty("package.definition");
+ packageAccess = System.getProperty("package.access");
}
Deleted: trunk/java/org/apache/catalina/startup/CatalinaProperties.java
===================================================================
--- trunk/java/org/apache/catalina/startup/CatalinaProperties.java 2010-04-26 20:32:49 UTC
(rev 1452)
+++ trunk/java/org/apache/catalina/startup/CatalinaProperties.java 2010-04-27 10:03:51 UTC
(rev 1453)
@@ -1,180 +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.catalina.startup;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Properties;
-
-
-/**
- * Utility class to read the bootstrap Catalina configuration.
- *
- * @author Remy Maucherat
- * @version $Revision$ $Date$
- */
-
-public class CatalinaProperties {
-
-
- // ------------------------------------------------------- Static Variables
-
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( CatalinaProperties.class );
-
- private static Properties properties = null;
-
-
- static {
-
- loadProperties();
-
- }
-
-
- // --------------------------------------------------------- Public Methods
-
-
- /**
- * Return specified property value.
- */
- public static String getProperty(String name) {
-
- return properties.getProperty(name);
-
- }
-
-
- /**
- * Return specified property value.
- */
- public static String getProperty(String name, String defaultValue) {
-
- return properties.getProperty(name, defaultValue);
-
- }
-
-
- // --------------------------------------------------------- Public Methods
-
-
- /**
- * Load properties.
- */
- private static void loadProperties() {
-
- InputStream is = null;
- Throwable error = null;
-
- try {
- String configUrl = getConfigUrl();
- if (configUrl != null) {
- is = (new URL(configUrl)).openStream();
- }
- } catch (Throwable t) {
- // Ignore
- }
-
- if (is == null) {
- try {
- File home = new File(getCatalinaBase());
- File conf = new File(home, "conf");
- File properties = new File(conf, "catalina.properties");
- is = new FileInputStream(properties);
- } catch (Throwable t) {
- // Ignore
- }
- }
-
- if (is == null) {
- try {
- is =
CatalinaProperties.class.getResourceAsStream("catalina.properties");
- } catch (Throwable t) {
- // Ignore
- }
- }
-
- if (is == null) {
- try {
- is = CatalinaProperties.class.getResourceAsStream
- ("/org/apache/catalina/startup/catalina.properties");
- } catch (Throwable t) {
- // Ignore
- }
- }
-
- if (is != null) {
- try {
- properties = new Properties();
- properties.load(is);
- is.close();
- } catch (Throwable t) {
- error = t;
- }
- }
-
- if ((is == null) || (error != null)) {
- // Do something
- log.warn("Failed to load catalina.properties", error);
- // That's fine - we have reasonable defaults.
- properties=new Properties();
- }
-
- // Register the properties as system properties
- Enumeration enumeration = properties.propertyNames();
- while (enumeration.hasMoreElements()) {
- String name = (String) enumeration.nextElement();
- String value = properties.getProperty(name);
- if (value != null && (System.getProperty(name) == null)) {
- System.setProperty(name, value);
- }
- }
-
- }
-
-
- /**
- * Get the value of the catalina.home environment variable.
- */
- private static String getCatalinaHome() {
- return System.getProperty("catalina.home",
- System.getProperty("user.dir"));
- }
-
-
- /**
- * Get the value of the catalina.base environment variable.
- */
- private static String getCatalinaBase() {
- return System.getProperty("catalina.base", getCatalinaHome());
- }
-
-
- /**
- * Get the value of the configuration URL.
- */
- private static String getConfigUrl() {
- return System.getProperty("catalina.config");
- }
-
-
-}
Deleted: trunk/java/org/apache/catalina/startup/catalina.properties
===================================================================