01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.jdo.sco;
12:
13: import com.versant.core.jdo.VersantPersistenceManager;
14: import com.versant.core.jdo.VersantStateManager;
15: import com.versant.core.common.VersantFieldMetaData;
16: import com.versant.core.common.Utils;
17: import com.versant.core.metadata.FieldMetaData;
18: import com.versant.core.common.BindingSupportImpl;
19:
20: import javax.jdo.spi.PersistenceCapable;
21: import java.io.Serializable;
22: import java.util.Map;
23:
24: /**
25: *
26: */
27: public class SCOHashtableFactory implements VersantSCOMapFactory,
28: Serializable {
29:
30: public VersantSimpleSCO createSCOHashMap(PersistenceCapable owner,
31: VersantPersistenceManager pm,
32: VersantStateManager stateManager, VersantFieldMetaData fmd,
33: MapData mapData) {
34: int n = mapData.entryCount;
35: Object[] keys = new Object[n];
36: keys = Utils.getObjectsById(mapData.keys, mapData.entryCount,
37: pm, (FieldMetaData) fmd, fmd.isKeyTypePC());
38: Object[] values = new Object[n];
39: values = Utils.getObjectsById(mapData.values,
40: mapData.entryCount, pm, (FieldMetaData) fmd, fmd
41: .isElementTypePC());
42: mapData.keys = keys;
43: mapData.values = values;
44: return new SCOHashtable(owner, stateManager, fmd, mapData);
45: }
46:
47: public VersantSimpleSCO createSCOHashMap(PersistenceCapable owner,
48: VersantPersistenceManager pm,
49: VersantStateManager stateManager, VersantFieldMetaData fmd,
50: Map map) {
51: return new SCOHashtable(owner, stateManager, fmd, map);
52: }
53:
54: }
|