KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > server > impl > config > ConfigurationImpl


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.server.impl.config;
10
11 import org.jboss.portal.server.config.Configuration;
12 import org.apache.log4j.Logger;
13
14 import java.io.InputStream JavaDoc;
15
16 /**
17  * Implements the configuration interface.
18  *
19  * @jmx.mbean
20  * @jboss.xmbean
21  *
22  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
23  * @version $Revision: 1.2 $
24  */

25 public class ConfigurationImpl implements Configuration
26 {
27
28    /** Logger. */
29    private Logger log = Logger.getLogger(ConfigurationImpl.class);
30
31    /** Load the configuration files. */
32    private ClassLoader JavaDoc loader = null;
33
34    /** The directory prefix for the configuration files. */
35    private String JavaDoc base;
36
37    /** Not used. */
38    private int nonSecurePort;
39
40    /** Not used. */
41    private int securePort;
42
43    /**
44     * @jmx.managed-attribute
45     */

46    public int getNonSecurePort()
47    {
48       return nonSecurePort;
49    }
50
51    /**
52     * @jmx.managed-attribute
53     */

54    public void setNonSecurePort(int nonSecurePort)
55    {
56       this.nonSecurePort = nonSecurePort;
57    }
58
59    /**
60     * @jmx.managed-attribute
61     */

62    public int getSecurePort()
63    {
64       return securePort;
65    }
66
67    /**
68     * @jmx.managed-attribute
69     */

70    public void setSecurePort(int securePort)
71    {
72       this.securePort = securePort;
73    }
74
75    /**
76     * @jmx.managed-attribute
77     */

78    public String JavaDoc getBase()
79    {
80       return base;
81    }
82
83    /**
84     * @jmx.managed-attribute
85     */

86    public void setBase(String JavaDoc base)
87    {
88       this.base = base;
89    }
90
91    /**
92     * @jmx.managed-operation
93     * @jmx.managed-parameter
94     * name="name"
95     * type="java.lang.String"
96     */

97    public InputStream JavaDoc load(String JavaDoc name)
98    {
99       if (loader == null)
100       {
101          loader = ConfigurationImpl.class.getClassLoader();
102          log.debug("Initialized configuration class loader " + loader);
103       }
104       InputStream JavaDoc in = loader.getResourceAsStream(base.length() == 0 ? name.substring(1) : base + name);
105       log.debug("Loaded config resource for name = " + name + " the result is " + in);
106       return in;
107    }
108 }
109
Popular Tags