Line | Hits | Source |
---|---|---|
1 | /* | |
2 | Chrysalis Web Framework [http://chrysalis.sourceforge.net] | |
3 | Copyright (c) 2002, 2003, 2004, Paul Strack | |
4 | ||
5 | All rights reserved. | |
6 | ||
7 | Redistribution and use in source and binary forms, with or without | |
8 | modification, are permitted provided that the following conditions are met: | |
9 | ||
10 | 1. Redistributions of source code must retain the above copyright notice, this | |
11 | list of conditions and the following disclaimer. | |
12 | ||
13 | 2. Redistributions in binary form must reproduce the above copyright notice, | |
14 | this list of conditions and the following disclaimer in the documentation | |
15 | and/or other materials provided with the distribution. | |
16 | ||
17 | 3. Neither the name of the copyright holder nor the names of its contributors | |
18 | may be used to endorse or promote products derived from this software without | |
19 | specific prior written permission. | |
20 | ||
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |
22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | |
25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |
28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | |
32 | ||
33 | package org.chwf.resources; | |
34 | ||
35 | import java.util.Map; | |
36 | import java.util.Properties; | |
37 | ||
38 | /** | |
39 | * Implementation class for ResourceFactoryConfig. | |
40 | * | |
41 | * @author Paul Strack | |
42 | */ | |
43 | class ResourceFactoryConfigImpl implements ResourceFactoryConfig { | |
44 | ||
45 | /** The resource name. */ | |
46 | private final String name; | |
47 | ||
48 | /** The resource properties. */ | |
49 | private final Map properties; | |
50 | ||
51 | /** | |
52 | * Constructor. | |
53 | * | |
54 | * @param name The factory name. | |
55 | * @param properties The configuration properties. | |
56 | */ | |
57 | 6 | ResourceFactoryConfigImpl(String name, Map properties) { |
58 | 6 | this.name = name; |
59 | 6 | this.properties = properties; |
60 | 6 | } |
61 | ||
62 | /** | |
63 | * The factory name. | |
64 | * | |
65 | * @return The factory name. | |
66 | */ | |
67 | public String getName() { | |
68 | 1 | return this.name; |
69 | } | |
70 | ||
71 | /** | |
72 | * Get configuration property. | |
73 | * | |
74 | * @param name Property name. | |
75 | * @return Property value, or <code>null</code> if it does not exist. | |
76 | */ | |
77 | public String getProperty(String name) { | |
78 | 5 | return (String) this.properties.get(name); |
79 | } | |
80 | ||
81 | /** | |
82 | * Get all configuration properties, in a Properties object. This utility | |
83 | * method can be used to initialize resources like JNDI that use Properties | |
84 | * maps for initialization. | |
85 | * | |
86 | * @return All properties. | |
87 | */ | |
88 | public Properties getProperties() { | |
89 | 1 | Properties props = new Properties(); |
90 | 1 | props.putAll(this.properties); |
91 | 1 | return props; |
92 | } | |
93 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |