KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdo > sco > SCOHashMapFactory


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.jdo.sco;
13
14 import com.versant.core.jdo.VersantPersistenceManager;
15 import com.versant.core.jdo.VersantStateManager;
16 import com.versant.core.common.VersantFieldMetaData;
17 import com.versant.core.common.Utils;
18 import com.versant.core.metadata.FieldMetaData;
19 import com.versant.core.common.BindingSupportImpl;
20
21 import javax.jdo.spi.PersistenceCapable;
22 import java.io.Serializable JavaDoc;
23 import java.util.Map JavaDoc;
24
25 /**
26  *
27  */

28 public class SCOHashMapFactory implements VersantSCOMapFactory,
29         Serializable JavaDoc {
30
31     public VersantSimpleSCO createSCOHashMap(PersistenceCapable owner,
32                                               VersantPersistenceManager pm, VersantStateManager stateManager,
33                                               VersantFieldMetaData fmd, MapData mapData) {
34         int n = mapData.entryCount;
35         Object JavaDoc[] keys = new Object JavaDoc[n];
36         keys = Utils.getObjectsById(mapData.keys, mapData.entryCount, pm,
37                 (FieldMetaData) fmd, fmd.isKeyTypePC());
38         Object JavaDoc[] values = new Object JavaDoc[n];
39         values = Utils.getObjectsById(mapData.values, mapData.entryCount, pm,
40                 (FieldMetaData) fmd, fmd.isElementTypePC());
41         mapData.keys = keys;
42         mapData.values = values;
43         return new SCOHashMap(owner, stateManager, fmd, mapData);
44     }
45
46     public VersantSimpleSCO createSCOHashMap(PersistenceCapable owner,
47                                               VersantPersistenceManager pm, VersantStateManager stateManager,
48                                               VersantFieldMetaData fmd, Map JavaDoc map) {
49         return new SCOHashMap(owner, stateManager, fmd, map);
50     }
51     
52      
53 }
54
Popular Tags