| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| org.apache.jcs.utils.config.IUtilConstants$1 |
|
|
| 1 | package org.apache.jcs.utils.config; |
|
| 2 | ||
| 3 | /* |
|
| 4 | * Licensed to the Apache Software Foundation (ASF) under one |
|
| 5 | * or more contributor license agreements. See the NOTICE file |
|
| 6 | * distributed with this work for additional information |
|
| 7 | * regarding copyright ownership. The ASF licenses this file |
|
| 8 | * to you under the Apache License, Version 2.0 (the |
|
| 9 | * "License"); you may not use this file except in compliance |
|
| 10 | * with the License. You may obtain a copy of the License at |
|
| 11 | * |
|
| 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 13 | * |
|
| 14 | * Unless required by applicable law or agreed to in writing, |
|
| 15 | * software distributed under the License is distributed on an |
|
| 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
| 17 | * KIND, either express or implied. See the License for the |
|
| 18 | * specific language governing permissions and limitations |
|
| 19 | * under the License. |
|
| 20 | */ |
|
| 21 | ||
| 22 | import java.io.IOException; |
|
| 23 | import java.io.InputStream; |
|
| 24 | import java.util.Properties; |
|
| 25 | ||
| 26 | import org.apache.commons.logging.Log; |
|
| 27 | import org.apache.commons.logging.LogFactory; |
|
| 28 | ||
| 29 | /** |
|
| 30 | * This can hold some constants used by various utilities. We should probably |
|
| 31 | * just get rid of this. |
|
| 32 | * <p> |
|
| 33 | * It loads properties from jcsutil.properties on initialization. |
|
| 34 | */ |
|
| 35 | public interface IUtilConstants |
|
| 36 | { |
|
| 37 | /** Description of the Field */ |
|
| 38 | public final static String ADMIN_USERID = Config.ADMIN_USERID; |
|
| 39 | ||
| 40 | /** Description of the Field */ |
|
| 41 | public final static String ADMIN_PASSWORD = Config.ADMIN_PASSWORD; |
|
| 42 | ||
| 43 | /** |
|
| 44 | * Description of the Class |
|
| 45 | */ |
|
| 46 | final static class Config |
|
| 47 | { |
|
| 48 | 0 | private final static Log log = LogFactory.getLog( Config.class ); |
| 49 | ||
| 50 | private final static String ADMIN_USERID; |
|
| 51 | ||
| 52 | private final static String ADMIN_PASSWORD; |
|
| 53 | ||
| 54 | static |
|
| 55 | { |
|
| 56 | Properties props = new Properties(); |
|
| 57 | InputStream is = null; |
|
| 58 | try |
|
| 59 | { |
|
| 60 | props.load( is = IUtilConstants.class.getResourceAsStream( "/jcsutils.properties" ) ); |
|
| 61 | } |
|
| 62 | catch ( IOException ex ) |
|
| 63 | { |
|
| 64 | log.warn( ex.getMessage() ); |
|
| 65 | } |
|
| 66 | finally |
|
| 67 | { |
|
| 68 | if ( is != null ) |
|
| 69 | { |
|
| 70 | try |
|
| 71 | { |
|
| 72 | is.close(); |
|
| 73 | } |
|
| 74 | catch ( IOException ignore ) |
|
| 75 | { |
|
| 76 | // swallow |
|
| 77 | } |
|
| 78 | } |
|
| 79 | } |
|
| 80 | ADMIN_USERID = props.getProperty( "admin.userid", "admin" ); |
|
| 81 | ADMIN_PASSWORD = props.getProperty( "admin.password", "system" ); |
|
| 82 | } |
|
| 83 | ||
| 84 | /** No instances please. */ |
|
| 85 | private Config() |
|
| 86 | { |
|
| 87 | super(); |
|
| 88 | } |
|
| 89 | } |
|
| 90 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |