01: /*
02: * Copyright 2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.ws.context;
18:
19: import java.util.HashMap;
20: import java.util.Map;
21:
22: /**
23: * Abstract base class for {@link MessageContext instances}.
24: *
25: * @author Arjen Poutsma
26: * @since 1.0.0
27: */
28: public abstract class AbstractMessageContext implements MessageContext {
29:
30: /**
31: * Keys are <code>Strings</code>, values are <code>Objects</code>. Lazily initalized by
32: * <code>getProperties()</code>.
33: */
34: private Map properties;
35:
36: public boolean containsProperty(String name) {
37: return getProperties().containsKey(name);
38: }
39:
40: public Object getProperty(String name) {
41: return getProperties().get(name);
42: }
43:
44: public String[] getPropertyNames() {
45: return (String[]) getProperties().keySet().toArray(
46: new String[getProperties().size()]);
47: }
48:
49: public void removeProperty(String name) {
50: getProperties().remove(name);
51: }
52:
53: public void setProperty(String name, Object value) {
54: getProperties().put(name, value);
55: }
56:
57: private Map getProperties() {
58: if (properties == null) {
59: properties = new HashMap();
60: }
61: return properties;
62: }
63: }
|