Project

General

Profile

Revision 6458

Added by rnahf almost 10 years ago

changed the key type from Identifier to String for ObjectPathMap. (need a Comparable key).

View differences:

src/edu/ucsb/nceas/metacat/dataone/hazelcast/ObjectPathMap.java
8 8
import java.util.Map;
9 9
import java.util.Set;
10 10

  
11
import org.dataone.service.types.v1.Identifier;
12

  
13 11
import com.hazelcast.core.MapLoader;
14 12

  
15 13
import edu.ucsb.nceas.metacat.IdentifierManager;
......
32 30
 * 
33 31
 * @author rnahf
34 32
 */
35
public class ObjectPathMap implements MapLoader<Identifier, String> {
33
public class ObjectPathMap implements MapLoader<String, String> {
36 34
	private static IdentifierManager im;
37 35
	private static String dataPath;
38 36
	private static String metadataPath;
......
80 78
	 *  create the path. 
81 79
	 */
82 80
	@Override
83
	public String load(Identifier key) 
81
	public String load(String key) 
84 82
	{
85 83

  
86 84
		String docid = null;
87 85
		String path = null;
88 86
		try {
89
			docid = im.getLocalId(key.getValue());
87
			docid = im.getLocalId(key);
90 88
			path = pathToDocid(docid);			
91 89
		} catch (McdbDocNotFoundException e) {
92 90
			// TODO Auto-generated catch block
......
103 101
	 *  is not included in the resulting map.
104 102
	 */
105 103
	@Override
106
	public Map<Identifier, String> loadAll(Collection<Identifier> identifiers) {
104
	public Map<String, String> loadAll(Collection<String> identifiers) {
107 105
		
108 106
		
109
		Hashtable<Identifier,String> map = new Hashtable<Identifier,String>();
110
		for (Identifier id : identifiers) {
107
		Hashtable<String,String> map = new Hashtable<String,String>();
108
		for (String id : identifiers) {
111 109
			try {
112
				String docid = im.getLocalId(id.getValue());
110
				String docid = im.getLocalId(id);
113 111
				map.put(id, pathToDocid(docid));
114 112

  
115 113
			} catch (McdbDocNotFoundException e) {
......
130 128
	 * do this to avoid pre-loading a very long list unnecessarily)
131 129
	 */
132 130
	@Override
133
	public Set<Identifier> loadAllKeys() 
131
	public Set<String> loadAllKeys() 
134 132
	{
135 133
		return null;
136 134
		
137 135
//		List<String> guids = im.getAllGUIDs();
138 136
//
139
//		Set<Identifier> set = Collections.synchronizedSet(new HashSet<Identifier>());
137
//		Set<String> set = Collections.synchronizedSet(new HashSet<String>());
140 138
//		for (String guid : guids) {
141
//			Identifier id = new Identifier();
142
//			id.setValue(guid);
143
//			set.add(id);
139
//			set.add(guid);
144 140
//		}
145 141
//		return set;
146 142
	}

Also available in: Unified diff