KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdo > sco > detached > DetachSCOHashMapFactory


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.detached;
13
14 import com.versant.core.jdo.VersantPersistenceManager;
15 import com.versant.core.jdo.VersantStateManager;
16 import com.versant.core.jdo.VersantStateManager;
17 import com.versant.core.common.VersantFieldMetaData;
18 import com.versant.core.common.Utils;
19 import com.versant.core.jdo.sco.VersantSCOMapFactory;
20 import com.versant.core.jdo.sco.VersantSimpleSCO;
21 import com.versant.core.jdo.sco.MapData;
22 import com.versant.core.metadata.FieldMetaData;
23 import com.versant.core.common.BindingSupportImpl;
24
25 import javax.jdo.spi.PersistenceCapable;
26 import java.io.Serializable JavaDoc;
27 import java.util.Map JavaDoc;
28
29 public class DetachSCOHashMapFactory implements VersantSCOMapFactory,
30         Serializable JavaDoc {
31
32     public VersantSimpleSCO createSCOHashMap(PersistenceCapable owner,
33                                               VersantPersistenceManager pm, VersantStateManager stateManager,
34                                               VersantFieldMetaData fmd, MapData mapData) {
35         int n = mapData.entryCount;
36         Object JavaDoc[] keys = new Object JavaDoc[n];
37         keys = Utils.getObjectsById(mapData.keys, mapData.entryCount, pm,
38                 (FieldMetaData) fmd, fmd.isKeyTypePC());
39         Object JavaDoc[] values = new Object JavaDoc[n];
40         values = Utils.getObjectsById(mapData.values, mapData.entryCount, pm,
41                 (FieldMetaData) fmd, fmd.isElementTypePC());
42         mapData.keys = keys;
43         mapData.values = values;
44         return new DetachSCOHashMap(owner, stateManager, fmd, mapData);
45     }
46
47     public VersantSimpleSCO createSCOHashMap(PersistenceCapable owner,
48                                               VersantPersistenceManager pm, VersantStateManager stateManager,
49                                               VersantFieldMetaData fmd, Map JavaDoc map) {
50         return new DetachSCOHashMap(owner, stateManager, fmd, map);
51     }
52     
53       
54 }
55
Popular Tags