KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > config > ConfigLookupContext


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.config;
18
19 import java.util.ArrayList JavaDoc;
20 import java.util.List JavaDoc;
21
22 /**
23  * Object to hold the context for a config lookup.
24  *
25  * @author gavinc
26  */

27 public class ConfigLookupContext
28 {
29    private boolean includeGlobalSection = true;
30    private List JavaDoc<String JavaDoc> areas = new ArrayList JavaDoc<String JavaDoc>();
31    private ConfigLookupAlgorithm algorithm;
32    
33    /**
34     * Default constructor
35     */

36    public ConfigLookupContext()
37    {
38       this.algorithm = new DefaultLookupAlgorithm();
39    }
40    
41    /**
42     * Constructs a lookup context for the given area
43     *
44     * @param area The area to search in
45     */

46    public ConfigLookupContext(String JavaDoc area)
47    {
48       this();
49       this.addArea(area);
50    }
51    
52    /**
53     * Constructs a lookup context for the list of the given areas
54     *
55     * @param areas The list of areas to search in
56     */

57    public ConfigLookupContext(List JavaDoc<String JavaDoc> areas)
58    {
59       this();
60       this.setAreas(areas);
61    }
62
63    /**
64     * @return Returns the lookup algorithm, uses the default implementation if a
65     * custom algorithm is not supplied
66     */

67    public ConfigLookupAlgorithm getAlgorithm()
68    {
69       return this.algorithm;
70    }
71
72    /**
73     * @param algorithm Sets the lookup algorithm to use
74     */

75    public void setAlgorithm(ConfigLookupAlgorithm algorithm)
76    {
77       this.algorithm = algorithm;
78    }
79
80    /**
81     * @return Returns the list of areas to search within
82     */

83    public List JavaDoc<String JavaDoc> getAreas()
84    {
85       return this.areas;
86    }
87
88    /**
89     * @param areas Sets the lists of areas to search within
90     */

91    public void setAreas(List JavaDoc<String JavaDoc> areas)
92    {
93       this.areas = areas;
94    }
95    
96    /**
97     * @param area Adds the area to the list of areas to be searched
98     */

99    public void addArea(String JavaDoc area)
100    {
101       this.areas.add(area);
102    }
103
104    /**
105     * @return Determines whether the global section should be included in the
106     * results, true by default
107     */

108    public boolean includeGlobalSection()
109    {
110       return this.includeGlobalSection;
111    }
112
113    /**
114     * @param includeGlobalSection Sets whether the global section will be
115     * included in the results
116     */

117    public void setIncludeGlobalSection(boolean includeGlobalSection)
118    {
119       this.includeGlobalSection = includeGlobalSection;
120    }
121 }
122
Popular Tags