01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: * $Header:$
18: */
19: package org.apache.beehive.netui.pageflow.interceptor;
20:
21: import java.io.Serializable;
22: import java.util.Map;
23: import java.util.HashMap;
24:
25: /**
26: * <p>
27: * Class used to hold configuration information for an {@link Interceptor}. Each
28: * interceptor instance will have it's own configuration object which holds the
29: * interceptor implementation class and a set of custom properties that can be provided
30: * for each interceptor instance.
31: * </p>
32: */
33: public class InterceptorConfig implements Serializable {
34: private String _interceptorClass;
35: private Map/*< String, String >*/_customProperties = new HashMap/*< String, String >*/();
36:
37: /**
38: * Default constructor.
39: */
40: protected InterceptorConfig() {
41: }
42:
43: /**
44: * Create this config object for an intereceptor with the given class name.
45: * @param interceptorClass the {@link Interceptor}'s class name
46: */
47: protected InterceptorConfig(String interceptorClass) {
48: _interceptorClass = interceptorClass;
49: }
50:
51: /**
52: * Get the interceptor class.
53: * @return the String for the interceptor's class
54: */
55: public String getInterceptorClass() {
56: return _interceptorClass;
57: }
58:
59: /**
60: * Set the interceptor class.
61: * @param interceptorClass the String for the interceptor's class
62: */
63: public void setInterceptorClass(String interceptorClass) {
64: _interceptorClass = interceptorClass;
65: }
66:
67: /**
68: * Get the interceptor's custom properties. This returned {@link Map} contains pairs
69: * of <String, String>.
70: * @return the map of custom properties
71: */
72: public Map/*< String, String >*/getCustomProperties() {
73: return _customProperties;
74: }
75:
76: /**
77: * Get the custom property value corresponding to the given property name.
78: * @param name the name of the property
79: * @return the value of the property; if the property name isn't found, the value will be null
80: */
81: public String getCustomProperty(String name) {
82: return (String) _customProperties.get(name);
83: }
84:
85: /**
86: * Internal method used by the framework to add custom interceptor config properties.
87: * @param name the custom property's name
88: * @param value the custom property's value
89: */
90: void addCustomProperty(String name, String value) {
91: _customProperties.put(name, value);
92: }
93: }
|