1 package org.apache.jcs.utils.config;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 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
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 }