KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hsqldb > persist > HsqlDatabaseProperties


1 /* Copyright (c) 2001-2005, The HSQL Development Group
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * Neither the name of the HSQL Development Group nor the names of its
15  * contributors may be used to endorse or promote products derived from this
16  * software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG,
22  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */

30
31
32 package org.hsqldb.persist;
33
34 import java.util.Enumeration JavaDoc;
35
36 import org.hsqldb.Database;
37 import org.hsqldb.DatabaseURL;
38 import org.hsqldb.HsqlException;
39 import org.hsqldb.Trace;
40 import org.hsqldb.lib.HashMap;
41 import org.hsqldb.lib.HashSet;
42 import org.hsqldb.lib.Iterator;
43 import org.hsqldb.lib.Set;
44 import org.hsqldb.lib.SimpleLog;
45 import org.hsqldb.lib.java.JavaSystem;
46 import org.hsqldb.store.ValuePool;
47
48 /**
49  * Manages a .properties file for a database.
50  *
51  * @author fredt@users
52  * @version 1.8.0
53  * @since 1.7.0
54  */

55 public class HsqlDatabaseProperties extends HsqlProperties {
56
57     // column number mappings
58
public static final int indexName = 0;
59     public static final int indexAccess = 1;
60     public static final int indexClass = 2;
61     public static final int indexIsRange = 3;
62     public static final int indexDefaultValue = 4;
63     public static final int indexRangeLow = 5;
64     public static final int indexRangeHigh = 6;
65     public static final int indexValues = 7;
66     public static final int indexLimit = 8;
67
68     // accessibility
69
private static final int SET_PROPERTY = 0;
70     private static final int SQL_PROPERTY = 1;
71     private static final int FILE_PROPERTY = 2;
72
73     // db files modified
74
public static final int FILES_NOT_MODIFIED = 0;
75     public static final int FILES_MODIFIED = 1;
76     public static final int FILES_NEW = 2;
77     private static final String JavaDoc MODIFIED_NO = "no";
78     private static final String JavaDoc MODIFIED_YES = "yes";
79     private static final String JavaDoc MODIFIED_NEW = "no-new-files";
80
81     // allowed property metadata
82
private static HashMap meta = new HashMap();
83
84     // versions
85
public static final String JavaDoc VERSION_STRING_1_7_0 = "1.7.0";
86     public static final String JavaDoc VERSION_STRING_1_8_0 = "1.8.0";
87     public static final String JavaDoc FIRST_COMPATIBLE_VERSION = "1.8.0";
88     public static final String JavaDoc THIS_VERSION = "1.8.0";
89     public static final String JavaDoc THIS_FULL_VERSION = "1.8.0.7";
90     public static final String JavaDoc PRODUCT_NAME = "HSQL Database Engine";
91     public static final int MAJOR = 1,
92                                MINOR = 8,
93                                REVISION = 0;
94
95     //
96
public static final String JavaDoc db_version = "version";
97     private static final String JavaDoc db_readonly = "readonly";
98     private static final String JavaDoc db_modified = "modified";
99
100     //
101
private static final String JavaDoc runtime_gc_interval = "runtime.gc_interval";
102     public static final String JavaDoc hsqldb_applog = "hsqldb.applog";
103     public static final String JavaDoc hsqldb_cache_file_scale =
104         "hsqldb.cache_file_scale";
105     public static final String JavaDoc hsqldb_cache_free_count_scale =
106         "hsqldb.cache_free_count_scale";
107     public static final String JavaDoc hsqldb_cache_scale = "hsqldb.cache_scale";
108     public static final String JavaDoc hsqldb_cache_size_scale =
109         "hsqldb.cache_size_scale";
110     public static final String JavaDoc hsqldb_cache_version = "hsqldb.cache_version";
111     private static final String JavaDoc hsqldb_catalogs = "hsqldb.catalogs";
112     public static final String JavaDoc hsqldb_compatible_version =
113         "hsqldb.compatible_version";
114     public static final String JavaDoc hsqldb_default_table_type =
115         "hsqldb.default_table_type";
116     public static final String JavaDoc hsqldb_defrag_limit = "hsqldb.defrag_limit";
117     private static final String JavaDoc hsqldb_files_readonly =
118         "hsqldb.files_readonly";
119     public static final String JavaDoc hsqldb_log_size = "hsqldb.log_size";
120     public static final String JavaDoc hsqldb_nio_data_file = "hsqldb.nio_data_file";
121     public static final String JavaDoc hsqldb_max_nio_scale = "hsqldb.max_nio_scale";
122     public static final String JavaDoc hsqldb_raf_buffer_scale =
123         "hsqldb.raf_buffer_scale";
124     private static final String JavaDoc hsqldb_original_version =
125         "hsqldb.original_version";
126     public static final String JavaDoc hsqldb_script_format = "hsqldb.script_format";
127
128     //
129
private static final String JavaDoc sql_compare_in_locale =
130         "sql.compare_in_locale";
131     private static final String JavaDoc sql_enforce_strict_size =
132         "sql.enforce_strict_size";
133     public static final String JavaDoc sql_tx_no_multi_write =
134         "sql.tx_no_multi_rewrite";
135
136     //
137
public static final String JavaDoc textdb_cache_scale = "textdb.cache_scale";
138     public static final String JavaDoc textdb_cache_size_scale =
139         "textdb.cache_size_scale";
140     public static final String JavaDoc textdb_all_quoted = "textdb.all_quoted";
141     public static final String JavaDoc textdb_allow_full_path =
142         "textdb.allow_full_path";
143     public static final String JavaDoc textdb_encoding = "textdb.encoding";
144     public static final String JavaDoc textdb_ignore_first = "textdb.ignore_first";
145     public static final String JavaDoc textdb_quoted = "textdb.quoted";
146     public static final String JavaDoc textdb_fs = "textdb.fs";
147     public static final String JavaDoc textdb_vs = "textdb.vs";
148     public static final String JavaDoc textdb_lvs = "textdb.lvs";
149
150     static {
151
152         // string defaults for protected props
153
meta.put(db_version, getMeta(db_version, FILE_PROPERTY, null));
154         meta.put(hsqldb_compatible_version,
155                  getMeta(hsqldb_compatible_version, FILE_PROPERTY, null));
156         meta.put(hsqldb_cache_version,
157                  getMeta(hsqldb_cache_version, FILE_PROPERTY, null));
158         meta.put(hsqldb_original_version,
159                  getMeta(hsqldb_original_version, FILE_PROPERTY, null));
160         meta.put(db_modified, getMeta(db_modified, FILE_PROPERTY, null));
161
162         // string defaults for user defined props
163
meta.put(hsqldb_default_table_type,
164                  getMeta(hsqldb_default_table_type, SET_PROPERTY, "memory"));
165         meta.put(textdb_fs, getMeta(textdb_fs, SET_PROPERTY, ","));
166         meta.put(textdb_vs, getMeta(textdb_vs, SET_PROPERTY, null));
167         meta.put(textdb_lvs, getMeta(textdb_lvs, SET_PROPERTY, null));
168         meta.put(textdb_encoding,
169                  getMeta(textdb_encoding, SET_PROPERTY, null));
170
171         // boolean defaults for protected props
172
meta.put(db_readonly, getMeta(db_readonly, FILE_PROPERTY, false));
173         meta.put(hsqldb_files_readonly,
174                  getMeta(hsqldb_files_readonly, FILE_PROPERTY, false));
175         meta.put(textdb_allow_full_path,
176                  getMeta(textdb_allow_full_path, FILE_PROPERTY, false));
177
178         // boolean defaults for user defined props
179
meta.put(hsqldb_nio_data_file,
180                  getMeta(hsqldb_nio_data_file, SET_PROPERTY, false));
181         meta.put(hsqldb_catalogs,
182                  getMeta(hsqldb_catalogs, SET_PROPERTY, false));
183         meta.put(sql_enforce_strict_size,
184                  getMeta(sql_enforce_strict_size, SET_PROPERTY, false));
185         meta.put(sql_tx_no_multi_write,
186                  getMeta(sql_tx_no_multi_write, SET_PROPERTY, false));
187         meta.put(textdb_quoted, getMeta(textdb_quoted, SET_PROPERTY, false));
188         meta.put(textdb_all_quoted,
189                  getMeta(textdb_all_quoted, SET_PROPERTY, false));
190         meta.put(textdb_ignore_first,
191                  getMeta(textdb_ignore_first, SET_PROPERTY, false));
192
193         // integral defaults for user-defined set props
194
meta.put(hsqldb_applog,
195                  getMeta(hsqldb_applog, SET_PROPERTY, 0, new byte[] {
196             0, 1, 2
197         }));
198         meta.put(hsqldb_cache_file_scale,
199                  getMeta(hsqldb_cache_file_scale, SET_PROPERTY, 1,
200                          new byte[] {
201             1, 8
202         }));
203         meta.put(hsqldb_script_format,
204                  getMeta(hsqldb_script_format, SET_PROPERTY, 0, new byte[] {
205             0, 1, 3
206         }));
207
208         // integral defaults for proteced range props
209
meta.put(hsqldb_log_size,
210                  getMeta(hsqldb_log_size, SQL_PROPERTY, 0, 0, 16000));
211         meta.put(hsqldb_defrag_limit,
212                  getMeta(hsqldb_defrag_limit, SQL_PROPERTY, 200, 0, 16000));
213
214         // integral defaults for user defined range props
215
meta.put(runtime_gc_interval,
216                  getMeta(runtime_gc_interval, SET_PROPERTY, 0, 0, 1000000));
217         meta.put(hsqldb_cache_free_count_scale,
218                  getMeta(hsqldb_cache_free_count_scale, SET_PROPERTY, 9, 6,
219                          12));
220         meta.put(hsqldb_cache_scale,
221                  getMeta(hsqldb_cache_scale, SET_PROPERTY, 14, 8, 18));
222         meta.put(hsqldb_cache_size_scale,
223                  getMeta(hsqldb_cache_size_scale, SET_PROPERTY, 10, 6, 20));
224         meta.put(hsqldb_max_nio_scale,
225                  getMeta(hsqldb_max_nio_scale, SET_PROPERTY, 28, 24, 31));
226         meta.put(hsqldb_raf_buffer_scale,
227                  getMeta(hsqldb_raf_buffer_scale, SET_PROPERTY, 12, 8, 13));
228         meta.put(textdb_cache_scale,
229                  getMeta(textdb_cache_scale, SET_PROPERTY, 10, 8, 16));
230         meta.put(textdb_cache_size_scale,
231                  getMeta(textdb_cache_size_scale, SET_PROPERTY, 10, 6, 20));
232     }
233
234     private Database database;
235
236     public HsqlDatabaseProperties(Database db) {
237
238         super(db.getPath(), db.getFileAccess(), db.isFilesInJar());
239
240         database = db;
241
242         // char padding to size and exception if data is too long
243
setProperty(sql_enforce_strict_size, false);
244
245         // removed from 1.7.2 - sql.month is always true (1-12)
246
// removed from 1.7.2 - sql.strict_fk is always enforced
247
// if true, requires a pre-existing unique index for foreign key
248
// referenced column and returns an error if index does not exist
249
// 1.61 creates a non-unique index if no index exists
250
// setProperty("sql.strict_fk", false);
251
// removed from 1.7.2
252
// has no effect if sql_strict_fk is true, otherwise if true,
253
// creates a unique index for foreign keys instead of non-unique
254
// setProperty("sql.strong_fk", true);
255
// the two properties below are meant for attempting to open an
256
// existing database with all its files *.properties, *script and
257
// *.data.
258
// version of a new database
259
setProperty(db_version, THIS_VERSION);
260
261         // the earliest version that can open this database
262
// this is set to 1.7.2 when the db is written to
263
setProperty(hsqldb_compatible_version, FIRST_COMPATIBLE_VERSION);
264
265         // data format of the cache file
266
// this is set to 1.7.0 when a new *.data file is created
267
setProperty(hsqldb_cache_version, VERSION_STRING_1_7_0);
268
269         // the version that created this database
270
// once created, this won't change if db is used with a future version
271
setProperty(hsqldb_original_version, THIS_VERSION);
272         /*
273                 garbage collection with gc_interval
274                 Setting this value can be useful when HSQLDB is used as an
275                 in-process part of an application. The minimum practical
276                 amount is probably "10000" and the maximum "1000000"
277
278                 In some versions of Java, such as 1.3.1_02 on windows,
279                 when the application runs out of memory it runs the gc AND
280                 requests more memory from the OS. Setting this property
281                 forces the DB to live inside its memory budget but the
282                 maximum amount of memory can still be set with the
283                 java -Xmx argument to provide the memory needed by other
284                 parts of the app to do graphics and networking.
285
286                 Of course there is a speed penalty for setting the value
287                 too low and doing garbage collection too often.
288
289                 This was introduced as a result of tests by Karl Meissner
290                 (meissnersd@users)
291          */

292
293         // garbage collect per Record or Cache Row objects created
294
// the default, "0" means no garbage collection is forced by
295
// hsqldb (the Java Runtime will do it's own garbage collection
296
// in any case).
297
setProperty(runtime_gc_interval, 0);
298
299         // this property is either 1 or 8
300
setProperty(hsqldb_cache_file_scale, 1);
301
302         // this property is between 6 - 20, default 8
303
setProperty(hsqldb_cache_size_scale, 8);
304
305         // number of rows from CACHED tables kept constantly in memory
306
// the number of rows in up to 3 * (2 to the power of
307
// cache_scale value).
308
// reduce the default 14 (3*16K rows) if memory is limited and rows
309
// are large.
310
// values between 8-16 are allowed
311
setProperty(hsqldb_cache_scale, 14);
312
313         // maximum size of .log file in megabytes
314
setProperty(hsqldb_log_size, 200);
315
316         // type of logging (0 : text , 1 : binary, 3 : compressed)
317
setProperty(hsqldb_script_format, 0);
318         setProperty(db_readonly, false);
319         setProperty(db_modified, "no-new-files");
320
321         // initial method of data file access
322
setProperty(hsqldb_nio_data_file, true);
323
324         // set default table type to MEMORY
325
setProperty(hsqldb_default_table_type, "memory");
326
327         // the property "version" is also set to the current version
328
//
329
// the following properties can be set by the user as defaults for
330
// text tables. the default values are shown.
331
// "textdb.fs", ","
332
// "textdb.vs", ",";
333
// "textdb.lvs", ","
334
// "textdb.ignore_first", false
335
// "textdb.quoted", true
336
// "textdb.all_quoted", false
337
// "textdb.encoding", "ASCII"
338
// "textdb.cache_scale", 10 -- allowed range 8-16
339
// "textdb.cache_size_scale", 10 -- allowed range 8-20
340
//
341
// settings for OOo integration
342
if (db.isStoredFileAccess()) {
343             setProperty(hsqldb_default_table_type, "cached");
344             setProperty(hsqldb_cache_scale, 13);
345             setProperty(hsqldb_log_size, 10);
346             setProperty(sql_enforce_strict_size, true);
347             setProperty(hsqldb_nio_data_file, false);
348         }
349     }
350
351     /**
352      * Creates file with defaults if it didn't exist.
353      * Returns false if file already existed.
354      */

355     public boolean load() throws HsqlException {
356
357         boolean exists;
358
359         if (!DatabaseURL.isFileBasedDatabaseType(database.getType())) {
360             return true;
361         }
362
363         try {
364             exists = super.load();
365         } catch (Exception JavaDoc e) {
366             throw Trace.error(Trace.FILE_IO_ERROR,
367                               Trace.LOAD_SAVE_PROPERTIES, new Object JavaDoc[] {
368                 fileName, e
369             });
370         }
371
372         if (!exists) {
373             return false;
374         }
375
376         filterLoadedProperties();
377
378         String JavaDoc version = getProperty(hsqldb_compatible_version);
379
380         // do not open if the database belongs to a later (future) version
381
int check = version.substring(0, 5).compareTo(THIS_VERSION);
382
383         Trace.check(check <= 0, Trace.WRONG_DATABASE_FILE_VERSION);
384
385         version = getProperty(db_version);
386
387         if (version.charAt(2) == '6') {
388             setProperty(hsqldb_cache_version, "1.6.0");
389         }
390
391         JavaSystem.gcFrequency = getIntegerProperty(runtime_gc_interval, 0);
392
393         return true;
394     }
395
396     /**
397      * Sets the database member variables after creating the properties object,
398      * openning a properties file, or changing a property with a command
399      */

400     public void setDatabaseVariables() {
401
402         if (isPropertyTrue(db_readonly)) {
403             database.setReadOnly();
404         }
405
406         if (isPropertyTrue(hsqldb_files_readonly)) {
407             database.setFilesReadOnly();
408         }
409
410         database.sqlEnforceStrictSize =
411             isPropertyTrue(sql_enforce_strict_size);
412
413         if (isPropertyTrue(sql_compare_in_locale)) {
414             stringProps.remove(sql_compare_in_locale);
415             database.collation.setCollationAsLocale();
416         }
417
418         database.txManager.setReWriteProtection(
419             isPropertyTrue(sql_tx_no_multi_write));
420         database.setMetaDirty(false);
421     }
422
423     public void save() throws HsqlException {
424
425         if (!DatabaseURL.isFileBasedDatabaseType(database.getType())
426                 || database.isFilesReadOnly() || database.isFilesInJar()) {
427             return;
428         }
429
430         try {
431             super.save(fileName + ".properties" + ".new");
432             fa.renameElement(fileName + ".properties" + ".new",
433                              fileName + ".properties");
434         } catch (Exception JavaDoc e) {
435             database.logger.appLog.logContext(SimpleLog.LOG_ERROR, "failed");
436
437             throw Trace.error(Trace.FILE_IO_ERROR,
438                               Trace.LOAD_SAVE_PROPERTIES, new Object JavaDoc[] {
439                 fileName, e
440             });
441         }
442     }
443
444     void filterLoadedProperties() {
445
446         Enumeration JavaDoc en = stringProps.propertyNames();
447
448         while (en.hasMoreElements()) {
449             String JavaDoc key = (String JavaDoc) en.nextElement();
450             boolean accept = meta.containsKey(key);
451
452             if (!accept) {
453                 stringProps.remove(key);
454             }
455         }
456     }
457
458     /**
459      * overload file database properties with any passed on URL line
460      * do not store password etc
461      */

462     public void setURLProperties(HsqlProperties p) {
463
464         if (p != null) {
465             for (Enumeration JavaDoc e = p.propertyNames(); e.hasMoreElements(); ) {
466                 String JavaDoc propertyName = (String JavaDoc) e.nextElement();
467                 Object JavaDoc[] row = (Object JavaDoc[]) meta.get(propertyName);
468
469                 if (row != null
470                         && (db_readonly.equals(propertyName)
471                             || ((Integer JavaDoc) row[indexAccess]).intValue()
472                                == SET_PROPERTY)) {
473
474                     // can add error checking with defaults
475
setProperty(propertyName, p.getProperty(propertyName));
476                 }
477             }
478         }
479     }
480
481     public Set getUserDefinedPropertyData() {
482
483         Set set = new HashSet();
484         Iterator it = meta.values().iterator();
485
486         while (it.hasNext()) {
487             Object JavaDoc[] row = (Object JavaDoc[]) it.next();
488
489             if (((Integer JavaDoc) row[indexAccess]).intValue() == SET_PROPERTY) {
490                 set.add(row);
491             }
492         }
493
494         return set;
495     }
496
497     public boolean isUserDefinedProperty(String JavaDoc key) {
498
499         Object JavaDoc[] row = (Object JavaDoc[]) meta.get(key);
500
501         return row != null
502                && ((Integer JavaDoc) row[indexAccess]).intValue() == SET_PROPERTY;
503     }
504
505     public boolean isBoolean(String JavaDoc key) {
506
507         Object JavaDoc[] row = (Object JavaDoc[]) meta.get(key);
508
509         return row != null && row[indexClass].equals("boolean")
510                && ((Integer JavaDoc) row[indexAccess]).intValue() == SET_PROPERTY;
511     }
512
513     public boolean isIntegral(String JavaDoc key) {
514
515         Object JavaDoc[] row = (Object JavaDoc[]) meta.get(key);
516
517         return row != null && row[indexClass].equals("int")
518                && ((Integer JavaDoc) row[indexAccess]).intValue() == SET_PROPERTY;
519     }
520
521     public boolean isString(String JavaDoc key) {
522
523         Object JavaDoc[] row = (Object JavaDoc[]) meta.get(key);
524
525         return row != null && row[indexClass].equals("java.lang.String")
526                && ((Integer JavaDoc) row[indexAccess]).intValue() == SET_PROPERTY;
527     }
528
529     public String JavaDoc setDatabaseProperty(String JavaDoc key,
530                                       String JavaDoc value) throws HsqlException {
531
532         Object JavaDoc[] row = (Object JavaDoc[]) meta.get(key);
533
534         // can check bounds here
535
value = super.setProperty(key, value);
536
537         return value;
538     }
539
540     public int getDefaultWriteDelay() {
541         return database.isStoredFileAccess() ? 2000
542                                              : 10000;
543     }
544
545     public void setDBModified(int mode) throws HsqlException {
546
547         String JavaDoc value = MODIFIED_NO;
548
549         if (mode == FILES_MODIFIED) {
550             value = MODIFIED_YES;
551         } else if (mode == FILES_NEW) {
552             value = MODIFIED_NEW;
553         }
554
555         setProperty(db_modified, value);
556         save();
557     }
558
559     public int getDBModified() throws HsqlException {
560
561         String JavaDoc value = getProperty("modified");
562
563         if (MODIFIED_YES.equals(value)) {
564             return FILES_MODIFIED;
565         } else if (MODIFIED_NEW.equals(value)) {
566             return FILES_NEW;
567         }
568
569         return FILES_NOT_MODIFIED;
570     }
571
572     private static Object JavaDoc[] getMeta(String JavaDoc name, int accessLevel,
573                                     String JavaDoc defaultValue) {
574
575         Object JavaDoc[] row = new Object JavaDoc[indexLimit];
576
577         row[indexName] = name;
578         row[indexAccess] = ValuePool.getInt(accessLevel);
579         row[indexClass] = "java.lang.String";
580         row[indexDefaultValue] = defaultValue;
581
582         return row;
583     }
584
585     private static Object JavaDoc[] getMeta(String JavaDoc name, int accessLevel,
586                                     boolean defaultValue) {
587
588         Object JavaDoc[] row = new Object JavaDoc[indexLimit];
589
590         row[indexName] = name;
591         row[indexAccess] = ValuePool.getInt(accessLevel);
592         row[indexClass] = "boolean";
593         row[indexDefaultValue] = defaultValue ? Boolean.TRUE
594                                               : Boolean.FALSE;
595
596         return row;
597     }
598
599     private static Object JavaDoc[] getMeta(String JavaDoc name, int accessLevel,
600                                     int defaultValue, byte[] values) {
601
602         Object JavaDoc[] row = new Object JavaDoc[indexLimit];
603
604         row[indexName] = name;
605         row[indexAccess] = ValuePool.getInt(accessLevel);
606         row[indexClass] = "int";
607         row[indexDefaultValue] = ValuePool.getInt(defaultValue);
608         row[indexValues] = values;
609
610         return row;
611     }
612
613     private static Object JavaDoc[] getMeta(String JavaDoc name, int accessLevel,
614                                     int defaultValue, int rangeLow,
615                                     int rangeHigh) {
616
617         Object JavaDoc[] row = new Object JavaDoc[indexLimit];
618
619         row[indexName] = name;
620         row[indexAccess] = ValuePool.getInt(accessLevel);
621         row[indexClass] = "int";
622         row[indexDefaultValue] = ValuePool.getInt(defaultValue);
623         row[indexIsRange] = Boolean.TRUE;
624         row[indexRangeLow] = ValuePool.getInt(rangeLow);
625         row[indexRangeHigh] = ValuePool.getInt(rangeHigh);
626
627         return row;
628     }
629 }
630
Popular Tags