|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
CommonConfigurable.java | - | 100% | 100% | 100% |
|
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 | * contributor license agreements. See the NOTICE file distributed with | |
4 | * this work for additional information regarding copyright ownership. | |
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
6 | * (the "License"); you may not use this file except in compliance with | |
7 | * the License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | * | |
17 | * $Id: CommonConfigurable.java 564214 2007-08-09 14:23:06Z vgritsenko $ | |
18 | */ | |
19 | ||
20 | package org.apache.xindice.client.xmldb; | |
21 | ||
22 | import org.xmldb.api.base.Configurable; | |
23 | import org.xmldb.api.base.XMLDBException; | |
24 | ||
25 | import java.util.HashMap; | |
26 | ||
27 | /** | |
28 | * Base class to handle property management within the API implementation. | |
29 | * | |
30 | * @version $Revision: 564214 $, $Date: 2007-08-09 07:23:06 -0700 (Thu, 09 Aug 2007) $ | |
31 | */ | |
32 | public abstract class CommonConfigurable implements Configurable { | |
33 | ||
34 | private HashMap config; | |
35 | ||
36 | /** | |
37 | * Constructor for the CommonConfigurable object | |
38 | */ | |
39 | 23935 | public CommonConfigurable() { |
40 | 23935 | config = new HashMap(); |
41 | } | |
42 | ||
43 | /** | |
44 | * Constructor for the CommonConfigurable object | |
45 | * | |
46 | * @param commonConfigurable from which the initial properties for this | |
47 | * object are copied. | |
48 | */ | |
49 | 4 | public CommonConfigurable(CommonConfigurable commonConfigurable) { |
50 | 4 | config = new HashMap(commonConfigurable.config); |
51 | } | |
52 | ||
53 | /** | |
54 | * Sets a property value. If the property doesn't exist it is created, if it | |
55 | * does exist it is overwritten. | |
56 | * | |
57 | * @param name The Property name | |
58 | * @param value The new Property value | |
59 | * @throws XMLDBException never | |
60 | */ | |
61 | 2 | public void setProperty(String name, String value) throws XMLDBException { |
62 | 2 | config.put(name, value); |
63 | } | |
64 | ||
65 | /** | |
66 | * Gets the property value associated with name | |
67 | * | |
68 | * @param name The name of the property to retrieve. | |
69 | * @return The Property value | |
70 | * @throws XMLDBException never | |
71 | */ | |
72 | 10 | public String getProperty(String name) throws XMLDBException { |
73 | 10 | return (String) config.get(name); |
74 | } | |
75 | } |
|