Project

General

Profile

Revision 6426

use HashMap, HashSet instead of the Tree* classes that require Identifier objects implement Comparable

View differences:

src/edu/ucsb/nceas/metacat/dataone/hazelcast/SystemMetadataMap.java
2 2

  
3 3
import java.sql.SQLException;
4 4
import java.util.Collection;
5
import java.util.HashMap;
6
import java.util.HashSet;
5 7
import java.util.Map;
6 8
import java.util.Set;
7
import java.util.TreeMap;
8
import java.util.TreeSet;
9 9

  
10 10
import org.dataone.service.types.v1.Identifier;
11 11
import org.dataone.service.types.v1.ObjectInfo;
......
62 62
	public SystemMetadata load(Identifier pid) {
63 63
		SystemMetadata sm = null;
64 64
		try {
65
			System.out.println("loading from store: " + pid.getValue());
65 66
			sm = IdentifierManager.getInstance().getSystemMetadata(pid.getValue());
66 67
		} catch (McdbDocNotFoundException e) {
67 68
			// TODO Auto-generated catch block
......
72 73

  
73 74
	@Override
74 75
	public Map<Identifier, SystemMetadata> loadAll(Collection<Identifier> keys) {
75
		Map<Identifier, SystemMetadata> map = new TreeMap<Identifier, SystemMetadata>();
76
		Map<Identifier, SystemMetadata> map = new HashMap<Identifier, SystemMetadata>();
76 77
		for (Identifier key: keys) {
77 78
			SystemMetadata value = load(key);
78 79
			map.put(key, value);
......
82 83

  
83 84
	@Override
84 85
	public Set<Identifier> loadAllKeys() {
85
		Set<Identifier> pids = new TreeSet<Identifier>();
86
		Set<Identifier> pids = new HashSet<Identifier>();
86 87
		try {
87 88
			ObjectList ol = IdentifierManager.getInstance().querySystemMetadata(
88 89
					null, //startTime, 

Also available in: Unified diff