KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jofti > config > DefaultIndexConfig


1 /*
2  * Created on 08-Apr-2005
3  *
4  */

5 package com.jofti.config;
6
7 import java.util.List JavaDoc;
8 import java.util.Map JavaDoc;
9 import java.util.Properties JavaDoc;
10
11 import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
12
13
14
15 /**
16  
17  *
18  * A convenience class for use in the addIndex method. The default config already has the default entries
19  * in each of the configuration properties. The only thing not present are any class mappings - so
20  * no changes to this object will result in only the built-in types being indexed.<p>
21  *
22  The settings are:
23 <ul>
24 <li>name: default
25 <li>adapter: com.jofti.cache.adapter.MapAdapter
26 <li>parserType: com.jofti.introspect.JavaBeanClassIntrospector
27 <li>indexType: com.jofti.tree.TreeIndex
28 <li>ClassMappings: [ ]
29 <li>queryMappings: [ ]
30 <li>adapterProperties: [ ]
31 </ul>
32  *
33  *
34  *
35  * @author Steve Woodcock (steve@jofti.com)<p>
36  * @version 1.0
37  */

38 public class DefaultIndexConfig implements IndexConfig {
39
40
41     //set up the default values
42

43     private String JavaDoc name="default";
44     
45     private String JavaDoc cacheAdapter = "com.jofti.cache.adapter.MapAdapter";
46     
47     
48     private String JavaDoc indexType = "com.jofti.tree.TreeIndex";
49     
50     private String JavaDoc parserType = "com.jofti.introspect.JavaBeanClassIntrospector";
51     
52     private Map JavaDoc classMappings = new ConcurrentHashMap();
53     
54     private Map JavaDoc queryMappings = new ConcurrentHashMap();
55     
56     private boolean lazyLoaded = false;
57     
58     private Properties JavaDoc adapterProperties;
59     
60     private Properties JavaDoc indexProperties = new Properties JavaDoc();
61     
62     
63     public DefaultIndexConfig(){
64         
65     }
66     
67     /* (non-Javadoc)
68      * @see com.jofti.config.IndexConfig#getName()
69      */

70     public String JavaDoc getName() {
71         return name;
72     }
73
74     /* (non-Javadoc)
75      * @see com.jofti.conf.CacheConfig#getCacheAdapter()
76      */

77     public String JavaDoc getCacheAdapter() {
78         return cacheAdapter;
79     }
80
81
82     /* (non-Javadoc)
83      * @see com.jofti.conf.CacheConfig#getIndexMappings()
84      */

85     public Map JavaDoc getIndexMappings() {
86         return classMappings;
87     }
88     
89     
90     /* (non-Javadoc)
91      * @see com.jofti.config.IndexConfig#addMapping(java.lang.String, java.util.List)
92      */

93     public void addMapping(String JavaDoc clazz, List JavaDoc propertyList){
94  
95         classMappings.put(clazz, propertyList);
96     }
97
98     /* (non-Javadoc)
99      * @see com.jofti.config.IndexConfig#addQuery(java.lang.String, java.lang.String)
100      */

101     public void addQuery(String JavaDoc name, String JavaDoc query){
102  
103         queryMappings.put(name, query);
104     }
105
106     /**
107      * @param cacheAdapter The cacheAdapter to set.
108      */

109     public void setCacheAdapter(String JavaDoc cacheAdapter) {
110         this.cacheAdapter = cacheAdapter;
111     }
112     /**
113      * @param indexType The indexType to set.
114      */

115     public void setIndexType(String JavaDoc indexType) {
116         this.indexType = indexType;
117     }
118     /**
119      * @param name The name to set.
120      */

121     public void setName(String JavaDoc name) {
122         this.name = name;
123     }
124     /**
125      * @return Returns the classMappings.
126      */

127     public Map JavaDoc getClassMappings() {
128         return classMappings;
129     }
130     
131     /**
132      * @return Returns the queryMappings.
133      */

134     public Map JavaDoc getQueryMappings() {
135         return queryMappings;
136     }
137     /**
138      * @return Returns the indexType.
139      */

140     public String JavaDoc getIndexType() {
141         return indexType;
142     }
143     /**
144      * @return Returns the lazyLoaded.
145      */

146     public boolean isLazyLoaded() {
147         return lazyLoaded;
148     }
149     /**
150      * @param lazyLoaded The lazyLoaded to set.
151      */

152     public void setLazyLoaded(boolean lazyLoaded) {
153         this.lazyLoaded = lazyLoaded;
154     }
155     /**
156      * @return Returns the adapterProperties.
157      */

158     public Properties JavaDoc getAdapterProperties() {
159         return adapterProperties;
160     }
161     /**
162      * @param adapterProperties The adapterProperties to set.
163      */

164     public void setAdapterProperties(Properties JavaDoc adapterProperties) {
165         this.adapterProperties = adapterProperties;
166     }
167
168     /* (non-Javadoc)
169      * @see com.jofti.config.IndexConfig#getParserType()
170      */

171     public String JavaDoc getParserType() {
172         return parserType;
173     }
174     /**
175      * @param parserType The parserType to set.
176      */

177     public void setParserType(String JavaDoc parserType) {
178         this.parserType = parserType;
179     }
180
181     /* (non-Javadoc)
182      * @see com.jofti.config.IndexConfig#getPersistenceProperties()
183      */

184     public Properties JavaDoc getIndexProperties() {
185
186         return indexProperties;
187     }
188
189
190     public synchronized void setIndexProperties(Properties JavaDoc indexProperties) {
191         this.indexProperties = indexProperties;
192     }
193
194
195 }
196
Popular Tags