KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > mdr > persistence > btreeimpl > btreestorage > BtreeFactory


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.mdr.persistence.btreeimpl.btreestorage;
20
21 import java.util.Map JavaDoc;
22 import org.netbeans.mdr.persistence.*;
23 import org.netbeans.mdr.util.Logger;
24
25 /**
26 * Create a BtreeStorage
27 */

28 public class BtreeFactory implements StorageFactory {
29     public static final String JavaDoc DEFAULT_FILE_NAME = "mdr";
30     public static final String JavaDoc STORAGE_FILE_NAME = "org.netbeans.mdr.persistence.btreeimpl.filename"; // NOI18N
31
public static final String JavaDoc CACHE_SIZE = "org.netbeans.mdr.persistence.btreeimpl.cacheSize"; // NOI18N
32
public static final String JavaDoc CACHE_THRESHHOLD = "org.netbeans.mdr.persistence.btreeimpl.cacheThreshHold"; // NOI18N
33
public static final String JavaDoc CACHE_INSTANCE = "org.netbeans.mdr.persistence.btreeimpl.cacheInstance"; // NOI18N
34
public static final String JavaDoc STORAGE_UUID = "org.netbeans.mdr.persistence.btreeimpl.uuid"; // NOI18N
35

36     // Btree MOFID constnants
37
static final public int SAME_PREFIX_CODE = 0;
38     static final public int INTERNAL_PREFIX_CODE = 1;
39     static final public int FIRST_EXTERNAL_CODE = 2;
40
41
42     /* MOFIDs lower than this are internal, and use the
43        internal prefix */

44     static final public int FIRST_EXTERNAL_ID = 128;
45
46     /* prefix used for internal objects */
47     static final public String JavaDoc INTERNAL_PREFIX = "00000000-0000-0000-0000-000000000000"; // NOI18N
48

49         /** MOFID signifying null MOFID */
50     public static MOFID nullMOFID = new MOFID(1, INTERNAL_PREFIX);
51
52     /** MOFID for index of secondary indexes */
53     public static MOFID indexIndexId = new MOFID(2, INTERNAL_PREFIX);
54
55     /** MOFID for index of classes stored in repository */
56     public static MOFID classIndexId = new MOFID(3, INTERNAL_PREFIX);
57
58     /** Creates BtreeStorage
59     * @parameter name base name of Btree files
60     */

61     public Storage createStorage (Map JavaDoc properties) throws StorageException {
62         String JavaDoc name = (String JavaDoc) properties.get (STORAGE_FILE_NAME);
63         if (name == null) {
64             name = DEFAULT_FILE_NAME;
65             Logger.getDefault().log("Property " + STORAGE_FILE_NAME + " not specified. Using default value: " + DEFAULT_FILE_NAME);
66         }
67         Logger.getDefault().log("Storage file name: " + name);
68         return new BtreeStorage(name, properties);
69     }
70
71     /** null MOFID */
72     public org.netbeans.mdr.persistence.MOFID createNullMOFID () {
73         return nullMOFID;
74     }
75 }
76
77     
78
Popular Tags