Project

General

Profile

« Previous | Next » 

Revision 6481

Added by rnahf over 12 years ago

going back to using IDentifier as the key for the ObjectPAthMap.

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

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

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

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

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

Also available in: Unified diff